/api/v5/loyalty/bonus/operations
method
This commit is contained in:
commit
fc62d95dbb
29
src/Model/Entity/CursorPagination.php
Normal file
29
src/Model/Entity/CursorPagination.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP version 7.3
|
||||||
|
*
|
||||||
|
* @category CursorPagination
|
||||||
|
* @package RetailCrm\Api\Model\Entity
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Api\Model\Entity;
|
||||||
|
|
||||||
|
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CursorPagination
|
||||||
|
*
|
||||||
|
* @category CursorPagination
|
||||||
|
* @package RetailCrm\Api\Model\Entity
|
||||||
|
*/
|
||||||
|
class CursorPagination
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("nextCursor")
|
||||||
|
*/
|
||||||
|
public $nextCursor;
|
||||||
|
}
|
@ -66,4 +66,20 @@ class Operation
|
|||||||
* @JMS\SerializedName("event")
|
* @JMS\SerializedName("event")
|
||||||
*/
|
*/
|
||||||
public $event;
|
public $event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \RetailCrm\Api\Model\Entity\IdModel
|
||||||
|
*
|
||||||
|
* @JMS\Type("RetailCrm\Api\Model\Entity\IdModel")
|
||||||
|
* @JMS\SerializedName("loyaltyAccount")
|
||||||
|
*/
|
||||||
|
public $loyaltyAccount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \RetailCrm\Api\Model\Entity\IdModel
|
||||||
|
*
|
||||||
|
* @JMS\Type("RetailCrm\Api\Model\Entity\IdModel")
|
||||||
|
* @JMS\SerializedName("loyalty")
|
||||||
|
*/
|
||||||
|
public $loyalty;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP version 7.3
|
||||||
|
*
|
||||||
|
* @category LoyaltyBonusOperationsApiFilterType
|
||||||
|
* @package RetailCrm\Api\Model\Filter\Loyalty
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Api\Model\Filter\Loyalty;
|
||||||
|
|
||||||
|
use RetailCrm\Api\Component\FormData\Mapping as Form;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class LoyaltyBonusOperationsApiFilterType
|
||||||
|
*
|
||||||
|
* @category LoyaltyBonusOperationsApiFilterType
|
||||||
|
* @package RetailCrm\Api\Model\Filter\Loyalty
|
||||||
|
*/
|
||||||
|
class LoyaltyBonusOperationsApiFilterType
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var int[]
|
||||||
|
*
|
||||||
|
* @Form\Type("int[]")
|
||||||
|
* @Form\SerializedName("loyalties")
|
||||||
|
*/
|
||||||
|
public $loyalties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int[] $loyalties
|
||||||
|
*/
|
||||||
|
public function __construct(array $loyalties = [])
|
||||||
|
{
|
||||||
|
$this->loyalties = $loyalties;
|
||||||
|
}
|
||||||
|
}
|
47
src/Model/Request/Loyalty/AllBonusOperationsRequest.php
Normal file
47
src/Model/Request/Loyalty/AllBonusOperationsRequest.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP version 7.3
|
||||||
|
*
|
||||||
|
* @category BonusOperationsRequest
|
||||||
|
* @package RetailCrm\Api\Model\Request\Loyalty
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Api\Model\Request\Loyalty;
|
||||||
|
|
||||||
|
use RetailCrm\Api\Interfaces\RequestInterface;
|
||||||
|
use RetailCrm\Api\Model\Filter\Loyalty\LoyaltyBonusOperationsApiFilterType;
|
||||||
|
use RetailCrm\Api\Component\FormData\Mapping as Form;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class BonusOperationsRequest
|
||||||
|
*
|
||||||
|
* @category BonusOperationsRequest
|
||||||
|
* @package RetailCrm\Api\Model\Request\Loyalty
|
||||||
|
*/
|
||||||
|
class AllBonusOperationsRequest implements RequestInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*
|
||||||
|
* @Form\Type("int")
|
||||||
|
* @Form\SerializedName("limit")
|
||||||
|
*/
|
||||||
|
public $limit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @Form\Type("string")
|
||||||
|
* @Form\SerializedName("cursor")
|
||||||
|
*/
|
||||||
|
public $cursor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var LoyaltyBonusOperationsApiFilterType
|
||||||
|
*
|
||||||
|
* @Form\Type("RetailCrm\Api\Model\Filter\Loyalty\LoyaltyBonusOperationsApiFilterType")
|
||||||
|
* @Form\SerializedName("filter")
|
||||||
|
*/
|
||||||
|
public $filter;
|
||||||
|
}
|
29
src/Model/Response/AbstractCursorPaginatedResponse.php
Normal file
29
src/Model/Response/AbstractCursorPaginatedResponse.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP version 7.3
|
||||||
|
*
|
||||||
|
* @category AbstractCursorPaginatedResponse
|
||||||
|
* @package RetailCrm\Api\Model\Response
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Api\Model\Response;
|
||||||
|
|
||||||
|
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class AbstractCursorPaginatedResponse
|
||||||
|
*
|
||||||
|
* @category AbstractCursorPaginatedResponse
|
||||||
|
* @package RetailCrm\Api\Model\Response
|
||||||
|
*/
|
||||||
|
class AbstractCursorPaginatedResponse extends SuccessResponse
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var \RetailCrm\Api\Model\Entity\CursorPagination
|
||||||
|
*
|
||||||
|
* @JMS\Type("RetailCrm\Api\Model\Entity\CursorPagination")
|
||||||
|
* @JMS\SerializedName("pagination")
|
||||||
|
*/
|
||||||
|
public $pagination;
|
||||||
|
}
|
30
src/Model/Response/Loyalty/AllBonusOperationsResponse.php
Normal file
30
src/Model/Response/Loyalty/AllBonusOperationsResponse.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP version 7.3
|
||||||
|
*
|
||||||
|
* @category AllBonusOperationsResponse
|
||||||
|
* @package RetailCrm\Api\Model\Response\Loyalty
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Api\Model\Response\Loyalty;
|
||||||
|
|
||||||
|
use RetailCrm\Api\Model\Response\AbstractCursorPaginatedResponse;
|
||||||
|
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class AllBonusOperationsResponse
|
||||||
|
*
|
||||||
|
* @category AllBonusOperationsResponse
|
||||||
|
* @package RetailCrm\Api\Model\Response\Loyalty
|
||||||
|
*/
|
||||||
|
class AllBonusOperationsResponse extends AbstractCursorPaginatedResponse
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var \RetailCrm\Api\Model\Entity\Loyalty\Operation[]
|
||||||
|
*
|
||||||
|
* @JMS\Type("array<RetailCrm\Api\Model\Entity\Loyalty\Operation>")
|
||||||
|
* @JMS\SerializedName("bonusOperations")
|
||||||
|
*/
|
||||||
|
public $bonusOperations;
|
||||||
|
}
|
@ -10,6 +10,7 @@
|
|||||||
namespace RetailCrm\Api\ResourceGroup;
|
namespace RetailCrm\Api\ResourceGroup;
|
||||||
|
|
||||||
use RetailCrm\Api\Enum\RequestMethod;
|
use RetailCrm\Api\Enum\RequestMethod;
|
||||||
|
use RetailCrm\Api\Model\Request\Loyalty\AllBonusOperationsRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\BonusAccountDetailsRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\BonusAccountDetailsRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltiesRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\LoyaltiesRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountCreateRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountCreateRequest;
|
||||||
@ -18,6 +19,7 @@ use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountsRequest;
|
|||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusCreditRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusCreditRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusOperationsRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusOperationsRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyCalculateRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyCalculateRequest;
|
||||||
|
use RetailCrm\Api\Model\Response\Loyalty\AllBonusOperationsResponse;
|
||||||
use RetailCrm\Api\Model\Response\Loyalty\BonusAccountDetailsResponse;
|
use RetailCrm\Api\Model\Response\Loyalty\BonusAccountDetailsResponse;
|
||||||
use RetailCrm\Api\Model\Response\Loyalty\LoyaltiesResponse;
|
use RetailCrm\Api\Model\Response\Loyalty\LoyaltiesResponse;
|
||||||
use RetailCrm\Api\Model\Response\Loyalty\LoyaltyAccountActivateResponse;
|
use RetailCrm\Api\Model\Response\Loyalty\LoyaltyAccountActivateResponse;
|
||||||
@ -464,6 +466,68 @@ class Loyalty extends AbstractApiResourceGroup
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes GET "/api/v5/loyalty/bonus/operations" request.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* ```php
|
||||||
|
* use RetailCrm\Api\Enum\PaginationLimit;
|
||||||
|
* use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||||
|
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
|
||||||
|
* use RetailCrm\Api\Model\Filter\Loyalty\LoyaltyBonusOperationsApiFilterType;
|
||||||
|
* use RetailCrm\Api\Model\Request\Loyalty\AllBonusOperationsRequest;
|
||||||
|
*
|
||||||
|
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
|
||||||
|
*
|
||||||
|
* $request = new AllBonusOperationsRequest();
|
||||||
|
* $request->limit = PaginationLimit::LIMIT_20;
|
||||||
|
* $request->cursor = '12345';
|
||||||
|
* $request->filter = new LoyaltyBonusOperationsApiFilterType([1, 2, 3]);
|
||||||
|
*
|
||||||
|
* try {
|
||||||
|
* $response = $client->loyalty->bonusOperations($request);
|
||||||
|
* } catch (ApiExceptionInterface $exception) {
|
||||||
|
* echo sprintf(
|
||||||
|
* 'Error from RetailCRM API (status code: %d): %s',
|
||||||
|
* $exception->getStatusCode(),
|
||||||
|
* $exception->getMessage()
|
||||||
|
* );
|
||||||
|
*
|
||||||
|
* if (count($exception->getErrorResponse()->errors) > 0) {
|
||||||
|
* echo PHP_EOL . 'Errors: ' . implode(', ', $exception->getErrorResponse()->errors);
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* return;
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* echo 'All bonus operations: ' . print_r($response->bonusOperations, true);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param \RetailCrm\Api\Model\Request\Loyalty\AllBonusOperationsRequest|null $request
|
||||||
|
*
|
||||||
|
* @return \RetailCrm\Api\Model\Response\Loyalty\AllBonusOperationsResponse
|
||||||
|
* @throws \RetailCrm\Api\Exception\Api\AccountDoesNotExistException
|
||||||
|
* @throws \RetailCrm\Api\Exception\Api\ApiErrorException
|
||||||
|
* @throws \RetailCrm\Api\Exception\Api\MissingCredentialsException
|
||||||
|
* @throws \RetailCrm\Api\Exception\Api\MissingParameterException
|
||||||
|
* @throws \RetailCrm\Api\Exception\Api\ValidationException
|
||||||
|
* @throws \RetailCrm\Api\Exception\Client\HandlerException
|
||||||
|
* @throws \RetailCrm\Api\Exception\Client\HttpClientException
|
||||||
|
* @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface
|
||||||
|
* @throws \RetailCrm\Api\Interfaces\ClientExceptionInterface
|
||||||
|
*/
|
||||||
|
public function bonusOperations(?AllBonusOperationsRequest $request = null): AllBonusOperationsResponse
|
||||||
|
{
|
||||||
|
/** @var AllBonusOperationsResponse $response */
|
||||||
|
$response = $this->sendRequest(
|
||||||
|
RequestMethod::GET,
|
||||||
|
'loyalty/bonus/operations',
|
||||||
|
$request,
|
||||||
|
AllBonusOperationsResponse::class
|
||||||
|
);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes POST "/api/v5/loyalty/calculate" request.
|
* Makes POST "/api/v5/loyalty/calculate" request.
|
||||||
*
|
*
|
||||||
|
@ -17,21 +17,22 @@ 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;
|
||||||
use RetailCrm\Api\Enum\NumericBoolean;
|
use RetailCrm\Api\Enum\NumericBoolean;
|
||||||
|
use RetailCrm\Api\Enum\PaginationLimit;
|
||||||
use RetailCrm\Api\Enum\RequestMethod;
|
use RetailCrm\Api\Enum\RequestMethod;
|
||||||
use RetailCrm\Api\Model\Entity\CustomersCorporate\SerializedEntityCustomer;
|
use RetailCrm\Api\Model\Entity\CustomersCorporate\SerializedEntityCustomer;
|
||||||
use RetailCrm\Api\Model\Entity\CustomersCorporate\SerializedRelationAbstractCustomer;
|
use RetailCrm\Api\Model\Entity\CustomersCorporate\SerializedRelationAbstractCustomer;
|
||||||
use RetailCrm\Api\Model\Entity\Loyalty\BonusDetail;
|
|
||||||
use RetailCrm\Api\Model\Entity\Loyalty\LoyaltyAccount;
|
use RetailCrm\Api\Model\Entity\Loyalty\LoyaltyAccount;
|
||||||
use RetailCrm\Api\Model\Entity\Loyalty\SerializedCreateLoyaltyAccount;
|
use RetailCrm\Api\Model\Entity\Loyalty\SerializedCreateLoyaltyAccount;
|
||||||
use RetailCrm\Api\Model\Entity\Loyalty\SerializedOrder;
|
use RetailCrm\Api\Model\Entity\Loyalty\SerializedOrder;
|
||||||
use RetailCrm\Api\Model\Entity\Loyalty\SerializedOrderDelivery;
|
use RetailCrm\Api\Model\Entity\Loyalty\SerializedOrderDelivery;
|
||||||
use RetailCrm\Api\Model\Entity\Loyalty\SerializedOrderProduct;
|
use RetailCrm\Api\Model\Entity\Loyalty\SerializedOrderProduct;
|
||||||
use RetailCrm\Api\Model\Entity\Loyalty\SerializedOrderProductOffer;
|
use RetailCrm\Api\Model\Entity\Loyalty\SerializedOrderProductOffer;
|
||||||
use RetailCrm\Api\Model\Entity\Pagination;
|
|
||||||
use RetailCrm\Api\Model\Filter\Loyalty\LoyaltyAccountApiFilterType;
|
use RetailCrm\Api\Model\Filter\Loyalty\LoyaltyAccountApiFilterType;
|
||||||
use RetailCrm\Api\Model\Filter\Loyalty\LoyaltyAccountBonusApiFilterType;
|
use RetailCrm\Api\Model\Filter\Loyalty\LoyaltyAccountBonusApiFilterType;
|
||||||
use RetailCrm\Api\Model\Filter\Loyalty\LoyaltyAccountBonusOperationsApiFilterType;
|
use RetailCrm\Api\Model\Filter\Loyalty\LoyaltyAccountBonusOperationsApiFilterType;
|
||||||
use RetailCrm\Api\Model\Filter\Loyalty\LoyaltyApiFilterType;
|
use RetailCrm\Api\Model\Filter\Loyalty\LoyaltyApiFilterType;
|
||||||
|
use RetailCrm\Api\Model\Filter\Loyalty\LoyaltyBonusOperationsApiFilterType;
|
||||||
|
use RetailCrm\Api\Model\Request\Loyalty\AllBonusOperationsRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\BonusAccountDetailsRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\BonusAccountDetailsRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltiesRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\LoyaltiesRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountCreateRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountCreateRequest;
|
||||||
@ -40,8 +41,6 @@ use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountsRequest;
|
|||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusCreditRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusCreditRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusOperationsRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusOperationsRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyCalculateRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyCalculateRequest;
|
||||||
use RetailCrm\Api\Model\Response\Loyalty\BonusAccountDetailsResponse;
|
|
||||||
use RetailCrm\Api\Model\Response\Loyalty\LoyaltyBonusStatisticResponse;
|
|
||||||
use RetailCrm\TestUtils\Factory\TestClientFactory;
|
use RetailCrm\TestUtils\Factory\TestClientFactory;
|
||||||
use RetailCrm\TestUtils\TestCase\AbstractApiResourceGroupTestCase;
|
use RetailCrm\TestUtils\TestCase\AbstractApiResourceGroupTestCase;
|
||||||
|
|
||||||
@ -659,6 +658,350 @@ EOF;
|
|||||||
self::assertModelEqualsToResponse($json, $response);
|
self::assertModelEqualsToResponse($json, $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testBonusOperations(): void
|
||||||
|
{
|
||||||
|
$json = <<<'EOF'
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"pagination": {
|
||||||
|
"nextCursor": "WzI0OSwiMjAyMi0wMS0xOCAxNjoxMzoxNiswMzowMCJd"
|
||||||
|
},
|
||||||
|
"bonusOperations": [
|
||||||
|
{
|
||||||
|
"type": "credit_for_order",
|
||||||
|
"createdAt": "2020-11-27 13:42:37",
|
||||||
|
"amount": 347.8,
|
||||||
|
"order": {
|
||||||
|
"id": 6472,
|
||||||
|
"externalId": "9"
|
||||||
|
},
|
||||||
|
"bonus": {
|
||||||
|
"activationDate": "2020-11-27"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 147
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 3
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "charge_for_order",
|
||||||
|
"createdAt": "2020-11-27 13:45:39",
|
||||||
|
"amount": -247,
|
||||||
|
"order": {
|
||||||
|
"id": 6473,
|
||||||
|
"externalId": "10"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 147
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 3
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "credit_for_order",
|
||||||
|
"createdAt": "2020-11-27 13:47:57",
|
||||||
|
"amount": 215.1,
|
||||||
|
"order": {
|
||||||
|
"id": 6473,
|
||||||
|
"externalId": "10"
|
||||||
|
},
|
||||||
|
"bonus": {
|
||||||
|
"activationDate": "2020-11-27"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 147
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 3
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "credit_for_order",
|
||||||
|
"createdAt": "2020-11-27 16:33:32",
|
||||||
|
"amount": 655.7,
|
||||||
|
"order": {
|
||||||
|
"id": 6474,
|
||||||
|
"externalId": "11"
|
||||||
|
},
|
||||||
|
"bonus": {
|
||||||
|
"activationDate": "2020-11-27"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 149
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 3
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "credit_manual",
|
||||||
|
"createdAt": "2021-11-02 12:52:53",
|
||||||
|
"amount": 1000,
|
||||||
|
"bonus": {
|
||||||
|
"activationDate": "2021-11-02"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 201
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 6
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "charge_for_order",
|
||||||
|
"createdAt": "2021-11-02 12:54:52",
|
||||||
|
"amount": -10,
|
||||||
|
"order": {
|
||||||
|
"id": 8181,
|
||||||
|
"externalId": "7"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 201
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 6
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "credit_manual",
|
||||||
|
"createdAt": "2021-11-03 10:31:57",
|
||||||
|
"amount": 1000,
|
||||||
|
"bonus": {
|
||||||
|
"activationDate": "2021-11-03"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 202
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 6
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "charge_for_order",
|
||||||
|
"createdAt": "2021-11-03 18:10:23",
|
||||||
|
"amount": -70,
|
||||||
|
"order": {
|
||||||
|
"id": 8184,
|
||||||
|
"externalId": "8"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 202
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 6
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "credit_manual",
|
||||||
|
"createdAt": "2021-11-09 15:50:09",
|
||||||
|
"amount": 1234,
|
||||||
|
"bonus": {
|
||||||
|
"activationDate": "2021-11-09"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 205
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "charge_for_order",
|
||||||
|
"createdAt": "2021-11-09 15:50:43",
|
||||||
|
"amount": -1234,
|
||||||
|
"order": {
|
||||||
|
"id": 8203,
|
||||||
|
"externalId": "6"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 205
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "credit_for_order",
|
||||||
|
"createdAt": "2021-11-10 17:50:47",
|
||||||
|
"amount": 1029.2,
|
||||||
|
"order": {
|
||||||
|
"id": 8205,
|
||||||
|
"externalId": "11"
|
||||||
|
},
|
||||||
|
"bonus": {
|
||||||
|
"activationDate": "2021-11-10"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 206
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 6
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "credit_manual",
|
||||||
|
"createdAt": "2021-12-29 12:37:47",
|
||||||
|
"amount": 1000,
|
||||||
|
"bonus": {
|
||||||
|
"activationDate": "2021-12-29"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 167
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "charge_for_order",
|
||||||
|
"createdAt": "2021-12-29 14:55:42",
|
||||||
|
"amount": -300,
|
||||||
|
"order": {
|
||||||
|
"id": 8412,
|
||||||
|
"externalId": "6"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 167
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "charge_for_order",
|
||||||
|
"createdAt": "2021-12-30 10:56:10",
|
||||||
|
"amount": -2,
|
||||||
|
"order": {
|
||||||
|
"id": 8414,
|
||||||
|
"externalId": "7"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 167
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "charge_for_order",
|
||||||
|
"createdAt": "2021-12-30 11:01:19",
|
||||||
|
"amount": -4,
|
||||||
|
"order": {
|
||||||
|
"id": 8415,
|
||||||
|
"externalId": "8"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 167
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "charge_for_order",
|
||||||
|
"createdAt": "2021-12-30 11:06:39",
|
||||||
|
"amount": -4,
|
||||||
|
"order": {
|
||||||
|
"id": 8416,
|
||||||
|
"externalId": "9"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 167
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "charge_for_order",
|
||||||
|
"createdAt": "2021-12-30 11:09:18",
|
||||||
|
"amount": -2,
|
||||||
|
"order": {
|
||||||
|
"id": 8032,
|
||||||
|
"externalId": "10"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 167
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "charge_for_order",
|
||||||
|
"createdAt": "2021-12-30 11:32:35",
|
||||||
|
"amount": -2,
|
||||||
|
"order": {
|
||||||
|
"id": 8033,
|
||||||
|
"externalId": "11"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 167
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "charge_for_order",
|
||||||
|
"createdAt": "2021-12-30 11:37:13",
|
||||||
|
"amount": -2.4,
|
||||||
|
"order": {
|
||||||
|
"id": 8034,
|
||||||
|
"externalId": "12"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 167
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "charge_for_order",
|
||||||
|
"createdAt": "2022-01-18 15:28:19",
|
||||||
|
"amount": -22.4,
|
||||||
|
"order": {
|
||||||
|
"id": 8035,
|
||||||
|
"externalId": "13"
|
||||||
|
},
|
||||||
|
"loyaltyAccount": {
|
||||||
|
"id": 167
|
||||||
|
},
|
||||||
|
"loyalty": {
|
||||||
|
"id": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
EOF;
|
||||||
|
|
||||||
|
$request = new AllBonusOperationsRequest();
|
||||||
|
$request->limit = PaginationLimit::LIMIT_20;
|
||||||
|
$request->cursor = 'dJCMwozMwsiNxozMxojNxACOx0SMw0iMyAjMiwSO0IzW';
|
||||||
|
$request->filter = new LoyaltyBonusOperationsApiFilterType([1, 2, 3, 4, 5, 6, 7, 8]);
|
||||||
|
|
||||||
|
$mock = static::createApiMockBuilder('loyalty/bonus/operations');
|
||||||
|
$mock->matchMethod(RequestMethod::GET)
|
||||||
|
->matchQuery([
|
||||||
|
'limit' => (string) PaginationLimit::LIMIT_20,
|
||||||
|
'cursor' => 'dJCMwozMwsiNxozMxojNxACOx0SMw0iMyAjMiwSO0IzW',
|
||||||
|
'filter' => [
|
||||||
|
'loyalties' => ['1', '2', '3', '4', '5', '6', '7', '8']
|
||||||
|
]
|
||||||
|
])
|
||||||
|
->reply(200)
|
||||||
|
->withBody($json);
|
||||||
|
|
||||||
|
$client = TestClientFactory::createClient($mock->getClient());
|
||||||
|
$response = $client->loyalty->bonusOperations($request);
|
||||||
|
|
||||||
|
self::assertModelEqualsToResponse($json, $response);
|
||||||
|
}
|
||||||
|
|
||||||
public function testCalculate(): void
|
public function testCalculate(): void
|
||||||
{
|
{
|
||||||
$json = <<<'EOF'
|
$json = <<<'EOF'
|
||||||
|
Loading…
Reference in New Issue
Block a user