add factory class (#128)
This commit is contained in:
parent
7399c13f7a
commit
03916950bf
14 changed files with 628 additions and 0 deletions
|
@ -2931,4 +2931,44 @@ class ApiClient
|
|||
|
||||
return $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $request
|
||||
* @return \RetailCrm\Response\ApiResponse
|
||||
*/
|
||||
protected function confirmLpVerificationBySMS(array $request): ApiResponse
|
||||
{
|
||||
return $this->client->makeRequest(
|
||||
'/verification/sms/confirm',
|
||||
Client::METHOD_POST,
|
||||
$request
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $request
|
||||
* @return \RetailCrm\Response\ApiResponse
|
||||
*/
|
||||
protected function sendSmsForLpVerification(array $request): ApiResponse
|
||||
{
|
||||
return $this->client->makeRequest(
|
||||
'/verification/sms/send',
|
||||
Client::METHOD_POST,
|
||||
$request
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $request
|
||||
* @param int $checkId
|
||||
* @return \RetailCrm\Response\ApiResponse
|
||||
*/
|
||||
protected function checkStatusPlVerification(array $request, int $checkId): ApiResponse
|
||||
{
|
||||
return $this->client->makeRequest(
|
||||
"/verification/sms/$checkId/status",
|
||||
Client::METHOD_GET,
|
||||
$request
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Intaro\RetailCrm\Component\ApiClient;
|
|||
|
||||
use Intaro\RetailCrm\Component\ApiClient\Traits\CustomersCorporateTrait;
|
||||
use Intaro\RetailCrm\Component\ApiClient\Traits\CustomersTrait;
|
||||
use Intaro\RetailCrm\Component\ApiClient\Traits\LoyaltyTrait;
|
||||
use RetailCrm\Response\ApiResponse;
|
||||
|
||||
/**
|
||||
|
@ -102,6 +103,7 @@ class ClientAdapter
|
|||
{
|
||||
use CustomersTrait;
|
||||
use CustomersCorporateTrait;
|
||||
use LoyaltyTrait;
|
||||
|
||||
/** @var string */
|
||||
public const ID = 'id';
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Component\ApiClient\Traits
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Component\ApiClient\Traits;
|
||||
|
||||
use Intaro\RetailCrm\Component\Json\Deserializer;
|
||||
use Intaro\RetailCrm\Component\Json\Serializer;
|
||||
use Intaro\RetailCrm\Model\Api\Request\SmsVerification\SmsVerificationConfirmRequest;
|
||||
use Intaro\RetailCrm\Model\Api\Request\SmsVerification\SmsVerificationCreateRequest;
|
||||
use Intaro\RetailCrm\Model\Api\Response\SmsVerification\SmsVerificationConfirmResponse;
|
||||
use Intaro\RetailCrm\Model\Api\Response\SmsVerification\SmsVerificationCreateResponse;
|
||||
use Intaro\RetailCrm\Model\Api\Response\SmsVerification\SmsVerificationStatusRequest;
|
||||
use Intaro\RetailCrm\Model\Api\Response\SmsVerification\SmsVerificationStatusResponse;
|
||||
|
||||
/**
|
||||
* Trait LoyaltyTrait
|
||||
* @package Intaro\RetailCrm\Component\ApiClient\Traits
|
||||
*/
|
||||
trait LoyaltyTrait
|
||||
{
|
||||
/**
|
||||
* @param \Intaro\RetailCrm\Model\Api\Request\SmsVerification\SmsVerificationConfirmRequest $request
|
||||
* @return \Intaro\RetailCrm\Model\Api\Response\SmsVerification\SmsVerificationConfirmResponse|null
|
||||
*/
|
||||
protected function confirmLpVerificationBySMS(SmsVerificationConfirmRequest $request): ?SmsVerificationConfirmResponse
|
||||
{
|
||||
$serialized = Serializer::serializeArray($request);
|
||||
$response = $this->client->confirmLpVerificationBySMS($serialized);
|
||||
|
||||
return Deserializer::deserializeArray($response->getResponseBody(), SmsVerificationConfirmResponse::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Intaro\RetailCrm\Model\Api\Request\SmsVerification\SmsVerificationCreateRequest $request
|
||||
* @return \Intaro\RetailCrm\Model\Api\Response\SmsVerification\SmsVerificationCreateResponse|null
|
||||
*/
|
||||
protected function sendSmsForLpVerification(SmsVerificationCreateRequest $request): ?SmsVerificationCreateResponse
|
||||
{
|
||||
$serialized = Serializer::serializeArray($request);
|
||||
$response = $this->client->sendSmsForLpVerification($serialized);
|
||||
|
||||
return Deserializer::deserializeArray($response->getResponseBody(), SmsVerificationCreateResponse::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Intaro\RetailCrm\Model\Api\Response\SmsVerification\SmsVerificationStatusRequest $request
|
||||
* @return \Intaro\RetailCrm\Model\Api\Response\SmsVerification\SmsVerificationStatusResponse|null
|
||||
*/
|
||||
protected function checkStatusPlVerification(SmsVerificationStatusRequest $request): ?SmsVerificationStatusResponse
|
||||
{
|
||||
$serialized = Serializer::serializeArray($request);
|
||||
$response = $this->client->checkStatusPlVerification($serialized, $request->checkId);
|
||||
|
||||
return Deserializer::deserializeArray($response->getResponseBody(), SmsVerificationStatusResponse::class);
|
||||
}
|
||||
}
|
39
intaro.retailcrm/lib/component/factory/clientfactory.php
Normal file
39
intaro.retailcrm/lib/component/factory/clientfactory.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Component\Factory
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Component\Factory;
|
||||
|
||||
use Intaro\RetailCrm\Component\ApiClient\ClientAdapter;
|
||||
use Intaro\RetailCrm\Component\ConfigProvider;
|
||||
|
||||
/**
|
||||
* Class ClientFactory
|
||||
* @package Intaro\RetailCrm\Component\Factory
|
||||
*/
|
||||
class ClientFactory
|
||||
{
|
||||
/**
|
||||
* Create ClientAdapter with current data for access to CRM
|
||||
*
|
||||
* @return \Intaro\RetailCrm\Component\ApiClient\ClientAdapter|null
|
||||
*/
|
||||
public static function creacteClientAdapter(): ?ClientAdapter
|
||||
{
|
||||
$apiHost = ConfigProvider::getApiUrl();
|
||||
$apiKey = ConfigProvider::getApiKey();
|
||||
|
||||
if (empty($apiHost) || empty($apiKey)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ClientAdapter($apiHost, $apiKey);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api\Request\SmsVerification
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api\Request\SmsVerification;
|
||||
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
use Intaro\RetailCrm\Model\Api\AbstractApiModel;
|
||||
|
||||
/**
|
||||
* Class SmsVerificationConfirmRequest
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api\Response\SmsVerification
|
||||
*/
|
||||
class SmsVerificationConfirmRequest extends AbstractApiModel
|
||||
{
|
||||
/**
|
||||
* @var \Intaro\RetailCrm\Model\Api\SmsVerificationConfirm
|
||||
*
|
||||
* @Mapping\Type("\Intaro\RetailCrm\Model\Api\SmsVerificationConfirm")
|
||||
* @Mapping\SerializedName("verification")
|
||||
*/
|
||||
public $verification;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api\Request\SmsVerification
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api\Request\SmsVerification;
|
||||
|
||||
use Intaro\RetailCrm\Model\Api\AbstractApiModel;
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
/**
|
||||
* Class SmsVerificationCreateRequest
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api\Response\SmsVerification
|
||||
*/
|
||||
class SmsVerificationCreateRequest extends AbstractApiModel
|
||||
{
|
||||
/**
|
||||
* @var \Intaro\RetailCrm\Model\Api\SmsVerificationCreate
|
||||
*
|
||||
* @Mapping\Type("\Intaro\RetailCrm\Model\Api\SmsVerificationCreate")
|
||||
* @Mapping\SerializedName("verification")
|
||||
*/
|
||||
public $verification;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api\Response\SmsVerification
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api\Response\SmsVerification;
|
||||
|
||||
use Intaro\RetailCrm\Model\Api\AbstractApiModel;
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
/**
|
||||
* Class SmsVerificationStatusRequest
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api\Response\SmsVerification
|
||||
*/
|
||||
class SmsVerificationStatusRequest extends AbstractApiModel
|
||||
{
|
||||
/**
|
||||
* Номер телефона для отправки сообщения
|
||||
*
|
||||
* @var string $phone
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("checkId")
|
||||
*/
|
||||
public $checkId;
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api\Response\SmsVerification
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api\Response\SmsVerification;
|
||||
|
||||
use Intaro\RetailCrm\Model\Api\AbstractApiModel;
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
/**
|
||||
* Class SmsVerificationConfirmResponse
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api\Response\SmsVerification
|
||||
*/
|
||||
class SmsVerificationConfirmResponse extends AbstractApiModel
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*
|
||||
* @Mapping\Type("bool")
|
||||
* @Mapping\SerializedName("success")
|
||||
*/
|
||||
public $success;
|
||||
|
||||
/**
|
||||
* @var \Intaro\RetailCrm\Model\Api\SmsVerification
|
||||
*
|
||||
* @Mapping\Type("\Intaro\RetailCrm\Model\Api\SmsVerification")
|
||||
* @Mapping\SerializedName("verification")
|
||||
*/
|
||||
public $verification;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api\Response\SmsVerification
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
|
||||
namespace Intaro\RetailCrm\Model\Api\Response\SmsVerification;
|
||||
|
||||
use Intaro\RetailCrm\Model\Api\AbstractApiModel;
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
/**
|
||||
* Class SmsVerificationCreateResponse
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api\Response\SmsVerification
|
||||
*/
|
||||
class SmsVerificationCreateResponse extends SmsVerificationConfirmResponse
|
||||
{
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api\Response\SmsVerification
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
|
||||
namespace Intaro\RetailCrm\Model\Api\Response\SmsVerification;
|
||||
|
||||
use Intaro\RetailCrm\Model\Api\AbstractApiModel;
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
/**
|
||||
* Class SmsVerificationStatusResponse
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api\Response\SmsVerification
|
||||
*/
|
||||
class SmsVerificationStatusResponse extends SmsVerificationConfirmResponse
|
||||
{
|
||||
}
|
109
intaro.retailcrm/lib/model/api/smsverification.php
Normal file
109
intaro.retailcrm/lib/model/api/smsverification.php
Normal file
|
@ -0,0 +1,109 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api;
|
||||
|
||||
/**
|
||||
* Class SmsVerification
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
*/
|
||||
class SmsVerification extends AbstractApiModel
|
||||
{
|
||||
/**
|
||||
* Дата создания. (Y-m-d H:i:s)
|
||||
*
|
||||
* @var \DateTime
|
||||
*
|
||||
* @Mapping\Type("DateTime<'Y-m-d H:i:s'>")
|
||||
* @Mapping\SerializedName("createdAt")
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* Дата окончания срока жизни. (Y-m-d H:i:s)
|
||||
*
|
||||
* @var \DateTime
|
||||
*
|
||||
* @Mapping\Type("DateTime<'Y-m-d H:i:s'>")
|
||||
* @Mapping\SerializedName("expiredAt")
|
||||
*/
|
||||
public $expiredAt;
|
||||
|
||||
/**
|
||||
* Дата успешной верификации. (Y-m-d H:i:s)
|
||||
*
|
||||
* @var \DateTime
|
||||
*
|
||||
* @Mapping\Type("DateTime<'Y-m-d H:i:s'>")
|
||||
* @Mapping\SerializedName("verifiedAt")
|
||||
*/
|
||||
public $verifiedAt;
|
||||
|
||||
/**
|
||||
* Идентификатор для проверки кода
|
||||
*
|
||||
* @var string $checkId
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("checkId")
|
||||
*/
|
||||
public $checkId;
|
||||
|
||||
/**
|
||||
* Тип действия
|
||||
*
|
||||
* @var string $actionType
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("actionType")
|
||||
*/
|
||||
public $actionType;
|
||||
|
||||
/**
|
||||
* @param \DateTime $createdAt
|
||||
*/
|
||||
public function setCreatedAt(\DateTime $createdAt): void
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $actionType
|
||||
*/
|
||||
public function setActionType(string $actionType): void
|
||||
{
|
||||
$this->actionType = $actionType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $checkId
|
||||
*/
|
||||
public function setCheckId(string $checkId): void
|
||||
{
|
||||
$this->checkId = $checkId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime $verifiedAt
|
||||
*/
|
||||
public function setVerifiedAt(\DateTime $verifiedAt): void
|
||||
{
|
||||
$this->verifiedAt = $verifiedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime $expiredAt
|
||||
*/
|
||||
public function setExpiredAt(\DateTime $expiredAt): void
|
||||
{
|
||||
$this->expiredAt = $expiredAt;
|
||||
}
|
||||
}
|
57
intaro.retailcrm/lib/model/api/smsverificationconfirm.php
Normal file
57
intaro.retailcrm/lib/model/api/smsverificationconfirm.php
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api;
|
||||
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
/**
|
||||
* Class SmsVerificationConfirm
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
*/
|
||||
class SmsVerificationConfirm extends AbstractApiModel
|
||||
{
|
||||
/**
|
||||
* Проверочный код
|
||||
*
|
||||
* @var string $code
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("code")
|
||||
*/
|
||||
protected $code;
|
||||
|
||||
/**
|
||||
* Идентификатор проверки кода
|
||||
*
|
||||
* @var string $checkId
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("checkId")
|
||||
*/
|
||||
protected $checkId;
|
||||
|
||||
/**
|
||||
* @param string $code
|
||||
*/
|
||||
public function setCode(string $code): void
|
||||
{
|
||||
$this->code = $code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $checkId
|
||||
*/
|
||||
public function setCheckId(string $checkId): void
|
||||
{
|
||||
$this->checkId = $checkId;
|
||||
}
|
||||
}
|
111
intaro.retailcrm/lib/model/api/smsverificationcreate.php
Normal file
111
intaro.retailcrm/lib/model/api/smsverificationcreate.php
Normal file
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* @category Integration
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
* @author retailCRM <integration@retailcrm.ru>
|
||||
* @license MIT
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://retailcrm.ru/docs
|
||||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api;
|
||||
|
||||
use Intaro\RetailCrm\Component\Json\Mapping;
|
||||
|
||||
/**
|
||||
* Class SmsVerificationCreate
|
||||
* @package Intaro\RetailCrm\Model\Api
|
||||
*/
|
||||
class SmsVerificationCreate extends AbstractApiModel
|
||||
{
|
||||
/**
|
||||
* Длина кода в сообщении (по умолчанию 4 символа)
|
||||
*
|
||||
* @var integer $length
|
||||
*
|
||||
* @Mapping\Type("integer")
|
||||
* @Mapping\SerializedName("length")
|
||||
*/
|
||||
protected $length;
|
||||
|
||||
/**
|
||||
* Номер телефона для отправки сообщения
|
||||
*
|
||||
* @var string $phone
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("phone")
|
||||
*/
|
||||
protected $phone;
|
||||
|
||||
/**
|
||||
* Тип события, для которого необходима верификация
|
||||
*
|
||||
* @var string $actionType
|
||||
*
|
||||
* @Mapping\Type("string")
|
||||
* @Mapping\SerializedName("actionType")
|
||||
*/
|
||||
protected $actionType;
|
||||
|
||||
/**
|
||||
* ID клиента
|
||||
*
|
||||
* @var integer $customerId
|
||||
*
|
||||
* @Mapping\Type("integer")
|
||||
* @Mapping\SerializedName("customerId")
|
||||
*/
|
||||
protected $customerId;
|
||||
|
||||
/**
|
||||
* ID заказа
|
||||
*
|
||||
* @var integer $orderId
|
||||
*
|
||||
* @Mapping\Type("integer")
|
||||
* @Mapping\SerializedName("orderId")
|
||||
*/
|
||||
protected $orderId;
|
||||
|
||||
/**
|
||||
* @param int $length
|
||||
*/
|
||||
public function setLength(int $length): void
|
||||
{
|
||||
$this->length = $length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $phone
|
||||
*/
|
||||
public function setPhone(string $phone): void
|
||||
{
|
||||
$this->phone = $phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $actionType
|
||||
*/
|
||||
public function setActionType(string $actionType): void
|
||||
{
|
||||
$this->actionType = $actionType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $customerId
|
||||
*/
|
||||
public function setCustomerId(int $customerId): void
|
||||
{
|
||||
$this->customerId = $customerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $orderId
|
||||
*/
|
||||
public function setOrderId(int $orderId): void
|
||||
{
|
||||
$this->orderId = $orderId;
|
||||
}
|
||||
}
|
22
tests/lib/component/factory/ClientFactoryTest.php
Normal file
22
tests/lib/component/factory/ClientFactoryTest.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
namespace Tests\Intaro\RetailCrm\Component\Factory;
|
||||
|
||||
use Bitrix\Main\Config\Option;
|
||||
use Intaro\RetailCrm\Component\ApiClient\ClientAdapter;
|
||||
use Intaro\RetailCrm\Component\ConfigProvider;
|
||||
use Intaro\RetailCrm\Component\Factory\ClientFactory;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ClientFactoryTest extends TestCase
|
||||
{
|
||||
public function testCreacteClientAdapter(): void
|
||||
{
|
||||
$client = ClientFactory::creacteClientAdapter();
|
||||
|
||||
if (empty(ConfigProvider::getApiUrl())) {
|
||||
self::assertEquals(null, $client);
|
||||
} else {
|
||||
self::assertEquals(ClientAdapter::class, get_class($client));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue