diff --git a/src/Model/Request/AliExpress/SolutionMerchantProfileGet.php b/src/Model/Request/AliExpress/SolutionMerchantProfileGet.php new file mode 100644 index 0000000..242e1ca --- /dev/null +++ b/src/Model/Request/AliExpress/SolutionMerchantProfileGet.php @@ -0,0 +1,45 @@ + + * @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\SolutionMerchantProfileGetResponse; + +/** + * Class SolutionMerchantProfileGet + * + * @category SolutionMerchantProfileGet + * @package RetailCrm\Model\Request\AliExpress + * @author RetailDriver LLC + * @license https://retailcrm.ru Proprietary + * @link http://retailcrm.ru + * @see https://help.retailcrm.ru + */ +class SolutionMerchantProfileGet extends BaseRequest +{ + /** + * @inheritDoc + */ + public function getMethod(): string + { + return 'aliexpress.solution.merchant.profile.get'; + } + + /** + * @inheritDoc + */ + public function getExpectedResponse(): string + { + return SolutionMerchantProfileGetResponse::class; + } +} diff --git a/src/Model/Response/AliExpress/Data/SolutionMerchantProfileGetResponseData.php b/src/Model/Response/AliExpress/Data/SolutionMerchantProfileGetResponseData.php new file mode 100644 index 0000000..6563a98 --- /dev/null +++ b/src/Model/Response/AliExpress/Data/SolutionMerchantProfileGetResponseData.php @@ -0,0 +1,84 @@ + + * @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 SolutionMerchantProfileGetResponseData + * + * @category SolutionMerchantProfileGetResponseData + * @package RetailCrm\Model\Response\AliExpress\Data + * @author RetailDriver LLC + * @license https://retailcrm.ru Proprietary + * @link http://retailcrm.ru + * @see https://help.retailcrm.ru + */ +class SolutionMerchantProfileGetResponseData +{ + /** + * @var string $countryCode + * + * @JMS\Type("string") + * @JMS\SerializedName("country_code") + */ + public $countryCode; + + /** + * @var bool $productPostingForbidden + * + * @JMS\Type("bool") + * @JMS\SerializedName("product_posting_forbidden") + */ + public $productPostingForbidden; + + /** + * @var string $merchantLoginId + * + * @JMS\Type("string") + * @JMS\SerializedName("merchant_login_id") + */ + public $merchantLoginId; + + /** + * @var int $shopId + * + * @JMS\Type("int") + * @JMS\SerializedName("shop_id") + */ + public $shopId; + + /** + * @var string $shopName + * + * @JMS\Type("string") + * @JMS\SerializedName("shop_name") + */ + public $shopName; + + /** + * @var string $shopType + * + * @JMS\Type("string") + * @JMS\SerializedName("shop_type") + */ + public $shopType; + + /** + * @var string $shopUrl + * + * @JMS\Type("string") + * @JMS\SerializedName("shop_url") + */ + public $shopUrl; +} diff --git a/src/Model/Response/AliExpress/SolutionMerchantProfileGetResponse.php b/src/Model/Response/AliExpress/SolutionMerchantProfileGetResponse.php new file mode 100644 index 0000000..6d240dc --- /dev/null +++ b/src/Model/Response/AliExpress/SolutionMerchantProfileGetResponse.php @@ -0,0 +1,37 @@ + + * @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 SolutionMerchantProfileGetResponse + * + * @category SolutionMerchantProfileGetResponse + * @package RetailCrm\Model\Response\AliExpress + * @author RetailDriver LLC + * @license https://retailcrm.ru Proprietary + * @link http://retailcrm.ru + * @see https://help.retailcrm.ru + */ +class SolutionMerchantProfileGetResponse extends BaseResponse +{ + /** + * @var \RetailCrm\Model\Response\AliExpress\Data\SolutionMerchantProfileGetResponseData $responseData + * + * @JMS\Type("RetailCrm\Model\Response\AliExpress\Data\SolutionMerchantProfileGetResponseData") + * @JMS\SerializedName("aliexpress_solution_merchant_profile_get_response") + */ + public $responseData; +} diff --git a/tests/RetailCrm/Tests/TopClient/ClientTest.php b/tests/RetailCrm/Tests/TopClient/ClientTest.php index c6c6ae1..e84a259 100644 --- a/tests/RetailCrm/Tests/TopClient/ClientTest.php +++ b/tests/RetailCrm/Tests/TopClient/ClientTest.php @@ -37,6 +37,7 @@ use RetailCrm\Model\Request\AliExpress\PostproductRedefiningFindAEProductByIdFor use RetailCrm\Model\Request\AliExpress\SolutionFeedListGet; use RetailCrm\Model\Request\AliExpress\SolutionFeedQuery; use RetailCrm\Model\Request\AliExpress\SolutionFeedSubmit; +use RetailCrm\Model\Request\AliExpress\SolutionMerchantProfileGet; use RetailCrm\Model\Request\AliExpress\SolutionOrderFulfill; use RetailCrm\Model\Request\AliExpress\SolutionOrderGet; use RetailCrm\Model\Request\AliExpress\SolutionOrderReceiptInfoGet; @@ -1061,4 +1062,47 @@ EOF; self::assertNotNull($responseQuery->responseData->resultList->singleItemResponseDto); self::assertCount(1, $responseQuery->responseData->resultList->singleItemResponseDto); } + + public function testAliexpressSolutionMerchantProfileGet() + { + $json = <<<'EOF' +{ + "aliexpress_solution_merchant_profile_get_response":{ + "country_code":"ES", + "product_posting_forbidden":false, + "merchant_login_id":"es1329072766xyzq", + "shop_id":1234321, + "shop_name":"test store", + "shop_type":"official", + "shop_url":"\/\/www.aliexpress.com\/store\/1234321" + } +} +EOF; + $mock = self::getMockClient(); + $mock->on( + RequestMatcher::createMatcher('api.taobao.com') + ->setPath('/router/rest') + ->setOptionalPostFields([ + 'app_key' => self::getEnvAppKey(), + 'method' => 'aliexpress.solution.merchant.profile.get', + '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\SolutionMerchantProfileGetResponse $response */ + $response = $client->sendAuthenticatedRequest(new SolutionMerchantProfileGet()); + + self::assertEquals('ES', $response->responseData->countryCode); + self::assertEquals(false, $response->responseData->productPostingForbidden); + self::assertEquals('es1329072766xyzq', $response->responseData->merchantLoginId); + self::assertEquals(1234321, $response->responseData->shopId); + self::assertEquals('test store', $response->responseData->shopName); + self::assertEquals('official', $response->responseData->shopType); + self::assertEquals('//www.aliexpress.com/store/1234321', $response->responseData->shopUrl); + } }