1
0
mirror of synced 2025-02-16 20:23:15 +03:00

aliexpress.solution.merchant.profile.get request

This commit is contained in:
Pavel 2020-10-07 10:43:19 +03:00
parent cd553ef64e
commit 08bfc5184b
4 changed files with 210 additions and 0 deletions

View File

@ -0,0 +1,45 @@
<?php
/**
* PHP version 7.3
*
* @category SolutionMerchantProfileGet
* @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\SolutionMerchantProfileGetResponse;
/**
* Class SolutionMerchantProfileGet
*
* @category SolutionMerchantProfileGet
* @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 SolutionMerchantProfileGet extends BaseRequest
{
/**
* @inheritDoc
*/
public function getMethod(): string
{
return 'aliexpress.solution.merchant.profile.get';
}
/**
* @inheritDoc
*/
public function getExpectedResponse(): string
{
return SolutionMerchantProfileGetResponse::class;
}
}

View File

@ -0,0 +1,84 @@
<?php
/**
* PHP version 7.3
*
* @category SolutionMerchantProfileGetResponseData
* @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 SolutionMerchantProfileGetResponseData
*
* @category SolutionMerchantProfileGetResponseData
* @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 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;
}

View File

@ -0,0 +1,37 @@
<?php
/**
* PHP version 7.3
*
* @category SolutionMerchantProfileGetResponse
* @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 SolutionMerchantProfileGetResponse
*
* @category SolutionMerchantProfileGetResponse
* @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 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;
}

View File

@ -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);
}
}