add applyRound and loyaltyLevelId params (#119)
This commit is contained in:
parent
fa93c2bc8d
commit
9c6029fa0d
@ -43,6 +43,14 @@ class SerializedEntityOrder
|
|||||||
*/
|
*/
|
||||||
public $number;
|
public $number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*
|
||||||
|
* @JMS\Type("bool")
|
||||||
|
* @JMS\SerializedName("applyRound")
|
||||||
|
*/
|
||||||
|
public $applyRound;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SerializedEntityOrder constructor.
|
* SerializedEntityOrder constructor.
|
||||||
*
|
*
|
||||||
@ -101,4 +109,18 @@ class SerializedEntityOrder
|
|||||||
{
|
{
|
||||||
return new self(0, '', $number);
|
return new self(0, '', $number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set applyRound and return this entity
|
||||||
|
*
|
||||||
|
* @param bool $applyRound
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setApplyRound(bool $applyRound): self
|
||||||
|
{
|
||||||
|
$this->applyRound = $applyRound;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,4 +147,12 @@ class LoyaltyAccount
|
|||||||
* @JMS\SerializedName("loyalty")
|
* @JMS\SerializedName("loyalty")
|
||||||
*/
|
*/
|
||||||
public $loyalty;
|
public $loyalty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*
|
||||||
|
* @JMS\Type("int")
|
||||||
|
* @JMS\SerializedName("loyaltyLevelId")
|
||||||
|
*/
|
||||||
|
public $loyaltyLevelId;
|
||||||
}
|
}
|
||||||
|
@ -68,4 +68,12 @@ class SerializedOrder
|
|||||||
* @JMS\SerializedName("delivery")
|
* @JMS\SerializedName("delivery")
|
||||||
*/
|
*/
|
||||||
public $delivery;
|
public $delivery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*
|
||||||
|
* @JMS\Type("bool")
|
||||||
|
* @JMS\SerializedName("applyRound")
|
||||||
|
*/
|
||||||
|
public $applyRound;
|
||||||
}
|
}
|
||||||
|
@ -503,4 +503,12 @@ class Order
|
|||||||
* @JMS\SerializedName("loyaltyEventId")
|
* @JMS\SerializedName("loyaltyEventId")
|
||||||
*/
|
*/
|
||||||
public $loyaltyEventId;
|
public $loyaltyEventId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*
|
||||||
|
* @JMS\Type("bool")
|
||||||
|
* @JMS\SerializedName("applyRound")
|
||||||
|
*/
|
||||||
|
public $applyRound;
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ namespace RetailCrm\Tests\ResourceGroup;
|
|||||||
use DateInterval;
|
use DateInterval;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use DateTimeInterface;
|
use DateTimeInterface;
|
||||||
|
use Psr\Http\Message\RequestInterface;
|
||||||
use RetailCrm\Api\Component\Transformer\DateTimeTransformer;
|
use RetailCrm\Api\Component\Transformer\DateTimeTransformer;
|
||||||
use RetailCrm\Api\Enum\Loyalty\AccountStatus;
|
use RetailCrm\Api\Enum\Loyalty\AccountStatus;
|
||||||
use RetailCrm\Api\Enum\Loyalty\PrivilegeType;
|
use RetailCrm\Api\Enum\Loyalty\PrivilegeType;
|
||||||
@ -234,12 +235,19 @@ EOF;
|
|||||||
$account = new LoyaltyAccount();
|
$account = new LoyaltyAccount();
|
||||||
$account->cardNumber = '4444 5555 6666 7777';
|
$account->cardNumber = '4444 5555 6666 7777';
|
||||||
$account->phoneNumber = '88005553000';
|
$account->phoneNumber = '88005553000';
|
||||||
|
$account->loyaltyLevelId = 1;
|
||||||
|
|
||||||
$request = new LoyaltyAccountEditRequest($account);
|
$request = new LoyaltyAccountEditRequest($account);
|
||||||
|
|
||||||
$mock = static::createApiMockBuilder('loyalty/account/159/edit');
|
$mock = static::createApiMockBuilder('loyalty/account/159/edit');
|
||||||
$mock->matchMethod(RequestMethod::POST)
|
$mock->matchMethod(RequestMethod::POST)
|
||||||
->matchBody(static::encodeForm($request))
|
->matchBody(static::encodeForm($request))
|
||||||
|
->matchCallback(static function (RequestInterface $request) {
|
||||||
|
$data = [];
|
||||||
|
parse_str((string) $request->getBody(), $data);
|
||||||
|
|
||||||
|
return false !== strpos($data['loyaltyAccount'] ?? '', '"loyaltyLevelId"');
|
||||||
|
})
|
||||||
->reply(200)
|
->reply(200)
|
||||||
->withBody($json);
|
->withBody($json);
|
||||||
|
|
||||||
@ -700,6 +708,7 @@ EOF;
|
|||||||
$order->items = [$item];
|
$order->items = [$item];
|
||||||
$order->delivery = new SerializedOrderDelivery(100);
|
$order->delivery = new SerializedOrderDelivery(100);
|
||||||
$order->privilegeType = PrivilegeType::NONE;
|
$order->privilegeType = PrivilegeType::NONE;
|
||||||
|
$order->applyRound = true;
|
||||||
|
|
||||||
$request = new LoyaltyCalculateRequest();
|
$request = new LoyaltyCalculateRequest();
|
||||||
$request->site = 'bitrix-test';
|
$request->site = 'bitrix-test';
|
||||||
@ -709,6 +718,12 @@ EOF;
|
|||||||
$mock = static::createApiMockBuilder('loyalty/calculate');
|
$mock = static::createApiMockBuilder('loyalty/calculate');
|
||||||
$mock->matchMethod(RequestMethod::POST)
|
$mock->matchMethod(RequestMethod::POST)
|
||||||
->matchBody(static::encodeForm($request))
|
->matchBody(static::encodeForm($request))
|
||||||
|
->matchCallback(static function (RequestInterface $request) {
|
||||||
|
$data = [];
|
||||||
|
parse_str((string) $request->getBody(), $data);
|
||||||
|
|
||||||
|
return false !== strpos($data['order'] ?? '', '"applyRound"');
|
||||||
|
})
|
||||||
->reply(200)
|
->reply(200)
|
||||||
->withBody($json);
|
->withBody($json);
|
||||||
|
|
||||||
|
@ -529,6 +529,7 @@ EOF;
|
|||||||
"call": false,
|
"call": false,
|
||||||
"expired": false,
|
"expired": false,
|
||||||
"managerId": 28,
|
"managerId": 28,
|
||||||
|
"applyRound": true,
|
||||||
"customer": {
|
"customer": {
|
||||||
"type": "customer",
|
"type": "customer",
|
||||||
"id": 4924,
|
"id": 4924,
|
||||||
@ -7486,12 +7487,18 @@ EOF;
|
|||||||
|
|
||||||
$request = new OrdersLoyaltyApplyRequest();
|
$request = new OrdersLoyaltyApplyRequest();
|
||||||
$request->site = 'bitrix-test';
|
$request->site = 'bitrix-test';
|
||||||
$request->order = SerializedEntityOrder::withNumber('7');
|
$request->order = SerializedEntityOrder::withNumber('7')->setApplyRound(true);
|
||||||
$request->bonuses = 10;
|
$request->bonuses = 10;
|
||||||
|
|
||||||
$mock = static::createApiMockBuilder('orders/loyalty/apply');
|
$mock = static::createApiMockBuilder('orders/loyalty/apply');
|
||||||
$mock->matchMethod(RequestMethod::POST)
|
$mock->matchMethod(RequestMethod::POST)
|
||||||
->matchBody(static::encodeForm($request))
|
->matchBody(static::encodeForm($request))
|
||||||
|
->matchCallback(static function (RequestInterface $request) {
|
||||||
|
$data = [];
|
||||||
|
parse_str((string) $request->getBody(), $data);
|
||||||
|
|
||||||
|
return false !== strpos($data['order'] ?? '', '"applyRound"');
|
||||||
|
})
|
||||||
->reply(200)
|
->reply(200)
|
||||||
->withBody($json);
|
->withBody($json);
|
||||||
|
|
||||||
@ -7551,13 +7558,19 @@ EOF;
|
|||||||
EOF;
|
EOF;
|
||||||
|
|
||||||
$request = new OrderLoyaltyCancelBonusOperationsRequest(
|
$request = new OrderLoyaltyCancelBonusOperationsRequest(
|
||||||
SerializedEntityOrder::withId(7751),
|
SerializedEntityOrder::withId(7751)->setApplyRound(true),
|
||||||
'bitrix-test'
|
'bitrix-test'
|
||||||
);
|
);
|
||||||
$mock = static::createApiMockBuilder('orders/loyalty/cancel-bonus-operations');
|
$mock = static::createApiMockBuilder('orders/loyalty/cancel-bonus-operations');
|
||||||
|
|
||||||
$mock->matchMethod(RequestMethod::POST)
|
$mock->matchMethod(RequestMethod::POST)
|
||||||
->matchBody(static::encodeForm($request))
|
->matchBody(static::encodeForm($request))
|
||||||
|
->matchCallback(static function (RequestInterface $request) {
|
||||||
|
$data = [];
|
||||||
|
parse_str((string) $request->getBody(), $data);
|
||||||
|
|
||||||
|
return false !== strpos($data['order'] ?? '', '"applyRound"');
|
||||||
|
})
|
||||||
->reply(200)
|
->reply(200)
|
||||||
->withBody($json);
|
->withBody($json);
|
||||||
|
|
||||||
@ -7708,6 +7721,7 @@ EOF;
|
|||||||
"call": false,
|
"call": false,
|
||||||
"expired": false,
|
"expired": false,
|
||||||
"managerId": 28,
|
"managerId": 28,
|
||||||
|
"applyRound": true,
|
||||||
"customer": {
|
"customer": {
|
||||||
"type": "customer",
|
"type": "customer",
|
||||||
"id": 4924,
|
"id": 4924,
|
||||||
@ -8511,6 +8525,7 @@ EOF;
|
|||||||
"call": false,
|
"call": false,
|
||||||
"expired": false,
|
"expired": false,
|
||||||
"managerComment": "Manager comment",
|
"managerComment": "Manager comment",
|
||||||
|
"applyRound": true,
|
||||||
"customer": {
|
"customer": {
|
||||||
"type": "customer",
|
"type": "customer",
|
||||||
"id": 4976,
|
"id": 4976,
|
||||||
|
Loading…
Reference in New Issue
Block a user