1
0
mirror of synced 2024-11-21 21:06:07 +03:00

Add support for new filters of GET /api/v5/store/offers method (#205)

* Add support for new filters of GET /api/v5/store/offers method

- filter[min/maxPrice]
- filter[priceType]
- filter[min/maxQuantity]
- filter[catalogs][]

---------

Co-authored-by: Kirill Sukhorukov <suhorukov@retailcrm.ru>
This commit is contained in:
RenCurs 2024-08-27 09:33:04 +03:00 committed by GitHub
parent 1c6ebd819f
commit 6130b265fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 79 additions and 2 deletions

View File

@ -36,6 +36,14 @@ class Product
*/ */
public $maxPrice; public $maxPrice;
/**
* @var int
*
* @JMS\Type("int")
* @JMS\SerializedName("catalogId")
*/
public $catalogId;
/** /**
* @var int * @var int
* *

View File

@ -68,6 +68,14 @@ class OfferFilterType
*/ */
public $sites; public $sites;
/**
* @var int[]
*
* @Form\Type("int[]")
* @Form\SerializedName("catalogs")
*/
public $catalogs;
/** /**
* @var int * @var int
* *
@ -83,4 +91,52 @@ class OfferFilterType
* @Form\SerializedName("sinceId") * @Form\SerializedName("sinceId")
*/ */
public $sinceId; public $sinceId;
/**
* @var int[]
*
* @Form\Type("int[]")
* @Form\SerializedName("groups")
*/
public $groups;
/**
* @var string
*
* @Form\Type("string")
* @Form\SerializedName("priceType")
*/
public $priceType;
/**
* @var int
*
* @Form\Type("int")
* @Form\SerializedName("minPrice")
*/
public $minPrice;
/**
* @var int
*
* @Form\Type("int")
* @Form\SerializedName("maxPrice")
*/
public $maxPrice;
/**
* @var int
*
* @Form\Type("int")
* @Form\SerializedName("minQuantity")
*/
public $minQuantity;
/**
* @var int
*
* @Form\Type("int")
* @Form\SerializedName("maxQuantity")
*/
public $maxQuantity;
} }

View File

@ -943,11 +943,24 @@ EOF;
$request = new OffersRequest(); $request = new OffersRequest();
$request->filter = new OfferFilterType(); $request->filter = new OfferFilterType();
$request->filter->active = NumericBoolean::TRUE; $request->filter->active = NumericBoolean::TRUE;
$request->filter->name = 'Test Offer'; $request->filter->minPrice = 1;
$request->filter->maxPrice = 120000;
$request->filter->sites = ['main'];
$request->filter->maxQuantity = 5;
$request->filter->catalogs = [2];
$mock = static::createApiMockBuilder('store/offers'); $mock = static::createApiMockBuilder('store/offers');
$mock->matchMethod(RequestMethod::GET) $mock->matchMethod(RequestMethod::GET)
->matchQuery(self::encodeFormArray($request)) ->matchQuery([
'filter' => [
'sites' => ['main'],
'catalogs' => ['2'],
'active' => '1',
'minPrice' => '1',
'maxPrice' => '120000',
'maxQuantity' => '5',
]
])
->reply(200) ->reply(200)
->withBody($json); ->withBody($json);