logging, order fulfillment by seller
This commit is contained in:
parent
e7a3fa8e55
commit
405621bfdf
@ -185,6 +185,7 @@ class ContainerBuilder implements BuilderInterface
|
||||
public function build(): ContainerInterface
|
||||
{
|
||||
$container = new Container();
|
||||
$container->set(Environment::class, new Environment($this->env));
|
||||
|
||||
switch ($this->env) {
|
||||
case Environment::PROD:
|
||||
|
@ -13,6 +13,7 @@
|
||||
namespace RetailCrm\Builder;
|
||||
|
||||
use RetailCrm\Component\Constants;
|
||||
use RetailCrm\Component\Environment;
|
||||
use RetailCrm\Component\ServiceLocator;
|
||||
use RetailCrm\Component\Storage\ProductSchemaStorage;
|
||||
use RetailCrm\Factory\ProductSchemaStorageFactory;
|
||||
@ -85,6 +86,8 @@ class TopClientBuilder implements ContainerAwareInterface, BuilderInterface
|
||||
$client->setHttpClient($this->container->get(Constants::HTTP_CLIENT));
|
||||
$client->setSerializer($this->container->get(Constants::SERIALIZER));
|
||||
$client->setValidator($this->container->get(Constants::VALIDATOR));
|
||||
$client->setEnv($this->container->get(Environment::class));
|
||||
$client->setLogger($this->container->get(Constants::LOGGER));
|
||||
$client->setRequestFactory($this->container->get(TopRequestFactoryInterface::class));
|
||||
$client->setServiceLocator($this->container->get(ServiceLocator::class));
|
||||
$client->setProcessor($this->container->get(TopRequestProcessorInterface::class));
|
||||
|
@ -12,6 +12,8 @@
|
||||
*/
|
||||
namespace RetailCrm\Component;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Class Environment
|
||||
*
|
||||
@ -27,4 +29,41 @@ class Environment
|
||||
public const PROD = 'PROD';
|
||||
public const DEV = 'DEV';
|
||||
public const TEST = 'TEST';
|
||||
public const DEBUG_VALUES = [self::DEV, self::TEST];
|
||||
public const AVAILABLE_VALUES = [self::PROD, self::DEV, self::TEST];
|
||||
|
||||
/**
|
||||
* @var string $value
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* Environment constructor.
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
public function __construct(string $value)
|
||||
{
|
||||
if (!in_array($value, self::AVAILABLE_VALUES)) {
|
||||
throw new InvalidArgumentException(sprintf('Incorrect environment provided: %s', $value));
|
||||
}
|
||||
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDebug(): bool
|
||||
{
|
||||
return in_array($this->value, self::DEBUG_VALUES);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getValue(): string
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
}
|
||||
|
36
src/Model/Request/AliExpress/Data/SingleOrderQuery.php
Normal file
36
src/Model/Request/AliExpress/Data/SingleOrderQuery.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category SingleOrderQuery
|
||||
* @package RetailCrm\Model\Request\AliExpress\Data
|
||||
* @author RetailCRM <integration@retailcrm.ru>
|
||||
* @license http://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://help.retailcrm.ru
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Model\Request\AliExpress\Data;
|
||||
|
||||
use JMS\Serializer\Annotation as JMS;
|
||||
|
||||
/**
|
||||
* Class SingleOrderQuery
|
||||
*
|
||||
* @category SingleOrderQuery
|
||||
* @package RetailCrm\Model\Request\AliExpress\Data
|
||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||
* @license https://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see https://help.retailcrm.ru
|
||||
*/
|
||||
class SingleOrderQuery
|
||||
{
|
||||
/**
|
||||
* @var int $orderId
|
||||
*
|
||||
* @JMS\Type("int")
|
||||
* @JMS\SerializedName("order_id")
|
||||
*/
|
||||
public $orderId;
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category LogisticsRedefiningListLogisticsService
|
||||
* @package RetailCrm\Model\Request\AliExpress
|
||||
* @author RetailCRM <integration@retailcrm.ru>
|
||||
* @license http://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://help.retailcrm.ru
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Model\Request\AliExpress;
|
||||
|
||||
use RetailCrm\Model\Request\BaseRequest;
|
||||
use RetailCrm\Model\Response\AliExpress\LogisticsRedefiningListLogisticsServiceResponse;
|
||||
|
||||
/**
|
||||
* Class LogisticsRedefiningListLogisticsService
|
||||
*
|
||||
* @category LogisticsRedefiningListLogisticsService
|
||||
* @package RetailCrm\Model\Request\AliExpress
|
||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||
* @license https://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see https://help.retailcrm.ru
|
||||
*/
|
||||
class LogisticsRedefiningListLogisticsService extends BaseRequest
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getMethod(): string
|
||||
{
|
||||
return 'aliexpress.logistics.redefining.listlogisticsservice';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getExpectedResponse(): string
|
||||
{
|
||||
return LogisticsRedefiningListLogisticsServiceResponse::class;
|
||||
}
|
||||
}
|
99
src/Model/Request/AliExpress/SolutionOrderFulfill.php
Normal file
99
src/Model/Request/AliExpress/SolutionOrderFulfill.php
Normal file
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category SolutionOrderFulfill
|
||||
* @package RetailCrm\Model\Request\AliExpress
|
||||
* @author RetailCRM <integration@retailcrm.ru>
|
||||
* @license http://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://help.retailcrm.ru
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Model\Request\AliExpress;
|
||||
|
||||
use RetailCrm\Model\Request\BaseRequest;
|
||||
use JMS\Serializer\Annotation as JMS;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use RetailCrm\Model\Response\AliExpress\SolutionOrderFulfillResponse;
|
||||
|
||||
/**
|
||||
* Class SolutionOrderFulfill
|
||||
*
|
||||
* @category SolutionOrderFulfill
|
||||
* @package RetailCrm\Model\Request\AliExpress
|
||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||
* @license https://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see https://help.retailcrm.ru
|
||||
*/
|
||||
class SolutionOrderFulfill extends BaseRequest
|
||||
{
|
||||
/**
|
||||
* @var string $serviceName
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("service_name")
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
public $serviceName;
|
||||
|
||||
/**
|
||||
* @var string $trackingWebsite
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("tracking_website")
|
||||
*/
|
||||
public $trackingWebsite;
|
||||
|
||||
/**
|
||||
* @var string $outRef
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("out_ref")
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
public $outRef;
|
||||
|
||||
/**
|
||||
* @var string $sendType
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("send_type")
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
public $sendType;
|
||||
|
||||
/**
|
||||
* @var string $description
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("description")
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* @var string $logisticsNo
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("logistics_no")
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
public $logisticsNo;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getMethod(): string
|
||||
{
|
||||
return 'aliexpress.solution.order.fulfill';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getExpectedResponse(): string
|
||||
{
|
||||
return SolutionOrderFulfillResponse::class;
|
||||
}
|
||||
}
|
54
src/Model/Request/AliExpress/SolutionOrderReceiptInfoGet.php
Normal file
54
src/Model/Request/AliExpress/SolutionOrderReceiptInfoGet.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category SolutionOrderReceiptInfoGet
|
||||
* @package RetailCrm\Model\Request\AliExpress
|
||||
* @author RetailCRM <integration@retailcrm.ru>
|
||||
* @license http://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://help.retailcrm.ru
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Model\Request\AliExpress;
|
||||
|
||||
use RetailCrm\Model\Request\BaseRequest;
|
||||
use JMS\Serializer\Annotation as JMS;
|
||||
use RetailCrm\Model\Response\AliExpress\SolutionOrderReceiptInfoGetResponse;
|
||||
|
||||
/**
|
||||
* Class SolutionOrderReceiptInfoGet
|
||||
*
|
||||
* @category SolutionOrderReceiptInfoGet
|
||||
* @package RetailCrm\Model\Request\AliExpress
|
||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||
* @license https://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see https://help.retailcrm.ru
|
||||
*/
|
||||
class SolutionOrderReceiptInfoGet extends BaseRequest
|
||||
{
|
||||
/**
|
||||
* @var \RetailCrm\Model\Request\AliExpress\Data\SingleOrderQuery $param1
|
||||
*
|
||||
* @JMS\Type("RetailCrm\Model\Request\AliExpress\Data\SingleOrderQuery")
|
||||
* @JMS\SerializedName("param1")
|
||||
*/
|
||||
public $param1;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getMethod(): string
|
||||
{
|
||||
return 'aliexpress.solution.order.receiptinfo.get';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getExpectedResponse(): string
|
||||
{
|
||||
return SolutionOrderReceiptInfoGetResponse::class;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category LogisticsRedefiningListLogisticsServiceResponseData
|
||||
* @package RetailCrm\Model\Response\AliExpress\Data
|
||||
* @author RetailCRM <integration@retailcrm.ru>
|
||||
* @license http://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://help.retailcrm.ru
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Model\Response\AliExpress\Data;
|
||||
|
||||
use JMS\Serializer\Annotation as JMS;
|
||||
|
||||
/**
|
||||
* Class LogisticsRedefiningListLogisticsServiceResponseData
|
||||
*
|
||||
* @category LogisticsRedefiningListLogisticsServiceResponseData
|
||||
* @package RetailCrm\Model\Response\AliExpress\Data
|
||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||
* @license https://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see https://help.retailcrm.ru
|
||||
*/
|
||||
class LogisticsRedefiningListLogisticsServiceResponseData
|
||||
{
|
||||
/**
|
||||
* @var \RetailCrm\Model\Response\AliExpress\Result\Entity\AeopLogisticsServiceResultItemList $resultList
|
||||
*
|
||||
* @JMS\Type("RetailCrm\Model\Response\AliExpress\Result\Entity\AeopLogisticsServiceResultItemList")
|
||||
* @JMS\SerializedName("result_list")
|
||||
*/
|
||||
public $resultList;
|
||||
|
||||
/**
|
||||
* @var string $errorDesc
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("error_desc")
|
||||
*/
|
||||
public $errorDesc;
|
||||
|
||||
/**
|
||||
* @var bool $resultSuccess
|
||||
*
|
||||
* @JMS\Type("bool")
|
||||
* @JMS\SerializedName("result_success")
|
||||
*/
|
||||
public $resultSuccess;
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category SolutionOrderFulfillResponseData
|
||||
* @package RetailCrm\Model\Response\AliExpress\Data
|
||||
* @author RetailCRM <integration@retailcrm.ru>
|
||||
* @license http://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://help.retailcrm.ru
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Model\Response\AliExpress\Data;
|
||||
|
||||
use JMS\Serializer\Annotation as JMS;
|
||||
|
||||
/**
|
||||
* Class SolutionOrderFulfillResponseData
|
||||
*
|
||||
* @category SolutionOrderFulfillResponseData
|
||||
* @package RetailCrm\Model\Response\AliExpress\Data
|
||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||
* @license https://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see https://help.retailcrm.ru
|
||||
*/
|
||||
class SolutionOrderFulfillResponseData
|
||||
{
|
||||
/**
|
||||
* @var \RetailCrm\Model\Response\AliExpress\Result\SuccessResult $result
|
||||
*
|
||||
* @JMS\Type("RetailCrm\Model\Response\AliExpress\Result\SuccessResult")
|
||||
* @JMS\SerializedName("result")
|
||||
*/
|
||||
public $result;
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category SolutionOrderReceiptInfoGetResponseData
|
||||
* @package RetailCrm\Model\Response\AliExpress\Data
|
||||
* @author RetailCRM <integration@retailcrm.ru>
|
||||
* @license http://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://help.retailcrm.ru
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Model\Response\AliExpress\Data;
|
||||
|
||||
use JMS\Serializer\Annotation as JMS;
|
||||
use RetailCrm\Model\Response\AliExpress\Result\SolutionOrderReceiptInfoGetResponseResult;
|
||||
|
||||
/**
|
||||
* Class SolutionOrderReceiptInfoGetResponseData
|
||||
*
|
||||
* @category SolutionOrderReceiptInfoGetResponseData
|
||||
* @package RetailCrm\Model\Response\AliExpress\Data
|
||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||
* @license https://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see https://help.retailcrm.ru
|
||||
*/
|
||||
class SolutionOrderReceiptInfoGetResponseData
|
||||
{
|
||||
/**
|
||||
* @var SolutionOrderReceiptInfoGetResponseResult $result
|
||||
*
|
||||
* @JMS\Type("RetailCrm\Model\Response\AliExpress\Result\SolutionOrderReceiptInfoGetResponseResult")
|
||||
* @JMS\SerializedName("result")
|
||||
*/
|
||||
public $result;
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category LogisticsRedefiningListLogisticsServiceResponse
|
||||
* @package RetailCrm\Model\Response\AliExpress
|
||||
* @author RetailCRM <integration@retailcrm.ru>
|
||||
* @license http://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://help.retailcrm.ru
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Model\Response\AliExpress;
|
||||
|
||||
use RetailCrm\Model\Response\BaseResponse;
|
||||
use JMS\Serializer\Annotation as JMS;
|
||||
|
||||
/**
|
||||
* Class LogisticsRedefiningListLogisticsServiceResponse
|
||||
*
|
||||
* @category LogisticsRedefiningListLogisticsServiceResponse
|
||||
* @package RetailCrm\Model\Response\AliExpress
|
||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||
* @license https://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see https://help.retailcrm.ru
|
||||
*/
|
||||
class LogisticsRedefiningListLogisticsServiceResponse extends BaseResponse
|
||||
{
|
||||
/**
|
||||
* @var \RetailCrm\Model\Response\AliExpress\Data\LogisticsRedefiningListLogisticsServiceResponseData $responseData
|
||||
*
|
||||
* @JMS\Type("RetailCrm\Model\Response\AliExpress\Data\LogisticsRedefiningListLogisticsServiceResponseData")
|
||||
* @JMS\SerializedName("aliexpress_logistics_redefining_listlogisticsservice_response")
|
||||
*/
|
||||
public $responseData;
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category AeopLogisticsServiceResultItem
|
||||
* @package RetailCrm\Model\Response\AliExpress\Result\Entity
|
||||
* @author RetailCRM <integration@retailcrm.ru>
|
||||
* @license http://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://help.retailcrm.ru
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Model\Response\AliExpress\Result\Entity;
|
||||
|
||||
use JMS\Serializer\Annotation as JMS;
|
||||
|
||||
/**
|
||||
* Class AeopLogisticsServiceResultItem
|
||||
*
|
||||
* @category AeopLogisticsServiceResultItem
|
||||
* @package RetailCrm\Model\Response\AliExpress\Result\Entity
|
||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||
* @license https://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see https://help.retailcrm.ru
|
||||
*/
|
||||
class AeopLogisticsServiceResultItem
|
||||
{
|
||||
/**
|
||||
* @var int $recommendOrder
|
||||
*
|
||||
* @JMS\Type("int")
|
||||
* @JMS\SerializedName("recommend_order")
|
||||
*/
|
||||
public $recommendOrder;
|
||||
|
||||
/**
|
||||
* @var string $trackingNoRegex
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("tracking_no_regex")
|
||||
*/
|
||||
public $trackingNoRegex;
|
||||
|
||||
/**
|
||||
* @var int $minProcessDay
|
||||
*
|
||||
* @JMS\Type("int")
|
||||
* @JMS\SerializedName("min_process_day")
|
||||
*/
|
||||
public $minProcessDay;
|
||||
|
||||
/**
|
||||
* @var string $logisticsCompany
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("logistics_company")
|
||||
*/
|
||||
public $logisticsCompany;
|
||||
|
||||
/**
|
||||
* @var int $maxProcessDay
|
||||
*
|
||||
* @JMS\Type("int")
|
||||
* @JMS\SerializedName("max_process_day")
|
||||
*/
|
||||
public $maxProcessDay;
|
||||
|
||||
/**
|
||||
* @var string $displayName
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("display_name")
|
||||
*/
|
||||
public $displayName;
|
||||
|
||||
/**
|
||||
* @var string $service_name
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("service_name")
|
||||
*/
|
||||
public $serviceName;
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category AeopLogisticsServiceResultItemList
|
||||
* @package RetailCrm\Model\Response\AliExpress\Result\Entity
|
||||
* @author RetailCRM <integration@retailcrm.ru>
|
||||
* @license http://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://help.retailcrm.ru
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Model\Response\AliExpress\Result\Entity;
|
||||
|
||||
use JMS\Serializer\Annotation as JMS;
|
||||
|
||||
/**
|
||||
* Class AeopLogisticsServiceResultItemList
|
||||
*
|
||||
* @category AeopLogisticsServiceResultItemList
|
||||
* @package RetailCrm\Model\Response\AliExpress\Result\Entity
|
||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||
* @license https://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see https://help.retailcrm.ru
|
||||
*/
|
||||
class AeopLogisticsServiceResultItemList
|
||||
{
|
||||
/**
|
||||
* phpcs:ignore
|
||||
* @var \RetailCrm\Model\Response\AliExpress\Result\Entity\AeopLogisticsServiceResultItem[] $aeopLogisticsServiceResult phpcs:ignore
|
||||
*
|
||||
* @JMS\Type("array<RetailCrm\Model\Response\AliExpress\Result\Entity\AeopLogisticsServiceResultItem>")
|
||||
* @JMS\SerializedName("aeop_logistics_service_result")
|
||||
*/
|
||||
public $aeopLogisticsServiceResult;
|
||||
}
|
@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category SolutionOrderReceiptInfoGetResponseResult
|
||||
* @package RetailCrm\Model\Response\AliExpress\Result
|
||||
* @author RetailCRM <integration@retailcrm.ru>
|
||||
* @license http://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://help.retailcrm.ru
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Model\Response\AliExpress\Result;
|
||||
|
||||
use JMS\Serializer\Annotation as JMS;
|
||||
|
||||
/**
|
||||
* Class SolutionOrderReceiptInfoGetResponseResult
|
||||
*
|
||||
* @category SolutionOrderReceiptInfoGetResponseResult
|
||||
* @package RetailCrm\Model\Response\AliExpress\Result
|
||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||
* @license https://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see https://help.retailcrm.ru
|
||||
* @SuppressWarnings(PHPMD.TooManyFields)
|
||||
*/
|
||||
class SolutionOrderReceiptInfoGetResponseResult
|
||||
{
|
||||
/**
|
||||
* @var string $countryName
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("country_name")
|
||||
*/
|
||||
public $countryName;
|
||||
|
||||
/**
|
||||
* @var string $mobileNo
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("mobile_no")
|
||||
*/
|
||||
public $mobileNo;
|
||||
|
||||
/**
|
||||
* @var string $contactPerson
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("contact_person")
|
||||
*/
|
||||
public $contactPerson;
|
||||
|
||||
/**
|
||||
* @var string $phoneCountry
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("phone_country")
|
||||
*/
|
||||
public $phoneCountry;
|
||||
|
||||
/**
|
||||
* @var string $phoneArea
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("phone_area")
|
||||
*/
|
||||
public $phoneArea;
|
||||
|
||||
/**
|
||||
* @var string $province
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("province")
|
||||
*/
|
||||
public $province;
|
||||
|
||||
/**
|
||||
* @var string $address
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("address")
|
||||
*/
|
||||
public $address;
|
||||
|
||||
/**
|
||||
* @var string $phoneNumber
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("phone_number")
|
||||
*/
|
||||
public $phoneNumber;
|
||||
|
||||
/**
|
||||
* @var string $faxNumber
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("fax_number")
|
||||
*/
|
||||
public $faxNumber;
|
||||
|
||||
/**
|
||||
* @var string $detailAddress
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("detail_address")
|
||||
*/
|
||||
public $detailAddress;
|
||||
|
||||
/**
|
||||
* @var string $city
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("city")
|
||||
*/
|
||||
public $city;
|
||||
|
||||
/**
|
||||
* @var string $country
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("country")
|
||||
*/
|
||||
public $country;
|
||||
|
||||
/**
|
||||
* @var string $address2
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("address2")
|
||||
*/
|
||||
public $address2;
|
||||
|
||||
/**
|
||||
* @var string $faxCountry
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("fax_country")
|
||||
*/
|
||||
public $faxCountry;
|
||||
|
||||
/**
|
||||
* @var string $zip
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("zip")
|
||||
*/
|
||||
public $zip;
|
||||
|
||||
/**
|
||||
* @var string $faxArea
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("fax_area")
|
||||
*/
|
||||
public $faxArea;
|
||||
}
|
36
src/Model/Response/AliExpress/Result/SuccessResult.php
Normal file
36
src/Model/Response/AliExpress/Result/SuccessResult.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category SuccessResult
|
||||
* @package RetailCrm\Model\Response\AliExpress\Result
|
||||
* @author RetailCRM <integration@retailcrm.ru>
|
||||
* @license http://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://help.retailcrm.ru
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Model\Response\AliExpress\Result;
|
||||
|
||||
use JMS\Serializer\Annotation as JMS;
|
||||
|
||||
/**
|
||||
* Class SuccessResult
|
||||
*
|
||||
* @category SuccessResult
|
||||
* @package RetailCrm\Model\Response\AliExpress\Result
|
||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||
* @license https://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see https://help.retailcrm.ru
|
||||
*/
|
||||
class SuccessResult
|
||||
{
|
||||
/**
|
||||
* @var bool $resultSuccess
|
||||
*
|
||||
* @JMS\Type("bool")
|
||||
* @JMS\SerializedName("result_success")
|
||||
*/
|
||||
public $resultSuccess;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category SolutionOrderFulfillResponse
|
||||
* @package RetailCrm\Model\Response\AliExpress
|
||||
* @author RetailCRM <integration@retailcrm.ru>
|
||||
* @license http://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://help.retailcrm.ru
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Model\Response\AliExpress;
|
||||
|
||||
use RetailCrm\Model\Response\AliExpress\Data\SolutionOrderFulfillResponseData;
|
||||
use RetailCrm\Model\Response\BaseResponse;
|
||||
use JMS\Serializer\Annotation as JMS;
|
||||
|
||||
/**
|
||||
* Class SolutionOrderFulfillResponse
|
||||
*
|
||||
* @category SolutionOrderFulfillResponse
|
||||
* @package RetailCrm\Model\Response\AliExpress
|
||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||
* @license https://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see https://help.retailcrm.ru
|
||||
*/
|
||||
class SolutionOrderFulfillResponse extends BaseResponse
|
||||
{
|
||||
/**
|
||||
* @var SolutionOrderFulfillResponseData $responseData
|
||||
*
|
||||
* @JMS\Type("RetailCrm\Model\Response\AliExpress\Data\SolutionOrderFulfillResponseData")
|
||||
* @JMS\SerializedName("aliexpress_solution_order_fulfill_response")
|
||||
*/
|
||||
public $responseData;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category SolutionOrderReceiptInfoGetResponse
|
||||
* @package RetailCrm\Model\Response\AliExpress
|
||||
* @author RetailCRM <integration@retailcrm.ru>
|
||||
* @license http://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see http://help.retailcrm.ru
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Model\Response\AliExpress;
|
||||
|
||||
use RetailCrm\Model\Response\AliExpress\Data\SolutionOrderReceiptInfoGetResponseData;
|
||||
use RetailCrm\Model\Response\BaseResponse;
|
||||
use JMS\Serializer\Annotation as JMS;
|
||||
|
||||
/**
|
||||
* Class SolutionOrderReceiptInfoGetResponse
|
||||
*
|
||||
* @category SolutionOrderReceiptInfoGetResponse
|
||||
* @package RetailCrm\Model\Response\AliExpress
|
||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||
* @license https://retailcrm.ru Proprietary
|
||||
* @link http://retailcrm.ru
|
||||
* @see https://help.retailcrm.ru
|
||||
*/
|
||||
class SolutionOrderReceiptInfoGetResponse extends BaseResponse
|
||||
{
|
||||
/**
|
||||
* @var SolutionOrderReceiptInfoGetResponseData $responseData
|
||||
*
|
||||
* @JMS\Type("RetailCrm\Model\Response\AliExpress\Data\SolutionOrderReceiptInfoGetResponseData")
|
||||
* @JMS\SerializedName("aliexpress_solution_order_receiptinfo_get_response")
|
||||
*/
|
||||
public $responseData;
|
||||
}
|
@ -16,7 +16,10 @@ use JMS\Serializer\SerializerInterface;
|
||||
use Psr\Http\Client\ClientExceptionInterface;
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\NullLogger;
|
||||
use RetailCrm\Builder\AuthorizationUriBuilder;
|
||||
use RetailCrm\Component\Environment;
|
||||
use RetailCrm\Component\Exception\TopApiException;
|
||||
use RetailCrm\Component\Exception\TopClientException;
|
||||
use RetailCrm\Component\ServiceLocator;
|
||||
@ -77,11 +80,6 @@ class TopClient implements TopClientInterface
|
||||
*/
|
||||
protected $serviceLocator;
|
||||
|
||||
/**
|
||||
* @var \RetailCrm\Interfaces\RequestTimestampProviderInterface
|
||||
*/
|
||||
protected $timestampProvider;
|
||||
|
||||
/**
|
||||
* @var TopRequestProcessorInterface $processor
|
||||
*/
|
||||
@ -97,6 +95,16 @@ class TopClient implements TopClientInterface
|
||||
*/
|
||||
protected $productSchemaStorageFactory;
|
||||
|
||||
/**
|
||||
* @var \Psr\Log\LoggerInterface $logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* @var Environment $environment
|
||||
*/
|
||||
protected $env;
|
||||
|
||||
/**
|
||||
* TopClient constructor.
|
||||
*
|
||||
@ -180,6 +188,28 @@ class TopClient implements TopClientInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Psr\Log\LoggerInterface $logger
|
||||
*
|
||||
* @return TopClient
|
||||
*/
|
||||
public function setLogger(LoggerInterface $logger): TopClient
|
||||
{
|
||||
$this->logger = $logger;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \RetailCrm\Component\Environment $env
|
||||
*
|
||||
* @return TopClient
|
||||
*/
|
||||
public function setEnv(Environment $env): TopClient
|
||||
{
|
||||
$this->env = $env;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \RetailCrm\Component\ServiceLocator
|
||||
*/
|
||||
@ -249,9 +279,10 @@ class TopClient implements TopClientInterface
|
||||
throw new TopClientException(sprintf('Error sending request: %s', $exception->getMessage()), $exception);
|
||||
}
|
||||
|
||||
$bodyData = self::getBodyContents($httpResponse->getBody());
|
||||
/** @var BaseResponse $response */
|
||||
$response = $this->serializer->deserialize(
|
||||
self::getBodyContents($httpResponse->getBody()),
|
||||
$bodyData,
|
||||
$request->getExpectedResponse(),
|
||||
$request->format
|
||||
);
|
||||
@ -264,6 +295,15 @@ class TopClient implements TopClientInterface
|
||||
throw new TopApiException($response->errorResponse, $response->requestId);
|
||||
}
|
||||
|
||||
if (null !== $this->logger && !($this->logger instanceof NullLogger) && $this->env->isDebug()) {
|
||||
$this->logger->debug(sprintf(
|
||||
'<AliExpress TOP Client> Request %s (%s): got response %s',
|
||||
$request->getMethod(),
|
||||
$httpRequest->getUri()->__toString(),
|
||||
$bodyData
|
||||
));
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,6 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
|
||||
$this->container = ContainerBuilder::create()
|
||||
->setEnv(Environment::TEST)
|
||||
->setClient(is_null($client) ? self::getMockClient() : $client)
|
||||
->setLogger(new StdoutLogger())
|
||||
->setStreamFactory($factory)
|
||||
->setRequestFactory($factory)
|
||||
->setUriFactory($factory)
|
||||
|
@ -24,11 +24,15 @@ use RetailCrm\Model\Enum\OfflinePickupTypes;
|
||||
use RetailCrm\Model\Enum\OrderStatuses;
|
||||
use RetailCrm\Model\Request\AliExpress\Data\OrderQuery;
|
||||
use RetailCrm\Model\Request\AliExpress\Data\SingleItemRequestDto;
|
||||
use RetailCrm\Model\Request\AliExpress\Data\SingleOrderQuery;
|
||||
use RetailCrm\Model\Request\AliExpress\LogisticsRedefiningListLogisticsService;
|
||||
use RetailCrm\Model\Request\AliExpress\PostproductRedefiningCategoryForecast;
|
||||
use RetailCrm\Model\Request\AliExpress\SolutionFeedListGet;
|
||||
use RetailCrm\Model\Request\AliExpress\SolutionFeedQuery;
|
||||
use RetailCrm\Model\Request\AliExpress\SolutionFeedSubmit;
|
||||
use RetailCrm\Model\Request\AliExpress\SolutionOrderFulfill;
|
||||
use RetailCrm\Model\Request\AliExpress\SolutionOrderGet;
|
||||
use RetailCrm\Model\Request\AliExpress\SolutionOrderReceiptInfoGet;
|
||||
use RetailCrm\Model\Request\AliExpress\SolutionProductSchemaGet;
|
||||
use RetailCrm\Model\Request\AliExpress\SolutionSellerCategoryTreeQuery;
|
||||
use RetailCrm\Model\Request\Taobao\HttpDnsGetRequest;
|
||||
@ -616,4 +620,151 @@ EOF;
|
||||
$result->targetList->orderDto[0]->offlinePickupType
|
||||
);
|
||||
}
|
||||
|
||||
public function testAliexpressSolutionOrderReceiptInfoGet()
|
||||
{
|
||||
$json = <<<'EOF'
|
||||
{
|
||||
"aliexpress_solution_order_receiptinfo_get_response":{
|
||||
"result":{
|
||||
"country_name":"Russian Federation",
|
||||
"mobile_no":"4679974",
|
||||
"contact_person":"Mark",
|
||||
"phone_country":"04",
|
||||
"phone_area":"12345",
|
||||
"province":"Moscow",
|
||||
"address":"address 001",
|
||||
"phone_number":"88688435",
|
||||
"fax_number":"88688436",
|
||||
"detail_address":"center street No.99",
|
||||
"city":"Babenki",
|
||||
"country":"RU",
|
||||
"address2":"address 001",
|
||||
"fax_country":"400120",
|
||||
"zip":"400120",
|
||||
"fax_area":"203"
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF;
|
||||
$mock = self::getMockClient();
|
||||
$mock->on(
|
||||
RequestMatcher::createMatcher('api.taobao.com')
|
||||
->setPath('/router/rest')
|
||||
->setOptionalQueryParams([
|
||||
'app_key' => self::getEnvAppKey(),
|
||||
'method' => 'aliexpress.solution.order.receiptinfo.get',
|
||||
'session' => self::getEnvToken()
|
||||
]),
|
||||
$this->responseJson(200, $json)
|
||||
);
|
||||
$client = TopClientBuilder::create()
|
||||
->setContainer($this->getContainer($mock))
|
||||
->setAppData($this->getEnvAppData())
|
||||
->setAuthenticator($this->getEnvTokenAuthenticator())
|
||||
->build();
|
||||
$query = new SingleOrderQuery();
|
||||
$query->orderId = 1;
|
||||
$request = new SolutionOrderReceiptInfoGet();
|
||||
$request->param1 = $query;
|
||||
|
||||
/** @var \RetailCrm\Model\Response\AliExpress\SolutionOrderReceiptInfoGetResponse $response */
|
||||
$response = $client->sendAuthenticatedRequest($request);
|
||||
|
||||
self::assertNotNull($response->responseData);
|
||||
self::assertNotNull($response->responseData->result);
|
||||
|
||||
foreach (array_keys(get_class_vars(get_class($response->responseData->result))) as $key) {
|
||||
self::assertNotEmpty($response->responseData->result->$key);
|
||||
}
|
||||
}
|
||||
|
||||
public function testAliexpressLogisticsRedefiningListLogisticsService()
|
||||
{
|
||||
$json = <<<'EOF'
|
||||
{
|
||||
"aliexpress_logistics_redefining_listlogisticsservice_response":{
|
||||
"result_list":{
|
||||
"aeop_logistics_service_result":[
|
||||
{
|
||||
"recommend_order":11,
|
||||
"tracking_no_regex":"^[a-zA-z]{2}[A-Za-z0-9]{9}[a-zA-z]{2}$",
|
||||
"min_process_day":1,
|
||||
"logistics_company":"CPAM",
|
||||
"max_process_day":5,
|
||||
"display_name":"China Post Registered Air Mail",
|
||||
"service_name":"CPAM"
|
||||
}
|
||||
]
|
||||
},
|
||||
"error_desc":"System error",
|
||||
"result_success":true
|
||||
}
|
||||
}
|
||||
EOF;
|
||||
$mock = self::getMockClient();
|
||||
$mock->on(
|
||||
RequestMatcher::createMatcher('api.taobao.com')
|
||||
->setPath('/router/rest')
|
||||
->setOptionalQueryParams([
|
||||
'app_key' => self::getEnvAppKey(),
|
||||
'method' => 'aliexpress.logistics.redefining.listlogisticsservice',
|
||||
'session' => self::getEnvToken()
|
||||
]),
|
||||
$this->responseJson(200, $json)
|
||||
);
|
||||
$client = TopClientBuilder::create()
|
||||
->setContainer($this->getContainer($mock))
|
||||
->setAppData($this->getEnvAppData())
|
||||
->setAuthenticator($this->getEnvTokenAuthenticator())
|
||||
->build();
|
||||
/** @var \RetailCrm\Model\Response\AliExpress\LogisticsRedefiningListLogisticsServiceResponse $response */
|
||||
$response = $client->sendAuthenticatedRequest(new LogisticsRedefiningListLogisticsService());
|
||||
|
||||
self::assertEquals(
|
||||
'China Post Registered Air Mail',
|
||||
$response->responseData->resultList->aeopLogisticsServiceResult[0]->displayName
|
||||
);
|
||||
}
|
||||
|
||||
public function testAliexpressSolutionOrderFulfill()
|
||||
{
|
||||
$json = <<<'EOF'
|
||||
{
|
||||
"aliexpress_solution_order_fulfill_response":{
|
||||
"result":{
|
||||
"result_success":true
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF;
|
||||
$mock = self::getMockClient();
|
||||
$mock->on(
|
||||
RequestMatcher::createMatcher('api.taobao.com')
|
||||
->setPath('/router/rest')
|
||||
->setOptionalQueryParams([
|
||||
'app_key' => self::getEnvAppKey(),
|
||||
'method' => 'aliexpress.solution.order.fulfill',
|
||||
'session' => self::getEnvToken()
|
||||
]),
|
||||
$this->responseJson(200, $json)
|
||||
);
|
||||
$client = TopClientBuilder::create()
|
||||
->setContainer($this->getContainer($mock))
|
||||
->setAppData($this->getEnvAppData())
|
||||
->setAuthenticator($this->getEnvTokenAuthenticator())
|
||||
->build();
|
||||
$request = new SolutionOrderFulfill();
|
||||
$request->serviceName = 'EMS';
|
||||
$request->trackingWebsite = 'www.17track.com';
|
||||
$request->outRef = '888877779999';
|
||||
$request->sendType = 'part';
|
||||
$request->description = 'memo';
|
||||
$request->logisticsNo = 'LA88887777CN';
|
||||
|
||||
/** @var \RetailCrm\Model\Response\AliExpress\SolutionOrderFulfillResponse $response */
|
||||
$response = $client->sendAuthenticatedRequest($request);
|
||||
|
||||
self::assertTrue($response->responseData->result->resultSuccess);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user