complete feed solution with tests (no generic models for feed yet...)
This commit is contained in:
parent
5ee9f2a1fc
commit
294211417d
@ -29,7 +29,5 @@ class Constants
|
|||||||
public const LOGGER = 'logger';
|
public const LOGGER = 'logger';
|
||||||
public const VALIDATOR = 'validator';
|
public const VALIDATOR = 'validator';
|
||||||
public const TOP_VERSION = 'top-sdk-php-20180326';
|
public const TOP_VERSION = 'top-sdk-php-20180326';
|
||||||
public const SIGN_TYPE_MD5 = 'md5';
|
|
||||||
public const SIGN_TYPE_HMAC = 'hmac';
|
|
||||||
public const UNSIGNED_MARK = '00000000000000000000000000000000';
|
public const UNSIGNED_MARK = '00000000000000000000000000000000';
|
||||||
}
|
}
|
||||||
|
30
src/Model/Enum/AvailableResponseFormats.php
Normal file
30
src/Model/Enum/AvailableResponseFormats.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP version 7.4
|
||||||
|
*
|
||||||
|
* @category AvailableResponseFormats
|
||||||
|
* @package RetailCrm\Model\Enum
|
||||||
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
|
* @license http://retailcrm.ru Proprietary
|
||||||
|
* @link http://retailcrm.ru
|
||||||
|
* @see http://help.retailcrm.ru
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Model\Enum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class AvailableResponseFormats
|
||||||
|
*
|
||||||
|
* @category AvailableResponseFormats
|
||||||
|
* @package RetailCrm\Model\Enum
|
||||||
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
|
* @license https://retailcrm.ru Proprietary
|
||||||
|
* @link http://retailcrm.ru
|
||||||
|
* @see https://help.retailcrm.ru
|
||||||
|
*/
|
||||||
|
class AvailableResponseFormats
|
||||||
|
{
|
||||||
|
public const XML = 'xml';
|
||||||
|
public const JSON = 'json';
|
||||||
|
public const AVAILABLE_FORMATS = [self::JSON, self::XML];
|
||||||
|
}
|
30
src/Model/Enum/AvailableSignMethods.php
Normal file
30
src/Model/Enum/AvailableSignMethods.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP version 7.4
|
||||||
|
*
|
||||||
|
* @category AvailableSignMethods
|
||||||
|
* @package RetailCrm\Model\Enum
|
||||||
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
|
* @license http://retailcrm.ru Proprietary
|
||||||
|
* @link http://retailcrm.ru
|
||||||
|
* @see http://help.retailcrm.ru
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Model\Enum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class AvailableSignMethods
|
||||||
|
*
|
||||||
|
* @category AvailableSignMethods
|
||||||
|
* @package RetailCrm\Model\Enum
|
||||||
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
|
* @license https://retailcrm.ru Proprietary
|
||||||
|
* @link http://retailcrm.ru
|
||||||
|
* @see https://help.retailcrm.ru
|
||||||
|
*/
|
||||||
|
class AvailableSignMethods
|
||||||
|
{
|
||||||
|
public const MD5 = 'md5';
|
||||||
|
public const HMAC_MD5 = 'hmac';
|
||||||
|
public const AVAILABLE_METHODS = [self::MD5, self::HMAC_MD5];
|
||||||
|
}
|
63
src/Model/Enum/CategoryForecastSupportedLanguages.php
Normal file
63
src/Model/Enum/CategoryForecastSupportedLanguages.php
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP version 7.4
|
||||||
|
*
|
||||||
|
* @category CategoryForecastSupportedLanguages
|
||||||
|
* @package RetailCrm\Model\Enum
|
||||||
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
|
* @license http://retailcrm.ru Proprietary
|
||||||
|
* @link http://retailcrm.ru
|
||||||
|
* @see http://help.retailcrm.ru
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Model\Enum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CategoryForecastSupportedLanguages
|
||||||
|
*
|
||||||
|
* @category CategoryForecastSupportedLanguages
|
||||||
|
* @package RetailCrm\Model\Enum
|
||||||
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
|
* @license https://retailcrm.ru Proprietary
|
||||||
|
* @link http://retailcrm.ru
|
||||||
|
* @see https://help.retailcrm.ru
|
||||||
|
*/
|
||||||
|
class CategoryForecastSupportedLanguages
|
||||||
|
{
|
||||||
|
public const EN = 'en';
|
||||||
|
public const RU = 'ru';
|
||||||
|
public const PT = 'pt';
|
||||||
|
public const ID = 'id';
|
||||||
|
public const ES = 'es';
|
||||||
|
public const FR = 'fr';
|
||||||
|
public const IT = 'it';
|
||||||
|
public const DE = 'de';
|
||||||
|
public const NL = 'nl';
|
||||||
|
public const TR = 'tr';
|
||||||
|
public const HE = 'he';
|
||||||
|
public const JA = 'ja';
|
||||||
|
public const AR = 'ar';
|
||||||
|
public const TH = 'th';
|
||||||
|
public const VI = 'vi';
|
||||||
|
public const KO = 'ko';
|
||||||
|
public const PL = 'pl';
|
||||||
|
public const SUPPORTED_LANGUAGES = [
|
||||||
|
self::EN,
|
||||||
|
self::RU,
|
||||||
|
self::PT,
|
||||||
|
self::ID,
|
||||||
|
self::ES,
|
||||||
|
self::FR,
|
||||||
|
self::IT,
|
||||||
|
self::DE,
|
||||||
|
self::NL,
|
||||||
|
self::TR,
|
||||||
|
self::HE,
|
||||||
|
self::JA,
|
||||||
|
self::AR,
|
||||||
|
self::TH,
|
||||||
|
self::VI,
|
||||||
|
self::KO,
|
||||||
|
self::PL
|
||||||
|
];
|
||||||
|
}
|
37
src/Model/Enum/FeedOperationTypes.php
Normal file
37
src/Model/Enum/FeedOperationTypes.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP version 7.4
|
||||||
|
*
|
||||||
|
* @category FeedOperationTypes
|
||||||
|
* @package RetailCrm\Model\Enum
|
||||||
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
|
* @license http://retailcrm.ru Proprietary
|
||||||
|
* @link http://retailcrm.ru
|
||||||
|
* @see http://help.retailcrm.ru
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Model\Enum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class FeedOperationTypes
|
||||||
|
*
|
||||||
|
* @category FeedOperationTypes
|
||||||
|
* @package RetailCrm\Model\Enum
|
||||||
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
|
* @license https://retailcrm.ru Proprietary
|
||||||
|
* @link http://retailcrm.ru
|
||||||
|
* @see https://help.retailcrm.ru
|
||||||
|
*/
|
||||||
|
class FeedOperationTypes
|
||||||
|
{
|
||||||
|
public const PRODUCT_CREATE = 'PRODUCT_CREATE';
|
||||||
|
public const PRODUCT_FULL_UPDATE = 'PRODUCT_FULL_UPDATE';
|
||||||
|
public const PRODUCT_STOCKS_UPDATE = 'PRODUCT_STOCKS_UPDATE';
|
||||||
|
public const PRODUCT_PRICES_UPDATE = 'PRODUCT_PRICES_UPDATE';
|
||||||
|
public const ALLOWED_OPERATION_TYPES = [
|
||||||
|
self::PRODUCT_CREATE,
|
||||||
|
self::PRODUCT_FULL_UPDATE,
|
||||||
|
self::PRODUCT_STOCKS_UPDATE,
|
||||||
|
self::PRODUCT_PRICES_UPDATE
|
||||||
|
];
|
||||||
|
}
|
31
src/Model/Enum/FeedStatuses.php
Normal file
31
src/Model/Enum/FeedStatuses.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP version 7.4
|
||||||
|
*
|
||||||
|
* @category FeedStatuses
|
||||||
|
* @package RetailCrm\Model\Enum
|
||||||
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
|
* @license http://retailcrm.ru Proprietary
|
||||||
|
* @link http://retailcrm.ru
|
||||||
|
* @see http://help.retailcrm.ru
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Model\Enum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class FeedStatuses
|
||||||
|
*
|
||||||
|
* @category FeedStatuses
|
||||||
|
* @package RetailCrm\Model\Enum
|
||||||
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
|
* @license https://retailcrm.ru Proprietary
|
||||||
|
* @link http://retailcrm.ru
|
||||||
|
* @see https://help.retailcrm.ru
|
||||||
|
*/
|
||||||
|
class FeedStatuses
|
||||||
|
{
|
||||||
|
public const FINISH = 'FINISH';
|
||||||
|
public const PROCESSING = 'PROCESSING';
|
||||||
|
public const QUEUEING = 'QUEUEING';
|
||||||
|
public const AVAILABLE_STATUSES = [self::FINISH, self::PROCESSING, self::QUEUEING];
|
||||||
|
}
|
@ -43,9 +43,7 @@ class PostproductRedefiningCategoryForecast extends BaseRequest
|
|||||||
*
|
*
|
||||||
* @JMS\Type("string")
|
* @JMS\Type("string")
|
||||||
* @JMS\SerializedName("locale")
|
* @JMS\SerializedName("locale")
|
||||||
*
|
* @Assert\Choice(choices=RetailCrm\Model\Enum\CategoryForecastSupportedLanguages::SUPPORTED_LANGUAGES)
|
||||||
* phpcs:disable Generic.Files.LineLength
|
|
||||||
* @Assert\Choice({"en", "ru", "pt", "id", "es", "fr", "it", "de", "nl", "tr", "he", "ja", "ar", "th", "vi", "ko", "pl"})
|
|
||||||
*/
|
*/
|
||||||
public $locale;
|
public $locale;
|
||||||
|
|
||||||
|
78
src/Model/Request/AliExpress/SolutionFeedListGet.php
Normal file
78
src/Model/Request/AliExpress/SolutionFeedListGet.php
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP version 7.4
|
||||||
|
*
|
||||||
|
* @category SolutionFeedListGet
|
||||||
|
* @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 JMS\Serializer\Annotation as JMS;
|
||||||
|
use RetailCrm\Model\Request\BaseRequest;
|
||||||
|
use RetailCrm\Model\Response\AliExpress\SolutionFeedListGetResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SolutionFeedListGet
|
||||||
|
*
|
||||||
|
* @category SolutionFeedListGet
|
||||||
|
* @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 SolutionFeedListGet extends BaseRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var int $currentPage
|
||||||
|
*
|
||||||
|
* @JMS\Type("int")
|
||||||
|
* @JMS\SerializedName("current_page")
|
||||||
|
*/
|
||||||
|
public $currentPage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $feedType
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("feed_type")
|
||||||
|
*/
|
||||||
|
public $feedType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $pageSize
|
||||||
|
*
|
||||||
|
* @JMS\Type("int")
|
||||||
|
* @JMS\SerializedName("page_size")
|
||||||
|
*/
|
||||||
|
public $pageSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $status
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("status")
|
||||||
|
*/
|
||||||
|
public $status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getMethod(): string
|
||||||
|
{
|
||||||
|
return 'aliexpress.solution.feed.list.get';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getExpectedResponse(): string
|
||||||
|
{
|
||||||
|
return SolutionFeedListGetResponse::class;
|
||||||
|
}
|
||||||
|
}
|
57
src/Model/Request/AliExpress/SolutionFeedQuery.php
Normal file
57
src/Model/Request/AliExpress/SolutionFeedQuery.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP version 7.4
|
||||||
|
*
|
||||||
|
* @category SolutionFeedQuery
|
||||||
|
* @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\SolutionFeedQueryResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SolutionFeedQuery
|
||||||
|
*
|
||||||
|
* @category SolutionFeedQuery
|
||||||
|
* @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 SolutionFeedQuery extends BaseRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Job ID.
|
||||||
|
* This field is marked as optional for some reason... so, no assertions here.
|
||||||
|
*
|
||||||
|
* @var int $jobId
|
||||||
|
*
|
||||||
|
* @JMS\Type("int")
|
||||||
|
* @JMS\SerializedName("job_id")
|
||||||
|
*/
|
||||||
|
public $jobId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getMethod(): string
|
||||||
|
{
|
||||||
|
return 'aliexpress.solution.feed.query';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getExpectedResponse(): string
|
||||||
|
{
|
||||||
|
return SolutionFeedQueryResponse::class;
|
||||||
|
}
|
||||||
|
}
|
@ -30,22 +30,12 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
*/
|
*/
|
||||||
class SolutionFeedSubmit extends BaseRequest
|
class SolutionFeedSubmit extends BaseRequest
|
||||||
{
|
{
|
||||||
public const PRODUCT_CREATE = 'PRODUCT_CREATE';
|
|
||||||
public const PRODUCT_FULL_UPDATE = 'PRODUCT_FULL_UPDATE';
|
|
||||||
public const PRODUCT_STOCKS_UPDATE = 'PRODUCT_STOCKS_UPDATE';
|
|
||||||
public const PRODUCT_PRICES_UPDATE = 'PRODUCT_PRICES_UPDATE';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string $operationType
|
* @var string $operationType
|
||||||
*
|
*
|
||||||
* @JMS\Type("string")
|
* @JMS\Type("string")
|
||||||
* @JMS\SerializedName("operation_type")
|
* @JMS\SerializedName("operation_type")
|
||||||
* @Assert\Choice({
|
* @Assert\Choice(choices=RetailCrm\Model\Enum\FeedOperationTypes::ALLOWED_OPERATION_TYPES)
|
||||||
* "PRODUCT_CREATE",
|
|
||||||
* "PRODUCT_FULL_UPDATE",
|
|
||||||
* "PRODUCT_STOCKS_UPDATE",
|
|
||||||
* "PRODUCT_PRICES_UPDATE"
|
|
||||||
* })
|
|
||||||
*/
|
*/
|
||||||
public $operationType;
|
public $operationType;
|
||||||
|
|
||||||
@ -54,7 +44,7 @@ class SolutionFeedSubmit extends BaseRequest
|
|||||||
*
|
*
|
||||||
* @JMS\Type("array<RetailCrm\Model\Request\AliExpress\Data\SingleItemRequestDto>")
|
* @JMS\Type("array<RetailCrm\Model\Request\AliExpress\Data\SingleItemRequestDto>")
|
||||||
* @JMS\SerializedName("item_list")
|
* @JMS\SerializedName("item_list")
|
||||||
* @Assert\NotBlank()
|
* @Assert\Count(min=1, max=2000)
|
||||||
*/
|
*/
|
||||||
public $itemList;
|
public $itemList;
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ namespace RetailCrm\Model\Request;
|
|||||||
|
|
||||||
use JMS\Serializer\Annotation as JMS;
|
use JMS\Serializer\Annotation as JMS;
|
||||||
use RetailCrm\Component\Constants;
|
use RetailCrm\Component\Constants;
|
||||||
|
use RetailCrm\Model\Enum\AvailableResponseFormats;
|
||||||
|
use RetailCrm\Model\Enum\AvailableSignMethods;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,9 +74,9 @@ abstract class BaseRequest
|
|||||||
* @JMS\Type("string")
|
* @JMS\Type("string")
|
||||||
* @JMS\SerializedName("format")
|
* @JMS\SerializedName("format")
|
||||||
* @Assert\NotBlank()
|
* @Assert\NotBlank()
|
||||||
* @Assert\Choice({"xml", "json"})
|
* @Assert\Choice(choices=RetailCrm\Model\Enum\AvailableResponseFormats::AVAILABLE_FORMATS)
|
||||||
*/
|
*/
|
||||||
public $format = 'json';
|
public $format = AvailableResponseFormats::JSON;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string $version
|
* @var string $version
|
||||||
@ -101,9 +103,9 @@ abstract class BaseRequest
|
|||||||
* @JMS\Type("string")
|
* @JMS\Type("string")
|
||||||
* @JMS\SerializedName("sign_method")
|
* @JMS\SerializedName("sign_method")
|
||||||
* @Assert\NotBlank()
|
* @Assert\NotBlank()
|
||||||
* @Assert\Choice({"hmac", "md5"})
|
* @Assert\Choice(choices=RetailCrm\Model\Enum\AvailableSignMethods::AVAILABLE_METHODS)
|
||||||
*/
|
*/
|
||||||
public $signMethod = Constants::SIGN_TYPE_HMAC;
|
public $signMethod = AvailableSignMethods::HMAC_MD5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string $sign
|
* @var string $sign
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP version 7.4
|
||||||
|
*
|
||||||
|
* @category SolutionFeedListGetResponseData
|
||||||
|
* @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 RetailCrm\Model\Response\AbstractResponseData;
|
||||||
|
use JMS\Serializer\Annotation as JMS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SolutionFeedListGetResponseData
|
||||||
|
*
|
||||||
|
* @category SolutionFeedListGetResponseData
|
||||||
|
* @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 SolutionFeedListGetResponseData extends AbstractResponseData
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var int $currentPage
|
||||||
|
*
|
||||||
|
* @JMS\Type("int")
|
||||||
|
* @JMS\SerializedName("current_page")
|
||||||
|
*/
|
||||||
|
public $currentPage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \RetailCrm\Model\Response\AliExpress\Result\Entity\BatchOperationJobDtoList $jobList
|
||||||
|
*
|
||||||
|
* @JMS\Type("RetailCrm\Model\Response\AliExpress\Result\Entity\BatchOperationJobDtoList")
|
||||||
|
* @JMS\SerializedName("job_list")
|
||||||
|
*/
|
||||||
|
public $jobList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $pageSize
|
||||||
|
*
|
||||||
|
* @JMS\Type("int")
|
||||||
|
* @JMS\SerializedName("page_size")
|
||||||
|
*/
|
||||||
|
public $pageSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $totalCount
|
||||||
|
*
|
||||||
|
* @JMS\Type("int")
|
||||||
|
* @JMS\SerializedName("total_count")
|
||||||
|
*/
|
||||||
|
public $totalCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $totalPage
|
||||||
|
*
|
||||||
|
* @JMS\Type("int")
|
||||||
|
* @JMS\SerializedName("total_page")
|
||||||
|
*/
|
||||||
|
public $totalPage;
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP version 7.4
|
||||||
|
*
|
||||||
|
* @category SolutionFeedQueryResponseData
|
||||||
|
* @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\AbstractResponseData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SolutionFeedQueryResponseData
|
||||||
|
*
|
||||||
|
* @category SolutionFeedQueryResponseData
|
||||||
|
* @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 SolutionFeedQueryResponseData extends AbstractResponseData
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var int $jobId
|
||||||
|
*
|
||||||
|
* @JMS\Type("int")
|
||||||
|
* @JMS\SerializedName("job_id")
|
||||||
|
*/
|
||||||
|
public $jobId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $successItemCount
|
||||||
|
*
|
||||||
|
* @JMS\Type("int")
|
||||||
|
* @JMS\SerializedName("success_item_count")
|
||||||
|
*/
|
||||||
|
public $successItemCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \RetailCrm\Model\Response\AliExpress\Result\Entity\SingleItemResponseDtoList $resultList
|
||||||
|
*
|
||||||
|
* @JMS\Type("RetailCrm\Model\Response\AliExpress\Result\Entity\SingleItemResponseDtoList")
|
||||||
|
* @JMS\SerializedName("result_list")
|
||||||
|
*/
|
||||||
|
public $resultList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $totalItemCount
|
||||||
|
*
|
||||||
|
* @JMS\Type("int")
|
||||||
|
* @JMS\SerializedName("total_item_count")
|
||||||
|
*/
|
||||||
|
public $totalItemCount;
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP version 7.4
|
||||||
|
*
|
||||||
|
* @category BatchOperationJobDto
|
||||||
|
* @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 BatchOperationJobDto
|
||||||
|
*
|
||||||
|
* @category BatchOperationJobDto
|
||||||
|
* @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 BatchOperationJobDto
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string $status
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("status")
|
||||||
|
*/
|
||||||
|
public $status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $operationType
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("operation_type")
|
||||||
|
*/
|
||||||
|
public $operationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $jobId
|
||||||
|
*
|
||||||
|
* @JMS\Type("int")
|
||||||
|
* @JMS\SerializedName("job_id")
|
||||||
|
*/
|
||||||
|
public $jobId;
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP version 7.4
|
||||||
|
*
|
||||||
|
* @category BatchOperationJobDtoList
|
||||||
|
* @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 BatchOperationJobDtoList
|
||||||
|
*
|
||||||
|
* @category BatchOperationJobDtoList
|
||||||
|
* @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 BatchOperationJobDtoList
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var \RetailCrm\Model\Response\AliExpress\Result\BatchOperationJobDto[] $batchOperationJobDto
|
||||||
|
*
|
||||||
|
* @JMS\Type("array<RetailCrm\Model\Response\AliExpress\Result\BatchOperationJobDto>")
|
||||||
|
* @JMS\SerializedName("batch_operation_job_dto")
|
||||||
|
*/
|
||||||
|
public $batchOperationJobDto;
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP version 7.4
|
||||||
|
*
|
||||||
|
* @category SingleItemResponseDtoList
|
||||||
|
* @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 SingleItemResponseDtoList
|
||||||
|
*
|
||||||
|
* @category SingleItemResponseDtoList
|
||||||
|
* @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 SingleItemResponseDtoList
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var \RetailCrm\Model\Response\AliExpress\Result\SingleItemResponseDto[] $singleItemResponseDto
|
||||||
|
*
|
||||||
|
* @JMS\Type("array<RetailCrm\Model\Response\AliExpress\Result\SingleItemResponseDto>")
|
||||||
|
* @JMS\SerializedName("single_item_response_dto")
|
||||||
|
*/
|
||||||
|
public $singleItemResponseDto;
|
||||||
|
}
|
44
src/Model/Response/AliExpress/Result/ItemExecutionResult.php
Normal file
44
src/Model/Response/AliExpress/Result/ItemExecutionResult.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP version 7.4
|
||||||
|
*
|
||||||
|
* @category ItemExecutionResult
|
||||||
|
* @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 ItemExecutionResult
|
||||||
|
*
|
||||||
|
* @category ItemExecutionResult
|
||||||
|
* @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 ItemExecutionResult
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var int $productId
|
||||||
|
*
|
||||||
|
* @JMS\Type("int")
|
||||||
|
* @JMS\SerializedName("productId")
|
||||||
|
*/
|
||||||
|
public $productId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool $success
|
||||||
|
*
|
||||||
|
* @JMS\Type("bool")
|
||||||
|
* @JMS\SerializedName("success")
|
||||||
|
*/
|
||||||
|
public $success;
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP version 7.4
|
||||||
|
*
|
||||||
|
* @category SingleItemResponseDto
|
||||||
|
* @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 SingleItemResponseDto
|
||||||
|
*
|
||||||
|
* @category SingleItemResponseDto
|
||||||
|
* @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 SingleItemResponseDto
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var \RetailCrm\Model\Response\AliExpress\Result\ItemExecutionResult $itemExecutionResult
|
||||||
|
*
|
||||||
|
* @JMS\Type("RetailCrm\Model\Response\AliExpress\Result\ItemExecutionResult")
|
||||||
|
* @JMS\SerializedName("item_execution_result")
|
||||||
|
* @JMS\Groups(groups={"InlineJsonBody"})
|
||||||
|
*/
|
||||||
|
public $itemExecutionResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $itemContentId
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("item_content_id")
|
||||||
|
*/
|
||||||
|
public $itemContentId;
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP version 7.4
|
||||||
|
*
|
||||||
|
* @category SolutionFeedListGetResponse
|
||||||
|
* @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 SolutionFeedListGetResponse
|
||||||
|
*
|
||||||
|
* @category SolutionFeedListGetResponse
|
||||||
|
* @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 SolutionFeedListGetResponse extends BaseResponse
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var \RetailCrm\Model\Response\AliExpress\Data\SolutionFeedListGetResponseData $responseData
|
||||||
|
*
|
||||||
|
* @JMS\Type("RetailCrm\Model\Response\AliExpress\Data\SolutionFeedListGetResponseData")
|
||||||
|
* @JMS\SerializedName("aliexpress_solution_feed_list_get_response")
|
||||||
|
*/
|
||||||
|
public $responseData;
|
||||||
|
}
|
37
src/Model/Response/AliExpress/SolutionFeedQueryResponse.php
Normal file
37
src/Model/Response/AliExpress/SolutionFeedQueryResponse.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHP version 7.4
|
||||||
|
*
|
||||||
|
* @category SolutionFeedQueryResponse
|
||||||
|
* @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 SolutionFeedQueryResponse
|
||||||
|
*
|
||||||
|
* @category SolutionFeedQueryResponse
|
||||||
|
* @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 SolutionFeedQueryResponse extends BaseResponse
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var \RetailCrm\Model\Response\AliExpress\Data\SolutionFeedQueryResponseData $responseData
|
||||||
|
*
|
||||||
|
* @JMS\Type("RetailCrm\Model\Response\AliExpress\Data\SolutionFeedQueryResponseData")
|
||||||
|
* @JMS\SerializedName("aliexpress_solution_feed_query_response")
|
||||||
|
*/
|
||||||
|
public $responseData;
|
||||||
|
}
|
@ -17,6 +17,7 @@ use RetailCrm\Component\Constants;
|
|||||||
use RetailCrm\Component\Exception\NotImplementedException;
|
use RetailCrm\Component\Exception\NotImplementedException;
|
||||||
use RetailCrm\Interfaces\AppDataInterface;
|
use RetailCrm\Interfaces\AppDataInterface;
|
||||||
use RetailCrm\Interfaces\RequestSignerInterface;
|
use RetailCrm\Interfaces\RequestSignerInterface;
|
||||||
|
use RetailCrm\Model\Enum\AvailableSignMethods;
|
||||||
use RetailCrm\Model\Request\BaseRequest;
|
use RetailCrm\Model\Request\BaseRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,11 +70,11 @@ class RequestSigner implements RequestSignerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch ($request->signMethod) {
|
switch ($request->signMethod) {
|
||||||
case Constants::SIGN_TYPE_MD5:
|
case AvailableSignMethods::MD5:
|
||||||
$stringToBeSigned = $appData->getAppSecret() . $stringToBeSigned . $appData->getAppSecret();
|
$stringToBeSigned = $appData->getAppSecret() . $stringToBeSigned . $appData->getAppSecret();
|
||||||
$request->sign = strtoupper(md5($stringToBeSigned));
|
$request->sign = strtoupper(md5($stringToBeSigned));
|
||||||
break;
|
break;
|
||||||
case Constants::SIGN_TYPE_HMAC:
|
case AvailableSignMethods::HMAC_MD5:
|
||||||
$request->sign = strtoupper(hash_hmac('md5', $stringToBeSigned, $appData->getAppSecret()));
|
$request->sign = strtoupper(hash_hmac('md5', $stringToBeSigned, $appData->getAppSecret()));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -93,7 +93,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
|
|||||||
|
|
||||||
protected function getEnvTokenAuthenticator(): AuthenticatorInterface
|
protected function getEnvTokenAuthenticator(): AuthenticatorInterface
|
||||||
{
|
{
|
||||||
return $this->getTokenAuthenticator(self::getenv('SESSION', 'test'));
|
return $this->getTokenAuthenticator(self::getEnvToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -185,6 +185,14 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
|
|||||||
return self::getenv('APP_KEY', 'appKey');
|
return self::getenv('APP_KEY', 'appKey');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected static function getEnvToken(): string
|
||||||
|
{
|
||||||
|
return self::getenv('SESSION', 'test');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $variable
|
* @param string $variable
|
||||||
* @param mixed $default
|
* @param mixed $default
|
||||||
|
@ -15,6 +15,7 @@ namespace RetailCrm\Tests\Factory;
|
|||||||
use RetailCrm\Component\Constants;
|
use RetailCrm\Component\Constants;
|
||||||
use RetailCrm\Factory\TopRequestFactory;
|
use RetailCrm\Factory\TopRequestFactory;
|
||||||
use RetailCrm\Interfaces\TopRequestFactoryInterface;
|
use RetailCrm\Interfaces\TopRequestFactoryInterface;
|
||||||
|
use RetailCrm\Model\Enum\AvailableSignMethods;
|
||||||
use RetailCrm\Test\TestCase;
|
use RetailCrm\Test\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,7 +35,7 @@ class TopRequestFactoryTest extends TestCase
|
|||||||
/** @var TopRequestFactory $factory */
|
/** @var TopRequestFactory $factory */
|
||||||
$factory = $this->getContainer()->get(TopRequestFactoryInterface::class);
|
$factory = $this->getContainer()->get(TopRequestFactoryInterface::class);
|
||||||
$request = $factory->fromModel(
|
$request = $factory->fromModel(
|
||||||
$this->getTestRequest(Constants::SIGN_TYPE_HMAC),
|
$this->getTestRequest(AvailableSignMethods::HMAC_MD5),
|
||||||
$this->getAppData()
|
$this->getAppData()
|
||||||
);
|
);
|
||||||
$uri = $request->getUri();
|
$uri = $request->getUri();
|
||||||
@ -51,7 +52,7 @@ class TopRequestFactoryTest extends TestCase
|
|||||||
/** @var TopRequestFactory $factory */
|
/** @var TopRequestFactory $factory */
|
||||||
$factory = $this->getContainer()->get(TopRequestFactoryInterface::class);
|
$factory = $this->getContainer()->get(TopRequestFactoryInterface::class);
|
||||||
$request = $factory->fromModel(
|
$request = $factory->fromModel(
|
||||||
$this->getTestRequest(Constants::SIGN_TYPE_HMAC, true, true),
|
$this->getTestRequest(AvailableSignMethods::HMAC_MD5, true, true),
|
||||||
$this->getAppData()
|
$this->getAppData()
|
||||||
);
|
);
|
||||||
$uri = $request->getUri();
|
$uri = $request->getUri();
|
||||||
|
@ -16,6 +16,7 @@ use RetailCrm\Component\AppData;
|
|||||||
use RetailCrm\Component\Constants;
|
use RetailCrm\Component\Constants;
|
||||||
use RetailCrm\Interfaces\AppDataInterface;
|
use RetailCrm\Interfaces\AppDataInterface;
|
||||||
use RetailCrm\Interfaces\RequestSignerInterface;
|
use RetailCrm\Interfaces\RequestSignerInterface;
|
||||||
|
use RetailCrm\Model\Enum\AvailableSignMethods;
|
||||||
use RetailCrm\Test\TestCase;
|
use RetailCrm\Test\TestCase;
|
||||||
use RetailCrm\Test\TestSignerRequest;
|
use RetailCrm\Test\TestSignerRequest;
|
||||||
|
|
||||||
@ -53,22 +54,22 @@ class RequestSignerTest extends TestCase
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
$this->getTestRequest(Constants::SIGN_TYPE_MD5),
|
$this->getTestRequest(AvailableSignMethods::MD5),
|
||||||
$appData,
|
$appData,
|
||||||
'468BF7C95925C187D0DFD7D042072EB4'
|
'468BF7C95925C187D0DFD7D042072EB4'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
$this->getTestRequest(Constants::SIGN_TYPE_HMAC),
|
$this->getTestRequest(AvailableSignMethods::HMAC_MD5),
|
||||||
$appData,
|
$appData,
|
||||||
'5EF5C76D5C158BFFA9F35BAAA712A879'
|
'5EF5C76D5C158BFFA9F35BAAA712A879'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
$this->getTestRequest(Constants::SIGN_TYPE_MD5, true),
|
$this->getTestRequest(AvailableSignMethods::MD5, true),
|
||||||
$appData,
|
$appData,
|
||||||
'468BF7C95925C187D0DFD7D042072EB4'
|
'468BF7C95925C187D0DFD7D042072EB4'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
$this->getTestRequest(Constants::SIGN_TYPE_HMAC, true),
|
$this->getTestRequest(AvailableSignMethods::HMAC_MD5, true),
|
||||||
$appData,
|
$appData,
|
||||||
'5EF5C76D5C158BFFA9F35BAAA712A879'
|
'5EF5C76D5C158BFFA9F35BAAA712A879'
|
||||||
]
|
]
|
||||||
|
@ -17,9 +17,14 @@ use Psr\Http\Message\RequestInterface;
|
|||||||
use RetailCrm\Builder\ClientBuilder;
|
use RetailCrm\Builder\ClientBuilder;
|
||||||
use RetailCrm\Component\AppData;
|
use RetailCrm\Component\AppData;
|
||||||
use RetailCrm\Component\Constants;
|
use RetailCrm\Component\Constants;
|
||||||
|
use RetailCrm\Component\Exception\ValidationException;
|
||||||
use RetailCrm\Model\Entity\CategoryInfo;
|
use RetailCrm\Model\Entity\CategoryInfo;
|
||||||
|
use RetailCrm\Model\Enum\FeedOperationTypes;
|
||||||
|
use RetailCrm\Model\Enum\FeedStatuses;
|
||||||
use RetailCrm\Model\Request\AliExpress\Data\SingleItemRequestDto;
|
use RetailCrm\Model\Request\AliExpress\Data\SingleItemRequestDto;
|
||||||
use RetailCrm\Model\Request\AliExpress\PostproductRedefiningCategoryForecast;
|
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\SolutionFeedSubmit;
|
||||||
use RetailCrm\Model\Request\AliExpress\SolutionSellerCategoryTreeQuery;
|
use RetailCrm\Model\Request\AliExpress\SolutionSellerCategoryTreeQuery;
|
||||||
use RetailCrm\Model\Request\Taobao\HttpDnsGetRequest;
|
use RetailCrm\Model\Request\Taobao\HttpDnsGetRequest;
|
||||||
@ -27,6 +32,7 @@ use RetailCrm\Model\Response\AliExpress\Data\SolutionFeedSubmitResponseData;
|
|||||||
use RetailCrm\Model\Response\AliExpress\Data\SolutionSellerCategoryTreeQueryResponseData;
|
use RetailCrm\Model\Response\AliExpress\Data\SolutionSellerCategoryTreeQueryResponseData;
|
||||||
use RetailCrm\Model\Response\AliExpress\Data\SolutionSellerCategoryTreeQueryResponseDataChildrenCategoryList;
|
use RetailCrm\Model\Response\AliExpress\Data\SolutionSellerCategoryTreeQueryResponseDataChildrenCategoryList;
|
||||||
use RetailCrm\Model\Response\AliExpress\PostproductRedefiningCategoryForecastResponse;
|
use RetailCrm\Model\Response\AliExpress\PostproductRedefiningCategoryForecastResponse;
|
||||||
|
use RetailCrm\Model\Response\AliExpress\SolutionFeedListGetResponse;
|
||||||
use RetailCrm\Model\Response\AliExpress\SolutionFeedSubmitResponse;
|
use RetailCrm\Model\Response\AliExpress\SolutionFeedSubmitResponse;
|
||||||
use RetailCrm\Model\Response\AliExpress\SolutionSellerCategoryTreeQueryResponse;
|
use RetailCrm\Model\Response\AliExpress\SolutionSellerCategoryTreeQueryResponse;
|
||||||
use RetailCrm\Model\Response\ErrorResponseBody;
|
use RetailCrm\Model\Response\ErrorResponseBody;
|
||||||
@ -126,7 +132,8 @@ EOF;
|
|||||||
'app_key' => self::getEnvAppKey(),
|
'app_key' => self::getEnvAppKey(),
|
||||||
'method' => 'aliexpress.solution.seller.category.tree.query',
|
'method' => 'aliexpress.solution.seller.category.tree.query',
|
||||||
'category_id' => '5090300',
|
'category_id' => '5090300',
|
||||||
'filter_no_permission' => 1
|
'filter_no_permission' => 1,
|
||||||
|
'session' => self::getEnvToken()
|
||||||
]),
|
]),
|
||||||
$this->responseJson(200, $json)
|
$this->responseJson(200, $json)
|
||||||
);
|
);
|
||||||
@ -184,14 +191,14 @@ EOF;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF;
|
EOF;
|
||||||
|
|
||||||
$mock = self::getMockClient();
|
$mock = self::getMockClient();
|
||||||
$mock->on(
|
$mock->on(
|
||||||
RequestMatcher::createMatcher('api.taobao.com')
|
RequestMatcher::createMatcher('api.taobao.com')
|
||||||
->setPath('/router/rest')
|
->setPath('/router/rest')
|
||||||
->setOptionalQueryParams([
|
->setOptionalQueryParams([
|
||||||
'app_key' => self::getEnvAppKey(),
|
'app_key' => self::getEnvAppKey(),
|
||||||
'method' => 'aliexpress.postproduct.redefining.categoryforecast'
|
'method' => 'aliexpress.postproduct.redefining.categoryforecast',
|
||||||
|
'session' => self::getEnvToken()
|
||||||
]),
|
]),
|
||||||
$this->responseJson(200, $json)
|
$this->responseJson(200, $json)
|
||||||
);
|
);
|
||||||
@ -231,14 +238,14 @@ EOF;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF;
|
EOF;
|
||||||
|
|
||||||
$mock = self::getMockClient();
|
$mock = self::getMockClient();
|
||||||
$mock->on(
|
$mock->on(
|
||||||
RequestMatcher::createMatcher('api.taobao.com')
|
RequestMatcher::createMatcher('api.taobao.com')
|
||||||
->setPath('/router/rest')
|
->setPath('/router/rest')
|
||||||
->setOptionalQueryParams([
|
->setOptionalQueryParams([
|
||||||
'app_key' => self::getEnvAppKey(),
|
'app_key' => self::getEnvAppKey(),
|
||||||
'method' => 'aliexpress.solution.feed.submit'
|
'method' => 'aliexpress.solution.feed.submit',
|
||||||
|
'session' => self::getEnvToken()
|
||||||
]),
|
]),
|
||||||
$this->responseJson(200, $json)
|
$this->responseJson(200, $json)
|
||||||
);
|
);
|
||||||
@ -254,13 +261,121 @@ EOF;
|
|||||||
$dto->code = 'code';
|
$dto->code = 'code';
|
||||||
$item->itemContent = $dto;
|
$item->itemContent = $dto;
|
||||||
$item->itemContentId = 'A00000000Y1';
|
$item->itemContentId = 'A00000000Y1';
|
||||||
$request->operationType = SolutionFeedSubmit::PRODUCT_PRICES_UPDATE;
|
$request->operationType = FeedOperationTypes::PRODUCT_PRICES_UPDATE;
|
||||||
$request->itemList = [$item];
|
$request->itemList = [$item];
|
||||||
|
|
||||||
/** @var SolutionFeedSubmitResponse $response */
|
|
||||||
$response = $client->sendAuthenticatedRequest($request);
|
$response = $client->sendAuthenticatedRequest($request);
|
||||||
|
|
||||||
self::assertInstanceOf(SolutionFeedSubmitResponseData::class, $response->responseData);
|
self::assertInstanceOf(SolutionFeedSubmitResponseData::class, $response->responseData);
|
||||||
self::assertEquals(200000000060024475, $response->responseData->jobId);
|
self::assertEquals(200000000060024475, $response->responseData->jobId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testClientAliexpressSolutionFeedQuery()
|
||||||
|
{
|
||||||
|
$json = <<<'EOF'
|
||||||
|
{
|
||||||
|
"aliexpress_solution_feed_query_response":{
|
||||||
|
"job_id":200000000060054475,
|
||||||
|
"success_item_count":1,
|
||||||
|
"result_list":{
|
||||||
|
"single_item_response_dto":[
|
||||||
|
{
|
||||||
|
"item_execution_result":"{\"productId\":33030372006,\"success\":true}",
|
||||||
|
"item_content_id":"A00000000Y1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"total_item_count":1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF;
|
||||||
|
$mock = self::getMockClient();
|
||||||
|
$mock->on(
|
||||||
|
RequestMatcher::createMatcher('api.taobao.com')
|
||||||
|
->setPath('/router/rest')
|
||||||
|
->setOptionalQueryParams([
|
||||||
|
'app_key' => self::getEnvAppKey(),
|
||||||
|
'method' => 'aliexpress.solution.feed.query',
|
||||||
|
'session' => self::getEnvToken()
|
||||||
|
]),
|
||||||
|
$this->responseJson(200, $json)
|
||||||
|
);
|
||||||
|
$client = ClientBuilder::create()
|
||||||
|
->setContainer($this->getContainer($mock))
|
||||||
|
->setAppData($this->getEnvAppData())
|
||||||
|
->setAuthenticator($this->getEnvTokenAuthenticator())
|
||||||
|
->build();
|
||||||
|
$request = new SolutionFeedQuery();
|
||||||
|
$request->jobId = 200000000060054475;
|
||||||
|
|
||||||
|
/** @var \RetailCrm\Model\Response\AliExpress\SolutionFeedQueryResponse $response */
|
||||||
|
$response = $client->sendAuthenticatedRequest($request);
|
||||||
|
|
||||||
|
self::assertEquals(200000000060054475, $response->responseData->jobId);
|
||||||
|
self::assertEquals(1, $response->responseData->successItemCount);
|
||||||
|
self::assertNotNull($response->responseData->resultList);
|
||||||
|
self::assertNotNull($response->responseData->resultList->singleItemResponseDto);
|
||||||
|
self::assertCount(1, $response->responseData->resultList->singleItemResponseDto);
|
||||||
|
|
||||||
|
$item = $response->responseData->resultList->singleItemResponseDto[0];
|
||||||
|
|
||||||
|
self::assertEquals("A00000000Y1", $item->itemContentId);
|
||||||
|
self::assertNotNull($item->itemExecutionResult);
|
||||||
|
self::assertTrue($item->itemExecutionResult->success);
|
||||||
|
self::assertEquals(33030372006, $item->itemExecutionResult->productId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAliexpressSolutionFeedListGet()
|
||||||
|
{
|
||||||
|
$json = <<<'EOF'
|
||||||
|
{
|
||||||
|
"aliexpress_solution_feed_list_get_response":{
|
||||||
|
"current_page":3,
|
||||||
|
"job_list":{
|
||||||
|
"batch_operation_job_dto":[
|
||||||
|
{
|
||||||
|
"status":"PROCESSING",
|
||||||
|
"operation_type":"PRODUCT_CREATE",
|
||||||
|
"job_id":2000000000123456
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"page_size":20,
|
||||||
|
"total_count":300,
|
||||||
|
"total_page":15
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF;
|
||||||
|
$mock = self::getMockClient();
|
||||||
|
$mock->on(
|
||||||
|
RequestMatcher::createMatcher('api.taobao.com')
|
||||||
|
->setPath('/router/rest')
|
||||||
|
->setOptionalQueryParams([
|
||||||
|
'app_key' => self::getEnvAppKey(),
|
||||||
|
'method' => 'aliexpress.solution.feed.list.get',
|
||||||
|
'session' => self::getEnvToken()
|
||||||
|
]),
|
||||||
|
$this->responseJson(200, $json)
|
||||||
|
);
|
||||||
|
$client = ClientBuilder::create()
|
||||||
|
->setContainer($this->getContainer($mock))
|
||||||
|
->setAppData($this->getEnvAppData())
|
||||||
|
->setAuthenticator($this->getEnvTokenAuthenticator())
|
||||||
|
->build();
|
||||||
|
/** @var SolutionFeedListGetResponse $response */
|
||||||
|
$response = $client->sendAuthenticatedRequest(new SolutionFeedListGet());
|
||||||
|
|
||||||
|
self::assertEquals(3, $response->responseData->currentPage);
|
||||||
|
self::assertEquals(20, $response->responseData->pageSize);
|
||||||
|
self::assertEquals(300, $response->responseData->totalCount);
|
||||||
|
self::assertEquals(15, $response->responseData->totalPage);
|
||||||
|
self::assertNotNull($response->responseData->jobList);
|
||||||
|
self::assertCount(1, $response->responseData->jobList->batchOperationJobDto);
|
||||||
|
|
||||||
|
$item = $response->responseData->jobList->batchOperationJobDto[0];
|
||||||
|
|
||||||
|
self::assertEquals(FeedStatuses::PROCESSING, $item->status);
|
||||||
|
self::assertEquals(FeedOperationTypes::PRODUCT_CREATE, $item->operationType);
|
||||||
|
self::assertEquals(2000000000123456, $item->jobId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user