Add support for GET /api/v5/store/offers method (#203)
Co-authored-by: Kirill Sukhorukov <suhorukov@retailcrm.ru>
This commit is contained in:
parent
544d16186f
commit
1c6ebd819f
190
src/Model/Entity/Store/OfferProduct.php
Normal file
190
src/Model/Entity/Store/OfferProduct.php
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP version 7.3
|
||||||
|
*
|
||||||
|
* @category OfferProduct
|
||||||
|
* @package RetailCrm\Api\Model\Entity\Store
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Api\Model\Entity\Store;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
|
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Product
|
||||||
|
*
|
||||||
|
* @category OfferProduct
|
||||||
|
* @package RetailCrm\Api\Model\Entity\Store
|
||||||
|
*/
|
||||||
|
class OfferProduct
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var float
|
||||||
|
*
|
||||||
|
* @JMS\Type("float")
|
||||||
|
* @JMS\SerializedName("minPrice")
|
||||||
|
*/
|
||||||
|
public $minPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var float
|
||||||
|
*
|
||||||
|
* @JMS\Type("float")
|
||||||
|
* @JMS\SerializedName("maxPrice")
|
||||||
|
*/
|
||||||
|
public $maxPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*
|
||||||
|
* @JMS\Type("int")
|
||||||
|
* @JMS\SerializedName("id")
|
||||||
|
*/
|
||||||
|
public $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("article")
|
||||||
|
*/
|
||||||
|
public $article;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("name")
|
||||||
|
*/
|
||||||
|
public $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("url")
|
||||||
|
*/
|
||||||
|
public $url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("imageUrl")
|
||||||
|
*/
|
||||||
|
public $imageUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("description")
|
||||||
|
*/
|
||||||
|
public $description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*
|
||||||
|
* @JMS\Type("bool")
|
||||||
|
* @JMS\SerializedName("popular")
|
||||||
|
*/
|
||||||
|
public $popular;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*
|
||||||
|
* @JMS\Type("bool")
|
||||||
|
* @JMS\SerializedName("stock")
|
||||||
|
*/
|
||||||
|
public $stock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*
|
||||||
|
* @JMS\Type("bool")
|
||||||
|
* @JMS\SerializedName("novelty")
|
||||||
|
*/
|
||||||
|
public $novelty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*
|
||||||
|
* @JMS\Type("bool")
|
||||||
|
* @JMS\SerializedName("recommended")
|
||||||
|
*/
|
||||||
|
public $recommended;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array<string, mixed>
|
||||||
|
*
|
||||||
|
* @JMS\Type("array")
|
||||||
|
* @JMS\SerializedName("properties")
|
||||||
|
*/
|
||||||
|
public $properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \RetailCrm\Api\Model\Entity\FixExternalRow[]
|
||||||
|
*
|
||||||
|
* @JMS\Type("array<RetailCrm\Api\Model\Entity\FixExternalRow>")
|
||||||
|
* @JMS\SerializedName("groups")
|
||||||
|
*/
|
||||||
|
public $groups;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("externalId")
|
||||||
|
*/
|
||||||
|
public $externalId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("manufacturer")
|
||||||
|
*/
|
||||||
|
public $manufacturer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*
|
||||||
|
* @JMS\Type("bool")
|
||||||
|
* @JMS\SerializedName("active")
|
||||||
|
*/
|
||||||
|
public $active;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var float
|
||||||
|
*
|
||||||
|
* @JMS\Type("float")
|
||||||
|
* @JMS\SerializedName("quantity")
|
||||||
|
*/
|
||||||
|
public $quantity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*
|
||||||
|
* @JMS\Type("bool")
|
||||||
|
* @JMS\SerializedName("markable")
|
||||||
|
*/
|
||||||
|
public $markable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var DateTime
|
||||||
|
*
|
||||||
|
* @JMS\Type("DateTime<'Y-m-d H:i:s'>")
|
||||||
|
* @JMS\SerializedName("updatedAt")
|
||||||
|
*/
|
||||||
|
public $updatedAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("type")
|
||||||
|
*/
|
||||||
|
public $type;
|
||||||
|
}
|
34
src/Model/Entity/Store/StoreOffer.php
Normal file
34
src/Model/Entity/Store/StoreOffer.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP version 7.3
|
||||||
|
*
|
||||||
|
* @category StoreOffer
|
||||||
|
* @package RetailCrm\Api\Model\Entity\Store
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Api\Model\Entity\Store;
|
||||||
|
|
||||||
|
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class StoreOffer
|
||||||
|
*
|
||||||
|
* @category StoreOffer
|
||||||
|
* @package RetailCrm\Api\Model\Entity\Store
|
||||||
|
*/
|
||||||
|
class StoreOffer extends ProductOffer
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @JMS\Exclude()
|
||||||
|
*/
|
||||||
|
public $price;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \RetailCrm\Api\Model\Entity\Store\Product
|
||||||
|
*
|
||||||
|
* @JMS\Type("RetailCrm\Api\Model\Entity\Store\Product")
|
||||||
|
* @JMS\SerializedName("product")
|
||||||
|
*/
|
||||||
|
public $product;
|
||||||
|
}
|
86
src/Model/Filter/Store/OfferFilterType.php
Normal file
86
src/Model/Filter/Store/OfferFilterType.php
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP version 7.3
|
||||||
|
*
|
||||||
|
* @category OfferFilterType
|
||||||
|
* @package RetailCrm\Api\Model\Filter\Store
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Api\Model\Filter\Store;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
|
use RetailCrm\Api\Component\FormData\Mapping as Form;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class OfferFilterType
|
||||||
|
*
|
||||||
|
* @category OfferFilterType
|
||||||
|
* @package RetailCrm\Api\Model\Filter\Store
|
||||||
|
*/
|
||||||
|
class OfferFilterType
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var int[]
|
||||||
|
*
|
||||||
|
* @Form\Type("int[]")
|
||||||
|
* @Form\SerializedName("ids")
|
||||||
|
*/
|
||||||
|
public $ids;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @Form\Type("string")
|
||||||
|
* @Form\SerializedName("name")
|
||||||
|
*/
|
||||||
|
public $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @Form\Type("string[]")
|
||||||
|
* @Form\SerializedName("externalIds")
|
||||||
|
*/
|
||||||
|
public $externalIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @Form\Type("string[]")
|
||||||
|
* @Form\SerializedName("xmlIds")
|
||||||
|
*/
|
||||||
|
public $xmlIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string[]
|
||||||
|
*
|
||||||
|
* @Form\Type("string[]")
|
||||||
|
* @Form\SerializedName("properties")
|
||||||
|
*/
|
||||||
|
public $properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string[]
|
||||||
|
*
|
||||||
|
* @Form\Type("string[]")
|
||||||
|
* @Form\SerializedName("sites")
|
||||||
|
*/
|
||||||
|
public $sites;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*
|
||||||
|
* @Form\Type("int")
|
||||||
|
* @Form\SerializedName("active")
|
||||||
|
*/
|
||||||
|
public $active;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*
|
||||||
|
* @Form\Type("int")
|
||||||
|
* @Form\SerializedName("sinceId")
|
||||||
|
*/
|
||||||
|
public $sinceId;
|
||||||
|
}
|
33
src/Model/Request/Store/OffersRequest.php
Normal file
33
src/Model/Request/Store/OffersRequest.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP version 7.3
|
||||||
|
*
|
||||||
|
* @category OffersRequest
|
||||||
|
* @package RetailCrm\Api\Model\Request\Store
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Api\Model\Request\Store;
|
||||||
|
|
||||||
|
use RetailCrm\Api\Component\FormData\Mapping as Form;
|
||||||
|
use RetailCrm\Api\Interfaces\RequestInterface;
|
||||||
|
use RetailCrm\Api\Model\Request\Traits\PageLimitTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class OffersRequest
|
||||||
|
*
|
||||||
|
* @category OffersRequest
|
||||||
|
* @package RetailCrm\Api\Model\Request\Store
|
||||||
|
*/
|
||||||
|
class OffersRequest implements RequestInterface
|
||||||
|
{
|
||||||
|
use PageLimitTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \RetailCrm\Api\Model\Filter\Store\OfferFilterType
|
||||||
|
*
|
||||||
|
* @Form\Type("RetailCrm\Api\Model\Filter\Store\OfferFilterType")
|
||||||
|
* @Form\SerializedName("filter")
|
||||||
|
*/
|
||||||
|
public $filter;
|
||||||
|
}
|
30
src/Model/Response/Store/OffersResponse.php
Normal file
30
src/Model/Response/Store/OffersResponse.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP version 7.3
|
||||||
|
*
|
||||||
|
* @category OffersResponse
|
||||||
|
* @package RetailCrm\Api\Model\Response\Store
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Api\Model\Response\Store;
|
||||||
|
|
||||||
|
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
|
||||||
|
use RetailCrm\Api\Model\Response\AbstractPaginatedResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class OffersResponse
|
||||||
|
*
|
||||||
|
* @category OffersResponse
|
||||||
|
* @package RetailCrm\Api\Model\Response\Store
|
||||||
|
*/
|
||||||
|
class OffersResponse extends AbstractPaginatedResponse
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var \RetailCrm\Api\Model\Entity\Store\StoreOffer[]
|
||||||
|
*
|
||||||
|
* @JMS\Type("array<RetailCrm\Api\Model\Entity\Store\StoreOffer>")
|
||||||
|
* @JMS\SerializedName("offers")
|
||||||
|
*/
|
||||||
|
public $offers;
|
||||||
|
}
|
@ -12,6 +12,7 @@ namespace RetailCrm\Api\ResourceGroup;
|
|||||||
use RetailCrm\Api\Enum\RequestMethod;
|
use RetailCrm\Api\Enum\RequestMethod;
|
||||||
use RetailCrm\Api\Model\Request\Store\InventoriesRequest;
|
use RetailCrm\Api\Model\Request\Store\InventoriesRequest;
|
||||||
use RetailCrm\Api\Model\Request\Store\InventoriesUploadRequest;
|
use RetailCrm\Api\Model\Request\Store\InventoriesUploadRequest;
|
||||||
|
use RetailCrm\Api\Model\Request\Store\OffersRequest;
|
||||||
use RetailCrm\Api\Model\Request\Store\PricesUploadRequest;
|
use RetailCrm\Api\Model\Request\Store\PricesUploadRequest;
|
||||||
use RetailCrm\Api\Model\Request\Store\ProductBatchEditRequest;
|
use RetailCrm\Api\Model\Request\Store\ProductBatchEditRequest;
|
||||||
use RetailCrm\Api\Model\Request\Store\ProductGroupsCreateRequest;
|
use RetailCrm\Api\Model\Request\Store\ProductGroupsCreateRequest;
|
||||||
@ -24,6 +25,7 @@ use RetailCrm\Api\Model\Request\Store\ProductsRequest;
|
|||||||
use RetailCrm\Api\Model\Response\IdResponse;
|
use RetailCrm\Api\Model\Response\IdResponse;
|
||||||
use RetailCrm\Api\Model\Response\Store\InventoriesResponse;
|
use RetailCrm\Api\Model\Response\Store\InventoriesResponse;
|
||||||
use RetailCrm\Api\Model\Response\Store\InventoriesUploadResponse;
|
use RetailCrm\Api\Model\Response\Store\InventoriesUploadResponse;
|
||||||
|
use RetailCrm\Api\Model\Response\Store\OffersResponse;
|
||||||
use RetailCrm\Api\Model\Response\Store\PricesUploadResponse;
|
use RetailCrm\Api\Model\Response\Store\PricesUploadResponse;
|
||||||
use RetailCrm\Api\Model\Response\Store\ProductBatchEditResponse;
|
use RetailCrm\Api\Model\Response\Store\ProductBatchEditResponse;
|
||||||
use RetailCrm\Api\Model\Response\Store\ProductGroupsResponse;
|
use RetailCrm\Api\Model\Response\Store\ProductGroupsResponse;
|
||||||
@ -693,6 +695,68 @@ class Store extends AbstractApiResourceGroup
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes GET "/api/v5/store/offers" request.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* ```php
|
||||||
|
* use RetailCrm\Api\Enum\NumericBoolean;
|
||||||
|
* use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||||
|
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
|
||||||
|
* use RetailCrm\Api\Model\Filter\Store\OfferFilterType;
|
||||||
|
* use RetailCrm\Api\Model\Request\Store\OffersRequest;
|
||||||
|
*
|
||||||
|
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
|
||||||
|
*
|
||||||
|
* $request = new OffersRequest();
|
||||||
|
* $request->filter = new OfferFilterType();
|
||||||
|
* $request->filter->active = NumericBoolean::TRUE;
|
||||||
|
* $request->filter->name = 'Test Offer';
|
||||||
|
*
|
||||||
|
* try {
|
||||||
|
* $response = $client->store->offers($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 'Offers: ' . print_r($response->offers, true);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param \RetailCrm\Api\Model\Request\Store\OffersRequest|null $request
|
||||||
|
*
|
||||||
|
* @return \RetailCrm\Api\Model\Response\Store\OffersResponse
|
||||||
|
* @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface
|
||||||
|
* @throws \RetailCrm\Api\Interfaces\ClientExceptionInterface
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
public function offers(?OffersRequest $request = null): OffersResponse
|
||||||
|
{
|
||||||
|
/** @var OffersResponse $response */
|
||||||
|
$response = $this->sendRequest(
|
||||||
|
RequestMethod::GET,
|
||||||
|
'store/offers',
|
||||||
|
$request,
|
||||||
|
OffersResponse::class
|
||||||
|
);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes GET "/api/v5/store/products/properties/values" request.
|
* Makes GET "/api/v5/store/products/properties/values" request.
|
||||||
*
|
*
|
||||||
|
@ -22,12 +22,14 @@ use RetailCrm\Api\Model\Entity\Store\ProductEditGroupInput;
|
|||||||
use RetailCrm\Api\Model\Entity\Store\ProductEditInput;
|
use RetailCrm\Api\Model\Entity\Store\ProductEditInput;
|
||||||
use RetailCrm\Api\Model\Entity\Store\SerializedProductGroup;
|
use RetailCrm\Api\Model\Entity\Store\SerializedProductGroup;
|
||||||
use RetailCrm\Api\Model\Filter\Store\InventoryFilterType;
|
use RetailCrm\Api\Model\Filter\Store\InventoryFilterType;
|
||||||
|
use RetailCrm\Api\Model\Filter\Store\OfferFilterType;
|
||||||
use RetailCrm\Api\Model\Filter\Store\ProductFilterType;
|
use RetailCrm\Api\Model\Filter\Store\ProductFilterType;
|
||||||
use RetailCrm\Api\Model\Filter\Store\ProductGroupFilterType;
|
use RetailCrm\Api\Model\Filter\Store\ProductGroupFilterType;
|
||||||
use RetailCrm\Api\Model\Filter\Store\ProductPropertiesFilterType;
|
use RetailCrm\Api\Model\Filter\Store\ProductPropertiesFilterType;
|
||||||
use RetailCrm\Api\Model\Filter\Store\ProductPropertyValuesFilterType;
|
use RetailCrm\Api\Model\Filter\Store\ProductPropertyValuesFilterType;
|
||||||
use RetailCrm\Api\Model\Request\Store\InventoriesRequest;
|
use RetailCrm\Api\Model\Request\Store\InventoriesRequest;
|
||||||
use RetailCrm\Api\Model\Request\Store\InventoriesUploadRequest;
|
use RetailCrm\Api\Model\Request\Store\InventoriesUploadRequest;
|
||||||
|
use RetailCrm\Api\Model\Request\Store\OffersRequest;
|
||||||
use RetailCrm\Api\Model\Request\Store\PricesUploadRequest;
|
use RetailCrm\Api\Model\Request\Store\PricesUploadRequest;
|
||||||
use RetailCrm\Api\Model\Request\Store\ProductBatchEditRequest;
|
use RetailCrm\Api\Model\Request\Store\ProductBatchEditRequest;
|
||||||
use RetailCrm\Api\Model\Request\Store\ProductGroupsCreateRequest;
|
use RetailCrm\Api\Model\Request\Store\ProductGroupsCreateRequest;
|
||||||
@ -857,4 +859,101 @@ EOF;
|
|||||||
|
|
||||||
self::assertModelEqualsToResponse($json, $response);
|
self::assertModelEqualsToResponse($json, $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testOffers(): void
|
||||||
|
{
|
||||||
|
$json = <<<'EOF'
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"pagination": {
|
||||||
|
"limit": 20,
|
||||||
|
"totalCount": 1,
|
||||||
|
"currentPage": 1,
|
||||||
|
"totalPageCount": 1
|
||||||
|
},
|
||||||
|
"offers": [
|
||||||
|
{
|
||||||
|
"name": "Test Offer",
|
||||||
|
"images": [
|
||||||
|
"https://example.com/image.jpg"
|
||||||
|
],
|
||||||
|
"id": 1941833,
|
||||||
|
"externalId": "38311",
|
||||||
|
"xmlId": "38311",
|
||||||
|
"article": "38311",
|
||||||
|
"prices": [
|
||||||
|
{
|
||||||
|
"priceType": "base",
|
||||||
|
"price": 624,
|
||||||
|
"ordering": 991
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"purchasePrice": 272.64,
|
||||||
|
"vatRate": "none",
|
||||||
|
"properties": {
|
||||||
|
"ves": "33",
|
||||||
|
"brend": "Test",
|
||||||
|
"image": "https://example.com/image.jpg",
|
||||||
|
"ves_g": "33",
|
||||||
|
"artikul": "38311"
|
||||||
|
},
|
||||||
|
"quantity": 0.0,
|
||||||
|
"weight": 33.0,
|
||||||
|
"active": true,
|
||||||
|
"unit": {
|
||||||
|
"code": "pc",
|
||||||
|
"name": "Штука",
|
||||||
|
"sym": "шт."
|
||||||
|
},
|
||||||
|
"product": {
|
||||||
|
"minPrice": 624,
|
||||||
|
"maxPrice": 624,
|
||||||
|
"id": 828272,
|
||||||
|
"article": "38311",
|
||||||
|
"type": "product",
|
||||||
|
"name": "Test Product",
|
||||||
|
"url": "https://example.com",
|
||||||
|
"imageUrl": "https://example.com/image.jpg",
|
||||||
|
"description": "Test Description",
|
||||||
|
"groups": [
|
||||||
|
{
|
||||||
|
"id": 4050,
|
||||||
|
"externalId": "368"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4154,
|
||||||
|
"externalId": "391"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4279,
|
||||||
|
"externalId": "394"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"externalId": "38311",
|
||||||
|
"manufacturer": "Test",
|
||||||
|
"active": true,
|
||||||
|
"quantity": 0,
|
||||||
|
"markable": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
EOF;
|
||||||
|
|
||||||
|
$request = new OffersRequest();
|
||||||
|
$request->filter = new OfferFilterType();
|
||||||
|
$request->filter->active = NumericBoolean::TRUE;
|
||||||
|
$request->filter->name = 'Test Offer';
|
||||||
|
|
||||||
|
$mock = static::createApiMockBuilder('store/offers');
|
||||||
|
$mock->matchMethod(RequestMethod::GET)
|
||||||
|
->matchQuery(self::encodeFormArray($request))
|
||||||
|
->reply(200)
|
||||||
|
->withBody($json);
|
||||||
|
|
||||||
|
$client = TestClientFactory::createClient($mock->getClient());
|
||||||
|
$response = $client->store->offers($request);
|
||||||
|
|
||||||
|
self::assertModelEqualsToResponse($json, $response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user