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

orders list request and response, timezone check, other changes

This commit is contained in:
Pavel 2020-10-05 18:11:20 +03:00
parent cc2cc6a2fd
commit 566320bfdc
30 changed files with 1727 additions and 10 deletions

View File

@ -0,0 +1,47 @@
<?php
/**
* PHP version 7.3
*
* @category ConstraintViolationListTransformer
* @package RetailCrm\Component
* @author RetailCRM <integration@retailcrm.ru>
* @license http://retailcrm.ru Proprietary
* @link http://retailcrm.ru
* @see http://help.retailcrm.ru
*/
namespace RetailCrm\Component;
use Symfony\Component\Validator\ConstraintViolationListInterface;
/**
* Class ConstraintViolationListTransformer
*
* @category ConstraintViolationListTransformer
* @package RetailCrm\Component
* @author RetailDriver LLC <integration@retailcrm.ru>
* @license https://retailcrm.ru Proprietary
* @link http://retailcrm.ru
* @see https://help.retailcrm.ru
*/
class ConstraintViolationListTransformer
{
/**
* Returns property names with their respective errors.
*
* @param \Symfony\Component\Validator\ConstraintViolationListInterface $violationList
*
* @return array
*/
public static function getViolationsArray(ConstraintViolationListInterface $violationList): array
{
$violations = [];
/** @var \Symfony\Component\Validator\ConstraintViolationInterface $violation */
foreach ($violationList as $violation) {
$violations[$violation->getPropertyPath()] = (string) $violation->getMessage();
}
return $violations;
}
}

View File

@ -0,0 +1,42 @@
<?php
/**
* PHP version 7.3
*
* @category Timezone
* @package RetailCrm\Component\Validator\Constraints
* @author RetailCRM <integration@retailcrm.ru>
* @license http://retailcrm.ru Proprietary
* @link http://retailcrm.ru
* @see http://help.retailcrm.ru
*/
namespace RetailCrm\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraint;
/**
* Class Timezone
*
* @category Timezone
* @package RetailCrm\Component\Validator\Constraints
* @author RetailDriver LLC <integration@retailcrm.ru>
* @license https://retailcrm.ru Proprietary
* @link http://retailcrm.ru
* @see https://help.retailcrm.ru
*
* @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*/
class Timezone extends Constraint
{
public $timezone = 'America/Los_Angeles';
public $message = 'Invalid timezone provided. Got {{ provided }}, should be {{ expected }}.';
/**
* {@inheritdoc}
*/
public function getDefaultOption(): string
{
return 'timezone';
}
}

View File

@ -0,0 +1,59 @@
<?php
/**
* PHP version 7.3
*
* @category TimezoneValidator
* @package RetailCrm\Component\Validator\Constraints
* @author RetailCRM <integration@retailcrm.ru>
* @license http://retailcrm.ru Proprietary
* @link http://retailcrm.ru
* @see http://help.retailcrm.ru
*/
namespace RetailCrm\Component\Validator\Constraints;
use DateTime;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Exception\UnexpectedValueException;
/**
* Class TimezoneValidator
*
* @category TimezoneValidator
* @package RetailCrm\Component\Validator\Constraints
* @author RetailDriver LLC <integration@retailcrm.ru>
* @license https://retailcrm.ru Proprietary
* @link http://retailcrm.ru
* @see https://help.retailcrm.ru
*/
class TimezoneValidator extends ConstraintValidator
{
/**
* @inheritDoc
*/
public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof Timezone) {
throw new UnexpectedTypeException($constraint, Timezone::class);
}
if (null === $value || '' === $value) {
return;
}
if (!($value instanceof DateTime)) {
throw new UnexpectedValueException($value, gettype($value));
}
if ($value->getTimezone()->getName() !== $constraint->timezone) {
$this->context->buildViolation($constraint->message)
->setParameters([
'{{ provided }}' => $value->getTimezone()->getName(),
'{{ expected }}' => $constraint->timezone
])
->addViolation();
}
}
}

View File

@ -148,11 +148,19 @@ class TopRequestFactory implements TopRequestFactoryInterface
// But in which format AliExpress TOP expects that? Should definitely check that.
$queryData = http_build_query($requestData);
return $this->requestFactory
->createRequest(
'GET',
$this->uriFactory->createUri($appData->getServiceUrl())->withQuery($queryData)
)->withHeader('Content-Type', 'application/x-www-form-urlencoded');
try {
return $this->requestFactory
->createRequest(
'GET',
$this->uriFactory->createUri($appData->getServiceUrl())->withQuery($queryData)
)->withHeader('Content-Type', 'application/x-www-form-urlencoded');
} catch (\Exception $exception) {
throw new FactoryException(
sprintf('Error building request: %s', $exception->getMessage()),
0,
$exception
);
}
}
/**

View File

@ -0,0 +1,286 @@
<?php
/**
* PHP version 7.3
*
* @category OrderDto
* @package RetailCrm\Model\Entity
* @author RetailCRM <integration@retailcrm.ru>
* @license http://retailcrm.ru Proprietary
* @link http://retailcrm.ru
* @see http://help.retailcrm.ru
*/
namespace RetailCrm\Model\Entity;
use DateTime;
use JMS\Serializer\Annotation as JMS;
/**
* Class OrderDto
*
* @category OrderDto
* @package RetailCrm\Model\Entity
* @author RetailDriver LLC <integration@retailcrm.ru>
* @license https://retailcrm.ru Proprietary
* @link http://retailcrm.ru
* @see https://help.retailcrm.ru
* @SuppressWarnings(PHPMD.TooManyFields)
*/
class OrderDto
{
/**
* @var int $timeoutLeftTime
*
* @JMS\Type("int")
* @JMS\SerializedName("timeout_left_time")
*/
public $timeoutLeftTime;
/**
* @var string $sellerSignerFullName
*
* @JMS\Type("string")
* @JMS\SerializedName("seller_signer_fullname")
*/
public $sellerSignerFullName;
/**
* @var string $sellerOperatorLoginId
*
* @JMS\Type("string")
* @JMS\SerializedName("seller_operator_login_id")
*/
public $sellerOperatorLoginId;
/**
* @var string $sellerLoginId
*
* @JMS\Type("string")
* @JMS\SerializedName("seller_login_id")
*/
public $sellerLoginId;
/**
* @var \RetailCrm\Model\Entity\OrderProductDtoList $productList
*
* @JMS\Type("RetailCrm\Model\Entity\OrderProductDtoList")
* @JMS\SerializedName("product_list")
*/
public $productList;
/**
* @var bool $phone
*
* @JMS\Type("bool")
* @JMS\SerializedName("phone")
*/
public $phone;
/**
* @var string $paymentType
*
* @JMS\Type("string")
* @JMS\SerializedName("payment_type")
*/
public $paymentType;
/**
* @var \RetailCrm\Model\Entity\SimpleMoney $payAmount
*
* @JMS\Type("RetailCrm\Model\Entity\SimpleMoney")
* @JMS\SerializedName("pay_amount")
*/
public $payAmount;
/**
* @var string $orderStatus
*
* @JMS\Type("string")
* @JMS\SerializedName("order_status")
*/
public $orderStatus;
/**
* @var int $orderId
*
* @JMS\Type("int")
* @JMS\SerializedName("order_id")
*/
public $orderId;
/**
* @var string $orderDetailUrl
*
* @JMS\Type("string")
* @JMS\SerializedName("order_detail_url")
*/
public $orderDetailUrl;
/**
* @var string $logisticsStatus
*
* @JMS\Type("string")
* @JMS\SerializedName("logistics_status")
*/
public $logisticsStatus;
/**
* @var string $logisticsEscrowFeeRate
*
* @JMS\Type("string")
* @JMS\SerializedName("logisitcs_escrow_fee_rate")
*/
public $logisticsEscrowFeeRate;
/**
* @var \RetailCrm\Model\Entity\SimpleMoney $loanAmount
*
* @JMS\Type("RetailCrm\Model\Entity\SimpleMoney")
* @JMS\SerializedName("loan_amount")
*/
public $loanAmount;
/**
* @var string $leftSendGoodsMin
*
* @JMS\Type("string")
* @JMS\SerializedName("left_send_good_min")
*/
public $leftSendGoodsMin;
/**
* @var string $leftSendGoodsHour
*
* @JMS\Type("string")
* @JMS\SerializedName("left_send_good_hour")
*/
public $leftSendGoodsHour;
/**
* @var string $leftSendGoodsDay
*
* @JMS\Type("string")
* @JMS\SerializedName("left_send_good_day")
*/
public $leftSendGoodsDay;
/**
* @var string $issueStatus
*
* @JMS\Type("string")
* @JMS\SerializedName("issue_status")
*/
public $issueStatus;
/**
* @var bool $hasRequestLoan
*
* @JMS\Type("bool")
* @JMS\SerializedName("has_request_loan")
*/
public $hasRequestLoan;
/**
* @var DateTime $gmtUpdate
*
* @JMS\Type("DateTime<'Y-m-d H:i:s'>")
* @JMS\SerializedName("gmt_update")
*/
public $gmtUpdate;
/**
* @var DateTime $gmtSendGoodsTime
*
* @JMS\Type("DateTime<'Y-m-d H:i:s'>")
* @JMS\SerializedName("gmt_send_goods_time")
*/
public $gmtSendGoodsTime;
/**
* @var DateTime $gmtPayTime
*
* @JMS\Type("DateTime<'Y-m-d H:i:s'>")
* @JMS\SerializedName("gmt_pay_time")
*/
public $gmtPayTime;
/**
* @var DateTime $gmtCreate
*
* @JMS\Type("DateTime<'Y-m-d H:i:s'>")
* @JMS\SerializedName("gmt_create")
*/
public $gmtCreate;
/**
* @var string $fundStatus
*
* @JMS\Type("string")
* @JMS\SerializedName("fund_status")
*/
public $fundStatus;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("frozen_status")
*/
public $frozenStatus;
/**
* @var int $escrowFeeRate
*
* @JMS\Type("int")
* @JMS\SerializedName("escrow_fee_rate")
*/
public $escrowFeeRate;
/**
* @var \RetailCrm\Model\Entity\SimpleMoney $escrowFee
*
* @JMS\Type("RetailCrm\Model\Entity\SimpleMoney")
* @JMS\SerializedName("escrow_fee")
*/
public $escrowFee;
/**
* @var string $endReason
*
* @JMS\Type("string")
* @JMS\SerializedName("end_reason")
*/
public $endReason;
/**
* @var string $buyerSignerFullName
*
* @JMS\Type("string")
* @JMS\SerializedName("buyer_signer_fullname")
*/
public $buyerSignerFullName;
/**
* @var string $buyerLoginId
*
* @JMS\Type("string")
* @JMS\SerializedName("buyer_login_id")
*/
public $buyerLoginId;
/**
* @var string $bizType
*
* @JMS\Type("string")
* @JMS\SerializedName("biz_type")
*/
public $bizType;
/**
* @var string $offlinePickupType
*
* @JMS\Type("string")
* @JMS\SerializedName("offline_pickup_type")
*/
public $offlinePickupType;
}

View File

@ -0,0 +1,286 @@
<?php
/**
* PHP version 7.3
*
* @category OrderProductDto
* @package RetailCrm\Model\Entity
* @author RetailCRM <integration@retailcrm.ru>
* @license http://retailcrm.ru Proprietary
* @link http://retailcrm.ru
* @see http://help.retailcrm.ru
*/
namespace RetailCrm\Model\Entity;
use DateTime;
use JMS\Serializer\Annotation as JMS;
/**
* Class OrderProductDto
*
* @category OrderProductDto
* @package RetailCrm\Model\Entity
* @author RetailDriver LLC <integration@retailcrm.ru>
* @license https://retailcrm.ru Proprietary
* @link http://retailcrm.ru
* @see https://help.retailcrm.ru
* @SuppressWarnings(PHPMD.TooManyFields)
*/
class OrderProductDto
{
/**
* @var \RetailCrm\Model\Entity\SimpleMoney $totalProductAmount
*
* @JMS\Type("RetailCrm\Model\Entity\SimpleMoney")
* @JMS\SerializedName("total_product_amount")
*/
public $totalProductAmount;
/**
* @var string $sonOrderStatus
*
* @JMS\Type("string")
* @JMS\SerializedName("son_order_status")
*/
public $sonOrderStatus;
/**
* @var string $skuCode
*
* @JMS\Type("string")
* @JMS\SerializedName("sku_code")
*/
public $skuCode;
/**
* @var string $showStatus
*
* @JMS\Type("string")
* @JMS\SerializedName("show_status")
*/
public $showStatus;
/**
* @var DateTime $sendGoodsTime
*
* @JMS\Type("DateTime<'Y-m-d H:i:s'>")
* @JMS\SerializedName("send_goods_time")
*/
public $sendGoodsTime;
/**
* @var string $sendGoodsOperator
*
* @JMS\Type("string")
* @JMS\SerializedName("send_goods_operator")
*/
public $sendGoodsOperator;
/**
* @var \RetailCrm\Model\Entity\SimpleMoney $productUnitPrice
*
* @JMS\Type("RetailCrm\Model\Entity\SimpleMoney")
* @JMS\SerializedName("product_unit_price")
*/
public $productUnitPrice;
/**
* @var string $productUnit
*
* @JMS\Type("string")
* @JMS\SerializedName("product_unit")
*/
public $productUnit;
/**
* @var string $productStandard
*
* @JMS\Type("string")
* @JMS\SerializedName("product_standard")
*/
public $productStandard;
/**
* @var string $productSnapUrl
*
* @JMS\Type("string")
* @JMS\SerializedName("product_snap_url")
*/
public $productSnapUrl;
/**
* @var string $productName
*
* @JMS\Type("string")
* @JMS\SerializedName("product_name")
*/
public $productName;
/**
* @var string $productImgUrl
*
* @JMS\Type("string")
* @JMS\SerializedName("product_img_url")
*/
public $productImgUrl;
/**
* @var int $productId
*
* @JMS\Type("int")
* @JMS\SerializedName("product_id")
*/
public $productId;
/**
* @var int $productCount
*
* @JMS\Type("int")
* @JMS\SerializedName("product_count")
*/
public $productCount;
/**
* @var int $orderId
*
* @JMS\Type("int")
* @JMS\SerializedName("order_id")
*/
public $orderId;
/**
* @var bool $moneyBack3x
*
* @JMS\Type("bool")
* @JMS\SerializedName("money_back3x")
*/
public $moneyBack3x;
/**
* @var string $memo
*
* @JMS\Type("string")
* @JMS\SerializedName("memo")
*/
public $memo;
/**
* @var string $logisticsType
*
* @JMS\Type("string")
* @JMS\SerializedName("logistics_type")
*/
public $logisticsType;
/**
* @var string $logisticsServiceName
*
* @JMS\Type("string")
* @JMS\SerializedName("logistics_service_name")
*/
public $logisticsServiceName;
/**
* @var \RetailCrm\Model\Entity\SimpleMoney $logisticsAmount
*
* @JMS\Type("RetailCrm\Model\Entity\SimpleMoney")
* @JMS\SerializedName("logistics_amount")
*/
public $logisticsAmount;
/**
* @var string $issueStatus
*
* @JMS\Type("string")
* @JMS\SerializedName("issue_status")
*/
public $issueStatus;
/**
* @var string $issueMode
*
* @JMS\Type("string")
* @JMS\SerializedName("issue_mode")
*/
public $issueMode;
/**
* @var int $goodsPrepareTime
*
* @JMS\Type("int")
* @JMS\SerializedName("goods_prepare_time")
*/
public $goodsPrepareTime;
/**
* @var string $fundStatus
*
* @JMS\Type("string")
* @JMS\SerializedName("fund_status")
*/
public $fundStatus;
/**
* @var string $freightCommitDay
*
* @JMS\Type("string")
* @JMS\SerializedName("freight_commit_day")
*/
public $freightCommitDay;
/**
* @var string $escrowFeeRate
*
* @JMS\Type("string")
* @JMS\SerializedName("escrow_fee_rate")
*/
public $escrowFeeRate;
/**
* @var string $deliveryTime
*
* @JMS\Type("string")
* @JMS\SerializedName("delivery_time")
*/
public $deliveryTime;
/**
* @var int $childId
*
* @JMS\Type("int")
* @JMS\SerializedName("child_id")
*/
public $childId;
/**
* @var bool $canSubmitIssue
*
* @JMS\Type("bool")
* @JMS\SerializedName("can_submit_issue")
*/
public $canSubmitIssue;
/**
* @var string $buyerSignerLastName
*
* @JMS\Type("string")
* @JMS\SerializedName("buyer_signer_last_name")
*/
public $buyerSignerLastName;
/**
* @var string $buyerSignerFirstName
*
* @JMS\Type("string")
* @JMS\SerializedName("buyer_signer_first_name")
*/
public $buyerSignerFirstName;
/**
* @var string $affilateRateFee
*
* @JMS\Type("string")
* @JMS\SerializedName("afflicate_fee_rate")
*/
public $afficateRateFee;
}

View File

@ -0,0 +1,36 @@
<?php
/**
* PHP version 7.3
*
* @category OrderProductDtoList
* @package RetailCrm\Model\Entity
* @author RetailCRM <integration@retailcrm.ru>
* @license http://retailcrm.ru Proprietary
* @link http://retailcrm.ru
* @see http://help.retailcrm.ru
*/
namespace RetailCrm\Model\Entity;
use JMS\Serializer\Annotation as JMS;
/**
* Class OrderProductDtoList
*
* @category OrderProductDtoList
* @package RetailCrm\Model\Entity
* @author RetailDriver LLC <integration@retailcrm.ru>
* @license https://retailcrm.ru Proprietary
* @link http://retailcrm.ru
* @see https://help.retailcrm.ru
*/
class OrderProductDtoList
{
/**
* @var \RetailCrm\Model\Entity\OrderProductDto[] $orderProductDto
*
* @JMS\Type("array<RetailCrm\Model\Entity\OrderProductDto>")
* @JMS\SerializedName("order_product_dto")
*/
public $orderProductDto;
}

View File

@ -0,0 +1,44 @@
<?php
/**
* PHP version 7.3
*
* @category SimpleMoney
* @package RetailCrm\Model\Entity
* @author RetailCRM <integration@retailcrm.ru>
* @license http://retailcrm.ru Proprietary
* @link http://retailcrm.ru
* @see http://help.retailcrm.ru
*/
namespace RetailCrm\Model\Entity;
use JMS\Serializer\Annotation as JMS;
/**
* Class SimpleMoney
*
* @category SimpleMoney
* @package RetailCrm\Model\Entity
* @author RetailDriver LLC <integration@retailcrm.ru>
* @license https://retailcrm.ru Proprietary
* @link http://retailcrm.ru
* @see https://help.retailcrm.ru
*/
class SimpleMoney
{
/**
* @var string $currencyCode
*
* @JMS\Type("string")
* @JMS\SerializedName("currency_code")
*/
public $currencyCode;
/**
* @var string $amount
*
* @JMS\Type("string")
* @JMS\SerializedName("amount")
*/
public $amount;
}

View File

@ -0,0 +1,42 @@
<?php
/**
* PHP version 7.3
*
* @category BizTypes
* @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 BizTypes
*
* @category BizTypes
* @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 BizTypes
{
// Common type
public const AE_COMMON = 'AE_COMMON';
// Trial type
public const AE_TRIAL = 'AE_TRIAL';
// Recharge type
public const AE_RECHARGE = 'AE_RECHARGE';
// All types
public const ALL_TYPES = [
self::AE_COMMON,
self::AE_TRIAL,
self::AE_RECHARGE
];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* PHP version 7.3
*
* @category FrozenStatuses
* @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 FrozenStatuses
*
* @category FrozenStatuses
* @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 FrozenStatuses
{
public const NO_FROZEN = 'NO_FROZEN';
public const IN_FROZEN = 'IN_FROZEN';
public const FROZEN_STATUSES = [self::NO_FROZEN, self::IN_FROZEN];
}

View File

@ -0,0 +1,31 @@
<?php
/**
* PHP version 7.3
*
* @category FundsStatuses
* @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 FundsStatuses
*
* @category FundsStatuses
* @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 FundsStatuses
{
public const NOT_PAY = 'NOT_PAY';
public const PAY_SUCCESS = 'PAY_SUCCESS';
public const WAIT_SELLER_CHECK = 'WAIT_SELLER_CHECK';
public const FUNDS_STATUSES = [self::NOT_PAY, self::PAY_SUCCESS, self::WAIT_SELLER_CHECK];
}

View File

@ -0,0 +1,30 @@
<?php
/**
* PHP version 7.3
*
* @category IssueStatuses
* @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 IssueStatuses
*
* @category IssueStatuses
* @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 IssueStatuses
{
public const NO_ISSUE = 'NO_ISSUE';
public const IN_ISSUE = 'IN_ISSUE';
public const END_ISSUE = 'END_ISSUE';
}

View File

@ -0,0 +1,50 @@
<?php
/**
* PHP version 7.3
*
* @category LogisticsStatuses
* @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 LogisticsStatuses
*
* @category LogisticsStatuses
* @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 LogisticsStatuses
{
// Waiting for seller to ship
public const WAIT_SELLER_SEND_GOODS = 'WAIT_SELLER_SEND_GOODS';
// Partial delivery by seller
public const SELLER_SEND_PART_GOODS = 'SELLER_SEND_PART_GOODS';
// Seller sent goods.
public const SELLER_SEND_GOODS = 'SELLER_SEND_GOODS';
// Buyer has confirmed receipt
public const BUYER_ACCEPT_GOODS = 'BUYER_ACCEPT_GOODS';
// No logistics transfer
public const NO_LOGISTICS = 'NO_LOGISTICS';
// All logistics statuses
public const LOGISTICS_STATUSES = [
self::WAIT_SELLER_SEND_GOODS,
self::SELLER_SEND_PART_GOODS,
self::SELLER_SEND_GOODS,
self::BUYER_ACCEPT_GOODS,
self::NO_LOGISTICS
];
}

View File

@ -0,0 +1,29 @@
<?php
/**
* PHP version 7.3
*
* @category OfflinePickupTypes
* @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 OfflinePickupTypes
*
* @category OfflinePickupTypes
* @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 OfflinePickupTypes
{
public const RU_OFFLINE_SELF_PICK_UP_EXPRESSION = 'RU_OFFLINE_SELF_PICK_UP_EXPRESSION';
public const OFFLINE_PICKUP_TYPES = [self::RU_OFFLINE_SELF_PICK_UP_EXPRESSION];
}

View File

@ -0,0 +1,74 @@
<?php
/**
* PHP version 7.3
*
* @category OrderStatuses
* @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 OrderStatuses
*
* @category OrderStatuses
* @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 OrderStatuses
{
// Waiting for payment from buyer.
public const PLACE_ORDER_SUCCESS = 'PLACE_ORDER_SUCCESS';
// Buyer requested cancellation.
public const IN_CANCEL = 'IN_CANCEL';
// Waiting for shipment from seller.
public const WAIT_SELLER_SEND_GOODS = 'WAIT_SELLER_SEND_GOODS';
// Partial delivery.
public const SELLER_PART_SEND_GOODS = 'SELLER_PART_SEND_GOODS';
// Waiting for buyer to receive goods.
public const WAIT_BUYER_ACCEPT_GOODS = 'WAIT_BUYER_ACCEPT_GOODS';
// Buyer accepted, funds is in processing.
public const FUND_PROCESSING = 'FUND_PROCESSING';
// Order is involved in the dispute.
public const IN_ISSUE = 'IN_ISSUE';
// Order is frozen.
public const IN_FROZEN = 'IN_FROZEN';
// Waiting for payment amount confirmation from seller.
public const WAIT_SELLER_EXAMINE_MONEY = 'WAIT_SELLER_EXAMINE_MONEY';
// Payment will be marked as completed in 24 hours.
public const RISK_CONTROL = 'RISK_CONTROL';
// Order is closed, no further actions needed.
public const FINISH = 'FINISH';
// List of all order statuses.
public const STATUSES_LIST = [
self::PLACE_ORDER_SUCCESS,
self::IN_CANCEL,
self::WAIT_SELLER_SEND_GOODS,
self::SELLER_PART_SEND_GOODS,
self::WAIT_BUYER_ACCEPT_GOODS,
self::FUND_PROCESSING,
self::IN_ISSUE,
self::IN_FROZEN,
self::WAIT_SELLER_EXAMINE_MONEY,
self::RISK_CONTROL,
self::FINISH
];
}

View File

@ -0,0 +1,32 @@
<?php
/**
* PHP version 7.3
*
* @category ShippingTypes
* @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 ShippingTypes
*
* @category ShippingTypes
* @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 ShippingTypes
{
// Seller's shipping.
public const SELLER_SEND_GOODS = 'SELLER_SEND_GOODS';
// Warehouse delivery.
public const WAREHOUSE_SEND_GOODS = 'WAREHOUSE_SEND_GOODS';
}

View File

@ -0,0 +1,115 @@
<?php
/**
* PHP version 7.3
*
* @category OrderQuery
* @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 DateTime;
use JMS\Serializer\Annotation as JMS;
use Symfony\Component\Validator\Constraints as Assert;
use RetailCrm\Component\Validator\Constraints as TopAssert;
/**
* Class OrderQuery
*
* @category OrderQuery
* @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 OrderQuery
{
/**
* US pacific time
*
* @var DateTime $createDateEnd
*
* @JMS\Type("DateTime<'Y-m-d H:i:s'>")
* @JMS\SerializedName("create_date_end")
* @TopAssert\Timezone("America/Los_Angeles")
*/
public $createDateEnd;
/**
* @var DateTime $createDateStart
*
* @JMS\Type("DateTime<'Y-m-d H:i:s'>")
* @JMS\SerializedName("create_date_start")
* @TopAssert\Timezone("America/Los_Angeles")
*/
public $createDateStart;
/**
* @var DateTime $modifiedDateStart
*
* @JMS\Type("DateTime<'Y-m-d H:i:s'>")
* @JMS\SerializedName("modified_date_start")
* @TopAssert\Timezone("America/Los_Angeles")
*/
public $modifiedDateStart;
/**
* @var string[] $orderStatusList
*
* @JMS\Type("array<string>")
* @JMS\SerializedName("order_status_list")
* @Assert\Choice(choices=RetailCrm\Model\Enum\OrderStatuses::STATUSES_LIST, multiple=true)
*/
public $orderStatusList;
/**
* @var string $buyerLoginId
*
* @JMS\Type("string")
* @JMS\SerializedName("buyer_login_id")
*/
public $buyerLoginId;
/**
* @var int $pageSize
*
* @JMS\Type("int")
* @JMS\SerializedName("page_size")
* @Assert\NotBlank()
* @Assert\GreaterThan(0)
*/
public $pageSize;
/**
* @var DateTime $modifiedDateEnd
*
* @JMS\Type("DateTime<'Y-m-d H:i:s'>")
* @JMS\SerializedName("modified_date_end")
* @TopAssert\Timezone("America/Los_Angeles")
*/
public $modifiedDateEnd;
/**
* @var int $currentPage
*
* @JMS\Type("int")
* @JMS\SerializedName("current_page")
* @Assert\NotBlank()
* @Assert\GreaterThan(0)
*/
public $currentPage;
/**
* @var string $orderStatus
*
* @JMS\Type("string")
* @JMS\SerializedName("order_status")
* @Assert\Choice(choices=RetailCrm\Model\Enum\OrderStatuses::STATUSES_LIST)
*/
public $orderStatus;
}

View File

@ -27,6 +27,9 @@ use JMS\Serializer\Annotation as JMS;
class SingleItemRequestDto
{
/**
* Any value here will be serialized to JSON before serializing entire model.
* Only array and RequestDtoInterface are viable here.
*
* @var \RetailCrm\Interfaces\RequestDtoInterface $itemContent
*
* @JMS\Type("RetailCrm\Interfaces\RequestDtoInterface")

View File

@ -0,0 +1,58 @@
<?php
/**
* PHP version 7.3
*
* @category SolutionOrderGet
* @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\SolutionOrderGetResponse;
/**
* Class SolutionOrderGet
*
* @category SolutionOrderGet
* @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 SolutionOrderGet extends BaseRequest
{
/**
* Contains request params. This weird naming has been borrowed from developer docs.
* @see https://developers.aliexpress.com/en/doc.htm?docId=42270&docType=2
*
* @var \RetailCrm\Model\Request\AliExpress\Data\OrderQuery $param0
*
* @JMS\Type("RetailCrm\Model\Request\AliExpress\Data\OrderQuery")
* @JMS\SerializedName("param0")
* @todo Should be marshaled to JSON before building request? Check that.
*/
public $param0;
/**
* @inheritDoc
*/
public function getMethod(): string
{
return 'aliexpress.solution.order.get';
}
/**
* @inheritDoc
*/
public function getExpectedResponse(): string
{
return SolutionOrderGetResponse::class;
}
}

View File

@ -17,6 +17,7 @@ use RetailCrm\Component\Constants;
use RetailCrm\Model\Enum\AvailableResponseFormats;
use RetailCrm\Model\Enum\AvailableSignMethods;
use Symfony\Component\Validator\Constraints as Assert;
use RetailCrm\Component\Validator\Constraints as TopAssert;
/**
* Class BaseRequest
@ -65,6 +66,7 @@ abstract class BaseRequest
* @JMS\Type("DateTime<'Y-m-d H:i:s'>")
* @JMS\SerializedName("timestamp")
* @Assert\NotBlank()
* @TopAssert\Timezone("Asia/Shanghai")
*/
public $timestamp;

View File

@ -0,0 +1,36 @@
<?php
/**
* PHP version 7.3
*
* @category SolutionOrderGetResponseData
* @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 SolutionOrderGetResponseData
*
* @category SolutionOrderGetResponseData
* @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 SolutionOrderGetResponseData
{
/**
* @var \RetailCrm\Model\Response\AliExpress\Result\SolutionOrderGetResponseResult $result
*
* @JMS\Type("RetailCrm\Model\Response\AliExpress\Result\SolutionOrderGetResponseResult")
* @JMS\SerializedName("result")
*/
public $result;
}

View File

@ -13,6 +13,7 @@
namespace RetailCrm\Model\Response\AliExpress\Result;
use JMS\Serializer\Annotation as JMS;
use RetailCrm\Model\Response\AliExpress\Result\Interfaces\ErrorInterface;
use RetailCrm\Model\Response\AliExpress\Result\Traits\ErrorTrait;
use RetailCrm\Model\Response\AliExpress\Result\Traits\SuccessTrait;
@ -26,7 +27,7 @@ use RetailCrm\Model\Response\AliExpress\Result\Traits\SuccessTrait;
* @link http://retailcrm.ru
* @see https://help.retailcrm.ru
*/
class AeopCategoryForecastResultDto
class AeopCategoryForecastResultDto implements ErrorInterface
{
use ErrorTrait;
use SuccessTrait;

View File

@ -0,0 +1,36 @@
<?php
/**
* PHP version 7.3
*
* @category OrderDtoList
* @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 OrderDtoList
*
* @category OrderDtoList
* @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 OrderDtoList
{
/**
* @var \RetailCrm\Model\Entity\OrderDto[] $orderDto
*
* @JMS\Type("array<RetailCrm\Model\Entity\OrderDto>")
* @JMS\SerializedName("order_dto")
*/
public $orderDto;
}

View File

@ -0,0 +1,36 @@
<?php
/**
* PHP version 7.3
*
* @category ErrorInterface
* @package RetailCrm\Model\Response\AliExpress\Result\Interfaces
* @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\Interfaces;
/**
* Interface ErrorInterface. Should be used with ErrorTrait.
*
* @category ErrorInterface
* @package RetailCrm\Model\Response\AliExpress\Result\Interfaces
* @author RetailDriver LLC <integration@retailcrm.ru>
* @license MIT https://mit-license.org
* @link http://retailcrm.ru
* @see https://help.retailcrm.ru
*/
interface ErrorInterface
{
/**
* @return ?string
*/
public function getErrorCode(): ?string;
/**
* @return ?string
*/
public function getErrorMessage(): ?string;
}

View File

@ -0,0 +1,82 @@
<?php
/**
* PHP version 7.3
*
* @category SolutionOrderGetResponseResult
* @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 RetailCrm\Model\Response\AliExpress\Result\Interfaces\ErrorInterface;
use RetailCrm\Model\Response\AliExpress\Result\Traits\ErrorTrait;
use JMS\Serializer\Annotation as JMS;
use RetailCrm\Model\Response\AliExpress\Result\Traits\SuccessTrait;
/**
* Class SolutionOrderGetResponseResult
*
* @category SolutionOrderGetResponseResult
* @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 SolutionOrderGetResponseResult implements ErrorInterface
{
use ErrorTrait;
use SuccessTrait;
/**
* @var int $totalCount
*
* @JMS\Type("int")
* @JMS\SerializedName("total_count")
*/
public $totalCount;
/**
* @var \RetailCrm\Model\Response\AliExpress\Result\Entity\OrderDtoList $targetList
*
* @JMS\Type("RetailCrm\Model\Response\AliExpress\Result\Entity\OrderDtoList")
* @JMS\SerializedName("target_list")
*/
public $targetList;
/**
* @var int $pageSize
*
* @JMS\Type("int")
* @JMS\SerializedName("page_size")
*/
public $pageSize;
/**
* @var int $currentPage
*
* @JMS\Type("int")
* @JMS\SerializedName("current_page")
*/
public $currentPage;
/**
* @var int $totalPage
*
* @JMS\Type("int")
* @JMS\SerializedName("total_page")
*/
public $totalPage;
/**
* @var string $timestamp
*
* @JMS\Type("string")
* @JMS\SerializedName("time_stamp")
*/
public $timeStamp;
}

View File

@ -13,6 +13,7 @@
namespace RetailCrm\Model\Response\AliExpress\Result;
use JMS\Serializer\Annotation as JMS;
use RetailCrm\Model\Response\AliExpress\Result\Interfaces\ErrorInterface;
use RetailCrm\Model\Response\AliExpress\Result\Traits\ErrorTrait;
use RetailCrm\Model\Response\AliExpress\Result\Traits\SuccessTrait;
@ -26,7 +27,7 @@ use RetailCrm\Model\Response\AliExpress\Result\Traits\SuccessTrait;
* @link http://retailcrm.ru
* @see https://help.retailcrm.ru
*/
class SolutionProductSchemaGetResponseResult
class SolutionProductSchemaGetResponseResult implements ErrorInterface
{
use ErrorTrait;
use SuccessTrait;

View File

@ -41,4 +41,24 @@ trait ErrorTrait
* @JMS\SerializedName("error_message")
*/
public $errorMessage;
/**
* ErrorInterface implementation.
*
* @return ?string
*/
public function getErrorCode(): ?string
{
return $this->errorCode;
}
/**
* ErrorInterface implementation.
*
* @return ?string
*/
public function getErrorMessage(): ?string
{
return $this->errorMessage;
}
}

View File

@ -0,0 +1,37 @@
<?php
/**
* PHP version 7.3
*
* @category SolutionOrderGetResponse
* @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 SolutionOrderGetResponse
*
* @category SolutionOrderGetResponse
* @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 SolutionOrderGetResponse extends BaseResponse
{
/**
* @var \RetailCrm\Model\Response\AliExpress\Data\SolutionOrderGetResponseData $responseData
*
* @JMS\Type("RetailCrm\Model\Response\AliExpress\Data\SolutionOrderGetResponseData")
* @JMS\SerializedName("aliexpress_solution_order_get_response")
*/
public $responseData;
}

View File

@ -211,7 +211,19 @@ class TopClient implements TopClientInterface
}
/**
* Send TOP request
* Send TOP request. Can throw several exceptions:
* - ValidationException - when request didn't pass validation.
* - FactoryException - when PSR-7 request cannot be built.
* - TopClientException - when PSR-7 request cannot be processed by client, or xml mode is used
* (always use JSON mode, it's already chosen in the BaseRequest model). Previous error will contain HTTP
* client processing error (if it's present).
* - TopApiException - when request is not processed and API returned error. Note: this exception is only thrown
* when request cannot be processed by API at all (for example, if signature is invalid). It will not be thrown
* if request was processed, but API returned error in the response result. In that case you can use error fields
* from the response result itself; those results implement ErrorInterface via ErrorTrait.
* However, some result classes may contain different format for error data. Those result classes won't implement
* ErrorInterface - you can use `instanceof` to differentiate such results from the others. This inconsistency
* is brought by the API design itself, and cannot be easily removed.
*
* @param \RetailCrm\Model\Request\BaseRequest $request
*
@ -256,7 +268,7 @@ class TopClient implements TopClientInterface
}
/**
* Send authenticated TOP request
* Send authenticated TOP request. Authenticator should be present in order to use this method.
*
* @param \RetailCrm\Model\Request\BaseRequest $request
*

View File

@ -15,14 +15,20 @@ namespace RetailCrm\Tests\TopClient;
use Http\Message\RequestMatcher\CallbackRequestMatcher;
use Psr\Http\Message\RequestInterface;
use RetailCrm\Builder\TopClientBuilder;
use RetailCrm\Component\ConstraintViolationListTransformer;
use RetailCrm\Component\Exception\ValidationException;
use RetailCrm\Model\Entity\CategoryInfo;
use RetailCrm\Model\Enum\FeedOperationTypes;
use RetailCrm\Model\Enum\FeedStatuses;
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\PostproductRedefiningCategoryForecast;
use RetailCrm\Model\Request\AliExpress\SolutionFeedListGet;
use RetailCrm\Model\Request\AliExpress\SolutionFeedQuery;
use RetailCrm\Model\Request\AliExpress\SolutionFeedSubmit;
use RetailCrm\Model\Request\AliExpress\SolutionOrderGet;
use RetailCrm\Model\Request\AliExpress\SolutionProductSchemaGet;
use RetailCrm\Model\Request\AliExpress\SolutionSellerCategoryTreeQuery;
use RetailCrm\Model\Request\Taobao\HttpDnsGetRequest;
@ -459,9 +465,155 @@ EOF;
$request = new SolutionProductSchemaGet();
$request->aliexpressCategoryId = 1;
/** @var SolutionProductSchemaGetResponse $response */
$response = $client->sendAuthenticatedRequest($request);
self::assertEquals('{}', $response->responseData->result->schema);
}
public function testAliexpressSolutionOrderGet()
{
$json = <<<'EOF'
{
"aliexpress_solution_order_get_response":{
"result":{
"error_message":"1",
"total_count":1,
"target_list":{
"order_dto":[
{
"timeout_left_time":120340569,
"seller_signer_fullname":"cn1234",
"seller_operator_login_id":"cn1234",
"seller_login_id":"cn1234",
"product_list":{
"order_product_dto":[
{
"total_product_amount":{
"currency_code":"USD",
"amount":"1.01"
},
"son_order_status":"PLACE_ORDER_SUCCESS",
"sku_code":"12",
"show_status":"PLACE_ORDER_SUCCESS",
"send_goods_time":"2017-10-12 12:12:12",
"send_goods_operator":"WAREHOUSE_SEND_GOODS",
"product_unit_price":{
"currency_code":"USD",
"amount":"1.01"
},
"product_unit":"piece",
"product_standard":"",
"product_snap_url":"http:\/\/www.aliexpress.com:1080\/snapshot\/null.html?orderId\\u003d1160045860056286",
"product_name":"mobile",
"product_img_url":"http:\/\/g03.a.alicdn.com\/kf\/images\/eng\/no_photo.gif",
"product_id":2356980,
"product_count":1,
"order_id":222222,
"money_back3x":false,
"memo":"1",
"logistics_type":"EMS",
"logistics_service_name":"EMS",
"logistics_amount":{
"currency_code":"USD",
"amount":"1.01"
},
"issue_status":"END_ISSUE",
"issue_mode":"w",
"goods_prepare_time":3,
"fund_status":"WAIT_SELLER_CHECK",
"freight_commit_day":"27",
"escrow_fee_rate":"0.01",
"delivery_time":"5-10",
"child_id":23457890,
"can_submit_issue":false,
"buyer_signer_last_name":"1",
"buyer_signer_first_name":"1",
"afflicate_fee_rate":"0.03"
}
]
},
"phone":false,
"payment_type":"ebanx101",
"pay_amount":{
"currency_code":"USD",
"amount":"1.01"
},
"order_status":"PLACE_ORDER_SUCCESS",
"order_id":1160045860056286,
"order_detail_url":"http",
"logistics_status":"NO_LOGISTICS",
"logisitcs_escrow_fee_rate":"1",
"loan_amount":{
"currency_code":"USD",
"amount":"1.01"
},
"left_send_good_min":"1",
"left_send_good_hour":"1",
"left_send_good_day":"1",
"issue_status":"END_ISSUE",
"has_request_loan":false,
"gmt_update":"2017-10-12 12:12:12",
"gmt_send_goods_time":"2017-10-12 12:12:12",
"gmt_pay_time":"2017-10-12 12:12:12",
"gmt_create":"2017-10-12 12:12:12",
"fund_status":"WAIT_SELLER_CHECK",
"frozen_status":"IN_FROZEN",
"escrow_fee_rate":1,
"escrow_fee":{
"currency_code":"USD",
"amount":"1.01"
},
"end_reason":"buyer_confirm_goods",
"buyer_signer_fullname":"test",
"buyer_login_id":"test",
"biz_type":"AE_RECHARGE",
"offline_pickup_type":"RU_OFFLINE_SELF_PICK_UP_EXPRESSION"
}
]
},
"page_size":1,
"error_code":"1",
"current_page":1,
"total_page":1,
"success":true,
"time_stamp":"1"
}
}
}
EOF;
$mock = self::getMockClient();
$mock->on(
RequestMatcher::createMatcher('api.taobao.com')
->setPath('/router/rest')
->setOptionalQueryParams([
'app_key' => self::getEnvAppKey(),
'method' => 'aliexpress.solution.order.get',
'session' => self::getEnvToken()
]),
$this->responseJson(200, $json)
);
$client = TopClientBuilder::create()
->setContainer($this->getContainer($mock))
->setAppData($this->getEnvAppData())
->setAuthenticator($this->getEnvTokenAuthenticator())
->build();
$query = new OrderQuery();
$query->orderStatus = OrderStatuses::PLACE_ORDER_SUCCESS;
$request = new SolutionOrderGet();
$request->param0 = $query;
/** @var \RetailCrm\Model\Response\AliExpress\SolutionOrderGetResponse $response */
$response = $client->sendAuthenticatedRequest($request);
$result = $response->responseData->result;
self::assertTrue($result->success);
self::assertEquals(1, $result->totalCount);
self::assertCount(1, $result->targetList->orderDto);
self::assertEquals(OrderStatuses::PLACE_ORDER_SUCCESS, $result->targetList->orderDto[0]->orderStatus);
self::assertEquals(222222, $result->targetList->orderDto[0]->productList->orderProductDto[0]->orderId);
self::assertEquals(
OfflinePickupTypes::RU_OFFLINE_SELF_PICK_UP_EXPRESSION,
$result->targetList->orderDto[0]->offlinePickupType
);
}
}