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

Update api-client

This commit is contained in:
Кривич Сергей 2022-10-21 15:58:39 +03:00
parent 040cb49d29
commit bbb9af3ac0
38 changed files with 1579 additions and 4300 deletions

View File

@ -420,6 +420,11 @@ parameters:
count: 1
path: src/Handler/Response/FilesDownloadResponseHandler.php
-
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Handler\\\\Response\\\\FilesDownloadResponseHandler\\:\\:isFileRequest\\(\\) through static\\:\\:\\.$#"
count: 1
path: src/Handler/Response/FilesDownloadResponseHandler.php
-
message: "#^Property RetailCrm\\\\Api\\\\Model\\\\ResponseData\\:\\:\\$responseArray \\(array\\<int\\|string, mixed\\>\\) on left side of \\?\\? is not nullable\\.$#"
count: 1

View File

@ -26,7 +26,7 @@ class FilesDownloadResponseHandler extends AbstractResponseHandler
*/
protected function handleResponse(ResponseData $responseData)
{
if (!preg_match('/^\/api\/v5\/files\/\d+\/download$/', $responseData->request->getUri()->getPath())) {
if (!static::isFileRequest($responseData->request->getUri()->getPath())) {
$this->next($responseData);
return;
@ -44,6 +44,29 @@ class FilesDownloadResponseHandler extends AbstractResponseHandler
));
}
/**
* Checking the request path to determine a file request
*
* @param string $path
*
* @return bool
*/
private static function isFileRequest(string $path): bool
{
$filePatterns = [
'#^/api/v5/files/\d+/download$#',
'#^/api/v5/orders/\S+/plates/\d+/print$#',
];
foreach ($filePatterns as $pattern) {
if (preg_match($pattern, $path)) {
return true;
}
}
return false;
}
/**
* Parses filename from a Content-Disposition header value.
*

View File

@ -0,0 +1,38 @@
<?php
/**
* PHP version 7.3
*
* @category ShipmentPointList
* @package RetailCrm\Api\Model\Callback\Entity\Delivery
*/
namespace RetailCrm\Api\Model\Callback\Entity\Delivery;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
use RetailCrm\Api\Model\Entity\References\GeoHierarchyRow;
/**
* Class ShipmentPointList
*
* @category ShipmentPointList
* @package RetailCrm\Api\Model\Callback\Entity\Delivery
*/
class ShipmentPointList extends GeoHierarchyRow
{
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("clientId")
*/
public $clientId;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("code")
*/
public $code;
}

View File

@ -0,0 +1,37 @@
<?php
/**
* PHP version 7.3
*
* @category Settings
* @package RetailCrm\Api\Model\Callback\Entity\Integration
*/
namespace RetailCrm\Api\Model\Callback\Entity\Integration;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/**
* Class Settings
*
* @category Settings
* @package RetailCrm\Api\Model\Callback\Entity\Integration
*/
class Settings
{
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("clientId")
*/
public $clientId;
/**
* @var \RetailCrm\Api\Model\Entity\Settings\Settings
*
* @JMS\Type("RetailCrm\Api\Model\Entity\Settings\Settings")
* @JMS\SerializedName("settings")
*/
public $settings;
}

View File

@ -359,4 +359,12 @@ class Customer implements CustomerInterface
* @JMS\SerializedName("subscribed")
*/
public $subscribed;
/**
* @var \RetailCrm\Api\Model\Entity\Customers\MGCustomer[]
*
* @JMS\Type("array<RetailCrm\Api\Model\Entity\Customers\MGCustomer>")
* @JMS\SerializedName("mgCustomers")
*/
public $mgCustomers;
}

View File

@ -0,0 +1,69 @@
<?php
/**
* PHP version 7.3
*
* @category MGChannel
* @package RetailCrm\Api\Model\Entity\Customers
*/
namespace RetailCrm\Api\Model\Entity\Customers;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/**
* Class MGChannel
*
* @category MGChannel
* @package RetailCrm\Api\Model\Entity\Customers
*/
class MGChannel
{
/**
* @var int
*
* @JMS\Type("int")
* @JMS\SerializedName("id")
*/
public $id;
/**
* @var int
*
* @JMS\Type("int")
* @JMS\SerializedName("externalId")
*/
public $externalId;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("type")
*/
public $type;
/**
* @var bool
*
* @JMS\Type("bool")
* @JMS\SerializedName("active")
*/
public $active;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("name")
*/
public $name;
/**
* @var bool
*
* @JMS\Type("bool")
* @JMS\SerializedName("allowedSendByPhone")
*/
public $allowedSendByPhone;
}

View File

@ -0,0 +1,45 @@
<?php
/**
* PHP version 7.3
*
* @category MGCustomer
* @package RetailCrm\Api\Model\Entity\Customers
*/
namespace RetailCrm\Api\Model\Entity\Customers;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/**
* Class MGCustomer
*
* @category MGCustomer
* @package RetailCrm\Api\Model\Entity\Customers
*/
class MGCustomer
{
/**
* @var int
*
* @JMS\Type("int")
* @JMS\SerializedName("id")
*/
public $id;
/**
* @var int
*
* @JMS\Type("int")
* @JMS\SerializedName("externalId")
*/
public $externalId;
/**
* @var \RetailCrm\Api\Model\Entity\Customers\MGChannel
*
* @JMS\Type("RetailCrm\Api\Model\Entity\Customers\MGChannel")
* @JMS\SerializedName("mgChannel")
*/
public $mgChannel;
}

View File

@ -0,0 +1,29 @@
<?php
/**
* PHP version 7.3
*
* @category EntityWithExternalId
* @package RetailCrm\Api\Model\Entity
*/
namespace RetailCrm\Api\Model\Entity;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/**
* Class EntityWithExternalId
*
* @category EntityWithExternalId
* @package RetailCrm\Api\Model\Entity
*/
class EntityWithExternalId
{
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("externalId")
*/
public $externalId;
}

View File

@ -180,4 +180,12 @@ class DeliveryType
* @JMS\SerializedName("defaultTariffName")
*/
public $defaultTariffName;
/**
* @var \RetailCrm\Api\Model\Entity\References\DeliveryTypePaymentType[]
*
* @JMS\Type("array<RetailCrm\Api\Model\Entity\References\DeliveryTypePaymentType>")
* @JMS\SerializedName("deliveryPaymentTypes")
*/
public $deliveryPaymentTypes;
}

View File

@ -0,0 +1,37 @@
<?php
/**
* PHP version 7.3
*
* @category DeliveryTypePaymentType
* @package RetailCrm\Api\Model\Entity\References
*/
namespace RetailCrm\Api\Model\Entity\References;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/**
* Class DeliveryTypePaymentType
*
* @category DeliveryTypePaymentType
* @package RetailCrm\Api\Model\Entity\References
*/
class DeliveryTypePaymentType
{
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("code")
*/
public $code;
/**
* @var bool
*
* @JMS\Type("bool")
* @JMS\SerializedName("cod")
*/
public $cod;
}

View File

@ -20,6 +20,14 @@ use RetailCrm\Api\Component\Serializer\Annotation as JMS;
*/
class Site
{
/**
* @var int
*
* @JMS\Type("int")
* @JMS\SerializedName("id")
*/
public $id;
/**
* @var string
*

View File

@ -42,4 +42,12 @@ class Settings
* @JMS\SerializedName("timezone")
*/
public $timezone;
/**
* @var \RetailCrm\Api\Model\Entity\Settings\WorkTime
*
* @JMS\Type("array<RetailCrm\Api\Model\Entity\Settings\WorkTime>")
* @JMS\SerializedName("work_times")
*/
public $workTimes;
}

View File

@ -0,0 +1,61 @@
<?php
/**
* PHP version 7.3
*
* @category Value
* @package RetailCrm\Api\Model\Entity\Settings
*/
namespace RetailCrm\Api\Model\Entity\Settings;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/**
* Class WorkTime
*
* @category WorkTime
* @package RetailCrm\Api\Model\Entity\Settings
*/
class WorkTime
{
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("day_type")
*/
public $dayType;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("start_time")
*/
public $startTime;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("end_time")
*/
public $endTime;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("lunch_start_time")
*/
public $lunchStartTime;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("lunch_end_time")
*/
public $lunchEndTime;
}

View File

@ -0,0 +1,133 @@
<?php
/**
* PHP version 7.3
*
* @category ProductCreateInput
* @package RetailCrm\Api\Model\Request\Store
*/
namespace RetailCrm\Api\Model\Entity\Store;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/**
* Abstract class ProductBatchBase
*
* @category ProductBatchBase
* @package RetailCrm\Api\Model\Response\Store
*/
abstract class ProductBatchBase
{
/**
* @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("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 \RetailCrm\Api\Model\Entity\Store\ProductEditGroupInput[]
*
* @JMS\Type("array<RetailCrm\Api\Model\Entity\Store\ProductEditGroupInput>")
* @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 bool
*
* @JMS\Type("bool")
* @JMS\SerializedName("markable")
*/
public $markable;
/**
* @var int
*
* @JMS\Type("int")
* @JMS\SerializedName("catalogId")
*/
public $catalogId;
}

View File

@ -0,0 +1,20 @@
<?php
/**
* PHP version 7.3
*
* @category ProductCreateInput
* @package RetailCrm\Api\Model\Request\Store
*/
namespace RetailCrm\Api\Model\Entity\Store;
/**
* Class ProductCreateInput
*
* @category ProductCreateInput
* @package RetailCrm\Api\Model\Response\Store
*/
class ProductCreateInput extends ProductBatchBase
{
}

View File

@ -17,7 +17,7 @@ use RetailCrm\Api\Component\Serializer\Annotation as JMS;
* @category ProductEditInput
* @package RetailCrm\Api\Model\Response\Store
*/
class ProductEditInput
class ProductEditInput extends ProductBatchBase
{
/**
* @var int
@ -27,110 +27,6 @@ class ProductEditInput
*/
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("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 \RetailCrm\Api\Model\Entity\Store\ProductEditGroupInput[]
*
* @JMS\Type("array<RetailCrm\Api\Model\Entity\Store\ProductEditGroupInput>")
* @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 bool
*
* @JMS\Type("bool")
* @JMS\SerializedName("markable")
*/
public $markable;
/**
* @var string
*
@ -138,12 +34,4 @@ class ProductEditInput
* @JMS\SerializedName("site")
*/
public $site;
/**
* @var int
*
* @JMS\Type("int")
* @JMS\SerializedName("catalogId")
*/
public $catalogId;
}

View File

@ -0,0 +1,77 @@
<?php
/**
* PHP version 7.3
*
* @category SerializedProductGroup
* @package RetailCrm\Api\Model\Entity\Store
*/
namespace RetailCrm\Api\Model\Entity\Store;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/**
* Class SerializedProductGroup
*
* @category SerializedProductGroup
* @package RetailCrm\Api\Model\Entity\Store
*/
class SerializedProductGroup
{
/**
* @var int
*
* @JMS\Type("int")
* @JMS\SerializedName("parentId")
*/
public $parentId;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("name")
*/
public $name;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("description")
*/
public $description;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("externalId")
*/
public $externalId;
/**
* @var bool
*
* @JMS\Type("bool")
* @JMS\SerializedName("active")
*/
public $active;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("parentExternalId")
*/
public $parentExternalId;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("site")
*/
public $site;
}

View File

@ -66,4 +66,12 @@ class CustomFieldFilter
* @Form\SerializedName("entity")
*/
public $entity;
/**
* @var int
*
* @Form\Type("int")
* @Form\SerializedName("inFilter")
*/
public $inFilter;
}

View File

@ -17,6 +17,7 @@ use RetailCrm\Api\Interfaces\RequestInterface;
*
* @category BySiteRequest
* @package RetailCrm\Api\Model\Request
* @SuppressWarnings(PHPMD.ShortVariable)
*/
class BySiteRequest implements RequestInterface
{

View File

@ -0,0 +1,38 @@
<?php
/**
* PHP 7.3
*
* @category OrderDeliveryCancelRequest
* @package RetailCrm\Api\Model\Request\Orders
*/
namespace RetailCrm\Api\Model\Request\Orders;
use RetailCrm\Api\Component\FormData\Mapping as Form;
use RetailCrm\Api\Interfaces\RequestInterface;
/**
* Class OrderDeliveryCancelRequest
*
* @category OrderDeliveryCancelRequest
* @package RetailCrm\Api\Model\Request\Orders
*/
class OrderDeliveryCancelRequest implements RequestInterface
{
/**
* @var string
*
* @Form\Type("string")
* @Form\SerializedName("by")
*/
public $by;
/**
* @var bool
*
* @Form\Type("bool")
* @Form\SerializedName("force")
*/
public $force;
}

View File

@ -0,0 +1,37 @@
<?php
/**
* PHP version 7.3
*
* @category ProductGroupsCreateRequest
* @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\Entity\Store\SerializedProductGroup;
/**
* Class ProductGroupsCreateRequest
*
* @category ProductGroupsCreateRequest
* @package RetailCrm\Api\Model\Request\Store
*/
class ProductGroupsCreateRequest implements RequestInterface
{
/**
* @var \RetailCrm\Api\Model\Entity\Store\SerializedProductGroup
*
* @Form\Type("RetailCrm\Api\Model\Entity\Store\SerializedProductGroup")
* @Form\SerializedName("productGroup")
* @Form\JsonField()
*/
public $productGroup;
public function __construct(SerializedProductGroup $productGroup)
{
$this->productGroup = $productGroup;
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* PHP version 7.3
*
* @category ProductGroupsEditRequest
* @package RetailCrm\Api\Model\Request\Store
*/
namespace RetailCrm\Api\Model\Request\Store;
use RetailCrm\Api\Component\FormData\Mapping as Form;
use RetailCrm\Api\Model\Entity\Store\SerializedProductGroup;
use RetailCrm\Api\Model\Request\BySiteRequest;
/**
* Class ProductGroupsEditRequest
*
* @category ProductGroupsEditRequest
* @package RetailCrm\Api\Model\Request\Store
* @SuppressWarnings(PHPMD.ShortVariable)
*/
class ProductGroupsEditRequest extends BySiteRequest
{
/**
* @var \RetailCrm\Api\Model\Entity\Store\SerializedProductGroup
*
* @Form\Type("RetailCrm\Api\Model\Entity\Store\SerializedProductGroup")
* @Form\SerializedName("productGroup")
* @Form\JsonField()
*/
public $productGroup;
/**
* ProductGroupsEditRequest constructor.
*
* @param SerializedProductGroup $productGroup
* @param string $by
* @param string $site
*/
public function __construct(SerializedProductGroup $productGroup, string $by = '', string $site = '')
{
$this->productGroup = $productGroup;
parent::__construct($by, $site);
}
}

View File

@ -0,0 +1,43 @@
<?php
/**
* PHP version 7.3
*
* @category ProductsBatchCreateRequest
* @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;
/**
* Class ProductsBatchCreateRequest
*
* @category ProductsBatchCreateRequest
* @package RetailCrm\Api\Model\Response\Store
*/
class ProductsBatchCreateRequest implements RequestInterface
{
/**
* @var \RetailCrm\Api\Model\Entity\Store\ProductCreateInput[]
*
* @Form\Type("RetailCrm\Api\Model\Entity\Store\ProductCreateInput[]")
* @Form\SerializedName("products")
* @Form\JsonField()
*/
public $products;
/**
* ProductsBatchCreateRequest constructor.
*
* @param \RetailCrm\Api\Model\Entity\Store\ProductCreateInput[] $products
*/
public function __construct(array $products = [])
{
if (count($products) > 0) {
$this->products = $products;
}
}
}

View File

@ -27,4 +27,12 @@ class CustomersUploadResponse extends SuccessResponse
* @JMS\SerializedName("uploadedCustomers")
*/
public $uploadedCustomers;
/**
* @var \RetailCrm\Api\Model\Entity\EntityWithExternalId[]
*
* @JMS\Type("array<RetailCrm\Api\Model\Entity\EntityWithExternalId>")
* @JMS\SerializedName("failedCustomers")
*/
public $failedCustomers;
}

View File

@ -43,4 +43,12 @@ class OrdersUploadResponse extends SuccessResponse
* @JMS\SerializedName("orders")
*/
public $orders;
/**
* @var \RetailCrm\Api\Model\Entity\EntityWithExternalId[]
*
* @JMS\Type("array<RetailCrm\Api\Model\Entity\EntityWithExternalId>")
* @JMS\SerializedName("failedOrders")
*/
public $failedOrders;
}

View File

@ -0,0 +1,39 @@
<?php
/**
* PHP version 7.3
*
* @category ProductsBatchCreateResponse
* @package RetailCrm\Api\Model\Request\Store
*/
namespace RetailCrm\Api\Model\Response\Store;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
use RetailCrm\Api\Model\Response\SuccessResponse;
/**
* Class ProductsBatchCreateResponse
*
* @category ProductBatchEditResponse
* @package RetailCrm\Api\Model\Response\Store
* @SuppressWarnings(PHPMD.LongVariable)
*/
class ProductsBatchCreateResponse extends SuccessResponse
{
/**
* @var int
*
* @JMS\Type("int")
* @JMS\SerializedName("processedProductsCount")
*/
public $processedProductsCount;
/**
* @var array<int>
*
* @JMS\Type("array<int>")
* @JMS\SerializedName("addedProducts")
*/
public $addedProducts;
}

View File

@ -11,6 +11,7 @@ namespace RetailCrm\Api\ResourceGroup;
use RetailCrm\Api\Enum\RequestMethod;
use RetailCrm\Api\Model\Request\BySiteRequest;
use RetailCrm\Api\Model\Request\Orders\OrderDeliveryCancelRequest;
use RetailCrm\Api\Model\Request\Orders\OrderLoyaltyCancelBonusOperationsRequest;
use RetailCrm\Api\Model\Request\Orders\OrdersCombineRequest;
use RetailCrm\Api\Model\Request\Orders\OrdersCreateRequest;
@ -23,6 +24,7 @@ use RetailCrm\Api\Model\Request\Orders\OrdersPaymentsCreateRequest;
use RetailCrm\Api\Model\Request\Orders\OrdersRequest;
use RetailCrm\Api\Model\Request\Orders\OrdersStatusesRequest;
use RetailCrm\Api\Model\Request\Orders\OrdersUploadRequest;
use RetailCrm\Api\Model\Response\Files\FilesDownloadResponse;
use RetailCrm\Api\Model\Response\IdResponse;
use RetailCrm\Api\Model\Response\Orders\OrdersCombineResponse;
use RetailCrm\Api\Model\Response\Orders\OrdersCreateResponse;
@ -1105,4 +1107,118 @@ class Orders extends AbstractApiResourceGroup
);
return $response;
}
/**
* Makes POST "/api/v5/orders/{externalId}/delivery/cancel" request.
*
* Example:
* ```php
* use RetailCrm\Api\Enum\ByIdentifier;
* use RetailCrm\Api\Factory\SimpleClientFactory;
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
* use RetailCrm\Api\Model\Request\Orders\OrderDeliveryCancelRequest;
*
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
*
* $request = new OrderDeliveryCancelRequest();
* $request->by = ByIdentifier::EXTERNAL_ID;
* $request->force = true;
*
* try {
* $response = $client->orders->deliveryCancel('8123522898559160', $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 'Order delivery cancel result: ' . print_r($response->success, true);
* ```
*
* @param int|string $identifier
* @param OrderDeliveryCancelRequest $request
*
* @return SuccessResponse
* @throws \RetailCrm\Api\Exception\ApiException
* @throws \RetailCrm\Api\Exception\ClientException
* @throws \RetailCrm\Api\Exception\Client\HandlerException
* @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface
*/
public function deliveryCancel($identifier, OrderDeliveryCancelRequest $request): SuccessResponse
{
/** @var SuccessResponse $response */
$response = $this->sendRequest(
RequestMethod::POST,
'orders/' . $identifier . '/delivery/cancel',
$request,
SuccessResponse::class
);
return $response;
}
/**
* Makes GET "/api/v5/orders/{externalId}/plates/{plateId}/print" request.
*
* Example:
* ```php
* use RetailCrm\Api\Factory\SimpleClientFactory;
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
* use RetailCrm\Api\Model\Request\BySiteRequest;
*
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
*
* try {
* $request = new BySiteRequest();
* $request = new BySiteRequest('id', 'gray_sale_ym');
*
* $response = $client->orders->platesPrint(100, 18, $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;
* }
*
* printf('Saving downloaded file to "%s."', $response->fileName);
* file_put_contents($response->fileName, $response->data->getContents());
* ```
*
* @param string|int $identifier
* @param int $plateId
* @param BySiteRequest $request
*
* @return FilesDownloadResponse
* @throws \RetailCrm\Api\Exception\ApiException
* @throws \RetailCrm\Api\Exception\ClientException
* @throws \RetailCrm\Api\Exception\Client\HandlerException
* @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface
*/
public function platesPrint($identifier, int $plateId, BySiteRequest $request): FilesDownloadResponse
{
/** @var FilesDownloadResponse $response */
$response = $this->sendRequest(
RequestMethod::GET,
'orders/' . $identifier . '/plates/' . $plateId . '/print',
$request,
''
);
return $response;
}
}

View File

@ -14,15 +14,20 @@ use RetailCrm\Api\Model\Request\Store\InventoriesRequest;
use RetailCrm\Api\Model\Request\Store\InventoriesUploadRequest;
use RetailCrm\Api\Model\Request\Store\PricesUploadRequest;
use RetailCrm\Api\Model\Request\Store\ProductBatchEditRequest;
use RetailCrm\Api\Model\Request\Store\ProductGroupsCreateRequest;
use RetailCrm\Api\Model\Request\Store\ProductGroupsEditRequest;
use RetailCrm\Api\Model\Request\Store\ProductGroupsRequest;
use RetailCrm\Api\Model\Request\Store\ProductPropertiesRequest;
use RetailCrm\Api\Model\Request\Store\ProductsBatchCreateRequest;
use RetailCrm\Api\Model\Request\Store\ProductsRequest;
use RetailCrm\Api\Model\Response\IdResponse;
use RetailCrm\Api\Model\Response\Store\InventoriesResponse;
use RetailCrm\Api\Model\Response\Store\InventoriesUploadResponse;
use RetailCrm\Api\Model\Response\Store\PricesUploadResponse;
use RetailCrm\Api\Model\Response\Store\ProductBatchEditResponse;
use RetailCrm\Api\Model\Response\Store\ProductGroupsResponse;
use RetailCrm\Api\Model\Response\Store\ProductPropertiesResponse;
use RetailCrm\Api\Model\Response\Store\ProductsBatchCreateResponse;
use RetailCrm\Api\Model\Response\Store\ProductsResponse;
/**
@ -292,6 +297,127 @@ class Store extends AbstractApiResourceGroup
return $response;
}
/**
* Makes POST "/api/v5/store/product-groups/create" request.
*
* Example:
* ```php
* use RetailCrm\Api\Model\Entity\Store\SerializedProductGroup;
* use RetailCrm\Api\Model\Request\Store\ProductGroupsCreateRequest;
* use RetailCrm\Api\Factory\SimpleClientFactory;
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
*
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
*
* $productGroup = new SerializedProductGroup();
* $productGroup->parentId = 100;
* $productGroup->name = 'TestGroup';
* $productGroup->description = 'Test group of products';
* $productGroup->externalId = 'xxx-001';
* $productGroup->active = true;
* $productGroup->parentExternalId = 'xxx-000';
* $productGroup->site = 'test_site';
*
* try {
* $response = $client->store->productGroupsCreate(new ProductGroupsCreateRequest($productGroup));
* } 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 'Product group create result: ' . $response->success;
* echo 'Product group id: ' . $response->id;
* ```
*
* @param ProductGroupsCreateRequest $request
*
* @return IdResponse
* @throws \RetailCrm\Api\Exception\ApiException
* @throws \RetailCrm\Api\Exception\ClientException
* @throws \RetailCrm\Api\Exception\Client\HandlerException
* @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface
*/
public function productGroupsCreate(ProductGroupsCreateRequest $request): IdResponse
{
/** @var IdResponse $response */
$response = $this->sendRequest(
RequestMethod::POST,
'store/product-groups/create',
$request,
IdResponse::class
);
return $response;
}
/**
* Makes POST "/api/v5/store/product-groups/{externalId}/edit" request.
*
* Example:
* ```php
* use RetailCrm\Api\Model\Entity\Store\SerializedProductGroup;
* use RetailCrm\Api\Model\Request\Store\ProductGroupsEditRequest;
* use RetailCrm\Api\Factory\SimpleClientFactory;
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
*
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
*
* $productGroup = new SerializedProductGroup();
* $productGroup->name = 'TestGroup';
* $productGroup->description = 'Test group of products';
* $productGroup->externalId = 'xxx-001';
* $productGroup->active = true;
*
* try {
* $response = $client->store->productGroupsEdit(
* 111,
* new ProductGroupsEditRequest($productGroup, 'externalId', 'test_site')
* );
* } 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 'Product group create result: ' . $response->success;
* echo 'Product group id: ' . $response->id;
* ```
*
* @param string|int $identifier
* @param ProductGroupsEditRequest $request
*
* @return IdResponse
* @throws \RetailCrm\Api\Exception\ApiException
* @throws \RetailCrm\Api\Exception\ClientException
* @throws \RetailCrm\Api\Exception\Client\HandlerException
* @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface
*/
public function productGroupsEdit($identifier, ProductGroupsEditRequest $request): IdResponse
{
/** @var IdResponse $response */
$response = $this->sendRequest(
RequestMethod::POST,
'store/product-groups/' . $identifier . '/edit',
$request,
IdResponse::class
);
return $response;
}
/**
* Makes GET "/api/v5/store/products" request.
*
@ -417,7 +543,7 @@ class Store extends AbstractApiResourceGroup
}
/**
* Makes GET "/api/v5/store/store/products/batch/edit" request.
* Makes POST "/api/v5/store/store/products/batch/edit" request.
*
* Example:
* ```php
@ -492,4 +618,74 @@ class Store extends AbstractApiResourceGroup
return $response;
}
/**
* Makes POST "/api/v5/store/products/batch/create" request.
*
* Example:
* ```php
* use RetailCrm\Api\Model\Entity\Store\ProductEditGroupInput;
* use RetailCrm\Api\Model\Entity\Store\ProductCreateInput;
* use RetailCrm\Api\Model\Request\Store\ProductsBatchCreateRequest;
* use RetailCrm\Api\Factory\SimpleClientFactory;
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
*
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
*
* $productInput = new ProductCreateInput();
* $productInput->name = 'testName';
* $productInput->description = 'testDescription';
* $productInput->active = true;
* $productInput->url = 'testUrl';
* $productInput->article = 'testArticle';
* $productInput->catalogId = 10;
* $productInput->externalId = 'testExternalId';
* $productInput->manufacturer = 'testManufacturer';
* $productInput->markable = true;
* $productInput->novelty = true;
* $productInput->popular = true;
* $productInput->recommended = true;
* $productInput->stock = true;
* $productEditGroupInput = new ProductEditGroupInput();
* $productEditGroupInput->externalId = 'testExternalId';
* $productEditGroupInput->id = 10;
* $productInput->groups[] = $productEditGroupInput;
*
* try {
* $response = $client->store->productsBatchCreate(new ProductsBatchCreateRequest([$productInput]));
* } 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 'Processed product count: ' . $response->processedProductsCount;
* ```
*
* @param ProductsBatchCreateRequest $request
*
* @return ProductsBatchCreateResponse
* @throws \RetailCrm\Api\Exception\ApiException
* @throws \RetailCrm\Api\Exception\ClientException
* @throws \RetailCrm\Api\Exception\Client\HandlerException
* @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface
*/
public function productsBatchCreate(ProductsBatchCreateRequest $request): ProductsBatchCreateResponse
{
/** @var ProductsBatchCreateResponse $response */
$response = $this->sendRequest(
RequestMethod::POST,
'store/products/batch/create',
$request,
ProductsBatchCreateResponse::class
);
return $response;
}
}

View File

@ -0,0 +1,65 @@
<?php
/**
* PHP version 7.3
*
* @category FilesDownloadResponseHandlerTest
* @package RetailCrm\Tests\Handler\Response
*/
namespace RetailCrm\Tests\Handler\Response;
use PHPUnit\Framework\TestCase;
use ReflectionClass;
use ReflectionException;
use RetailCrm\Api\Handler\Response\FilesDownloadResponseHandler;
/**
* Class FilesDownloadResponseHandlerTest
*
* @category CallbackResponseHandlerTest
* @package RetailCrm\Tests\Handler\Response
*/
class FilesDownloadResponseHandlerTest extends TestCase
{
/**
* @dataProvider pathProvider
*
* @return void
* @throws ReflectionException
*/
public function testIsFileRequest(string $path, bool $expectation): void
{
$handlerMock = $this->createMock(FilesDownloadResponseHandler::class);
$class = new ReflectionClass(FilesDownloadResponseHandler::class);
$method = $class->getMethod('isFileRequest');
$method->setAccessible(true);
$result = $method->invoke($handlerMock, $path);
static::assertEquals($expectation, $result);
}
public function pathProvider(): array
{
return [
[
'/api/v5/files/111/download',
true,
],
[
'/api/v5/orders/xxx-001/plates/11231/print',
true,
],
[
'/api/v5/orders/222/edit',
false,
],
[
'/api/v5/files/upload',
false,
],
];
}
}

View File

@ -0,0 +1,44 @@
<?php
/**
* PHP version 7.3
*
* @category ShipmentPointListTest
* @package RetailCrm\Tests\Model\Callback\Entity\Delivery
*/
namespace RetailCrm\Tests\Model\Callback\Entity\Delivery;
use PHPUnit\Framework\TestCase;
use RetailCrm\Api\Factory\SerializerFactory;
use RetailCrm\Api\Model\Callback\Entity\Delivery\ShipmentPointList;
/**
* Class ShipmentPointListTest
*
* @category ShipmentPointListTest
* @package RetailCrm\Tests\Model\Callback\Entity\Delivery
*/
class ShipmentPointListTest extends TestCase
{
public function testDeserialize(): void
{
/** @var ShipmentPointList $pointList */
$pointList = SerializerFactory::create()->fromArray(
[
'clientId' => '1111',
'country' => 'RU',
'region' => 'big-area',
'regionId' => 112,
'city' => 'small-town',
'cityId' => 25,
'code' => 'warehouse',
],
ShipmentPointList::class
);
static::assertInstanceOf(ShipmentPointList::class, $pointList);
static::assertEquals('1111', $pointList->clientId);
static::assertEquals('warehouse', $pointList->code);
}
}

View File

@ -0,0 +1,57 @@
<?php
/**
* PHP version 7.3
*
* @category SettingsTest
* @package RetailCrm\Tests\Model\Callback\Entity\Integration
*/
namespace RetailCrm\Tests\Model\Callback\Entity\Integration;
use PHPUnit\Framework\TestCase;
use RetailCrm\Api\Factory\SerializerFactory;
use RetailCrm\Api\Model\Entity\Settings\Settings as SystemSettings;
use RetailCrm\Api\Model\Callback\Entity\Integration\Settings;
use RetailCrm\Api\Model\Entity\Settings\Value;
use RetailCrm\Api\Model\Entity\Settings\WorkTime;
/**
* Class SettingsTest
*
* @category SettingsTest
* @package RetailCrm\Tests\Model\Callback\Entity\Integration
*/
class SettingsTest extends TestCase
{
public function testDeserialize(): void
{
/** @var Settings $settings */
$settings = SerializerFactory::create()->fromArray(
[
'clientId' => '333',
'settings' => [
"default_currency" => [
"value" => "RUB",
"updated_at" => "2020-12-02 14:54:16",
],
'work_times' => [
[
"day_type" => "Sunday",
"start_time" => "00:00",
"end_time" => "12:00",
"lunch_start_time" => "04:30",
"lunch_end_time" => "05:00",
],
],
],
],
Settings::class
);
self::assertInstanceOf(Settings::class, $settings);
self::assertInstanceOf(SystemSettings::class, $settings->settings);
self::assertInstanceOf(Value::class, $settings->settings->defaultCurrency);
self::assertInstanceOf(WorkTime::class, $settings->settings->workTimes[0]);
}
}

View File

@ -73,6 +73,7 @@ EOF;
$request->filter->type = ['string'];
$request->filter->code = 'bonus';
$request->filter->name = 'бонус';
$request->filter->inFilter = 1;
$mock = static::createApiMockBuilder('custom-fields');
$mock->matchMethod(RequestMethod::GET)

View File

@ -643,7 +643,15 @@ EOF;
"uploadedCustomers": [{
"id": 1,
"externalId": "test_20"
}]
}],
"failedCustomers": [
{
"externalId": "100"
},
{
"externalId": "101"
}
]
}
EOF;

View File

@ -177,6 +177,20 @@ class CustomersTest extends AbstractApiResourceGroupTestCase
{
"number": "89229112322"
}
],
"mgCustomers": [
{
"id": 1,
"externalId": 100,
"mgChannel": {
"id": 1,
"externalId": 100,
"type": "experimental",
"active": true,
"name": "CursedApp",
"allowedSendByPhone": false
}
}
]
}
]
@ -2471,7 +2485,15 @@ EOF;
"uploadedCustomers": [{
"id": 1,
"externalId": "test_10"
}]
}],
"failedCustomers": [
{
"externalId": "100"
},
{
"externalId": "101"
}
]
}
EOF;
@ -2635,6 +2657,20 @@ EOF;
{
"number": "+79094055044"
}
],
"mgCustomers": [
{
"id": 1,
"externalId": 100,
"mgChannel": {
"id": 1,
"externalId": 100,
"type": "experimental",
"active": true,
"name": "CursedApp",
"allowedSendByPhone": false
}
}
]
}
}

View File

@ -36,6 +36,7 @@ use RetailCrm\Api\Model\Entity\Orders\SerializedRelationCustomer;
use RetailCrm\Api\Model\Filter\Orders\OrderFilter;
use RetailCrm\Api\Model\Filter\Orders\OrderHistoryFilterV4Type;
use RetailCrm\Api\Model\Request\BySiteRequest;
use RetailCrm\Api\Model\Request\Orders\OrderDeliveryCancelRequest;
use RetailCrm\Api\Model\Request\Orders\OrderLoyaltyCancelBonusOperationsRequest;
use RetailCrm\Api\Model\Request\Orders\OrdersCombineRequest;
use RetailCrm\Api\Model\Request\Orders\OrdersCreateRequest;
@ -8072,7 +8073,15 @@ EOF;
"test_number": 0,
"otpravit_dozakaz": false
}
}]
}],
"failedOrders": [
{
"externalId": "100"
},
{
"externalId": "101"
}
]
}
EOF;
@ -8837,4 +8846,49 @@ EOF;
self::assertModelEqualsToResponse($json, $response);
}
public function testDeliveryCancel(): void
{
$json = <<<'EOF'
{
"success": true
}
EOF;
$request = new OrderDeliveryCancelRequest();
$request->by = 'externalId';
$request->force = true;
$mock = static::createApiMockBuilder('orders/1/delivery/cancel');
$mock->matchMethod(RequestMethod::POST)
->matchBody(static::encodeForm($request))
->reply(200)
->withBody($json);
$client = TestClientFactory::createClient($mock->getClient());
$response = $client->orders->deliveryCancel('1', $request);
self::assertModelEqualsToResponse($json, $response);
}
public function testPlatesPrint(): void
{
$fileData = 'test data';
$request = new BySiteRequest();
$request->by = 'id';
$request->site = 'gray_site';
$mock = static::createApiMockBuilder('orders/100/plates/18/print');
$mock->matchMethod(RequestMethod::GET)
->matchQuery(static::encodeFormArray($request))
->reply(200)
->withHeader('Content-Disposition', 'attachment; filename="filename.pdf"')
->withBody($fileData);
$client = TestClientFactory::createClient($mock->getClient());
$response = $client->orders->platesPrint(100, 18, $request);
self::assertEquals('filename.pdf', $response->fileName);
self::assertEquals($fileData, $response->data->getContents());
}
}

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,23 @@ class SettingsTest extends AbstractApiResourceGroupTestCase
"timezone": {
"value": "Europe/Moscow",
"updated_at": "2021-02-08 08:29:40"
}
},
"work_times": [
{
"day_type": "Sunday",
"start_time": "00:00",
"end_time": "12:00",
"lunch_start_time": "04:30",
"lunch_end_time": "05:00"
},
{
"day_type": "Monday",
"start_time": "08:00",
"end_time": "20:30",
"lunch_start_time": "12:30",
"lunch_end_time": "13:00"
}
]
}
}
EOF;

View File

@ -16,8 +16,10 @@ use RetailCrm\Api\Model\Entity\Store\Inventory;
use RetailCrm\Api\Model\Entity\Store\Offer;
use RetailCrm\Api\Model\Entity\Store\PriceUploadInput;
use RetailCrm\Api\Model\Entity\Store\PriceUploadPricesInput;
use RetailCrm\Api\Model\Entity\Store\ProductCreateInput;
use RetailCrm\Api\Model\Entity\Store\ProductEditGroupInput;
use RetailCrm\Api\Model\Entity\Store\ProductEditInput;
use RetailCrm\Api\Model\Entity\Store\SerializedProductGroup;
use RetailCrm\Api\Model\Filter\Store\InventoryFilterType;
use RetailCrm\Api\Model\Filter\Store\ProductFilterType;
use RetailCrm\Api\Model\Filter\Store\ProductGroupFilterType;
@ -26,8 +28,11 @@ use RetailCrm\Api\Model\Request\Store\InventoriesRequest;
use RetailCrm\Api\Model\Request\Store\InventoriesUploadRequest;
use RetailCrm\Api\Model\Request\Store\PricesUploadRequest;
use RetailCrm\Api\Model\Request\Store\ProductBatchEditRequest;
use RetailCrm\Api\Model\Request\Store\ProductGroupsCreateRequest;
use RetailCrm\Api\Model\Request\Store\ProductGroupsEditRequest;
use RetailCrm\Api\Model\Request\Store\ProductGroupsRequest;
use RetailCrm\Api\Model\Request\Store\ProductPropertiesRequest;
use RetailCrm\Api\Model\Request\Store\ProductsBatchCreateRequest;
use RetailCrm\Api\Model\Request\Store\ProductsRequest;
use RetailCrm\TestUtils\Factory\TestClientFactory;
use RetailCrm\TestUtils\TestCase\AbstractApiResourceGroupTestCase;
@ -667,4 +672,107 @@ EOF;
self::assertModelEqualsToResponse($json, $response);
}
public function testProductBatchCreate(): void
{
$json = <<<'EOF'
{
"success": true,
"processedProductsCount": 1,
"addedProducts": [
100
]
}
EOF;
$productInput = new ProductCreateInput();
$productInput->name = 'testName4';
$productInput->description = 'testDescription';
$productInput->active = true;
$productInput->url = 'url';
$productInput->article = 'testArticle';
$productInput->catalogId = 110;
$productInput->externalId = 'testExternalId4';
$productInput->manufacturer = 'testManufacturer';
$productInput->markable = true;
$productInput->novelty = true;
$productInput->popular = true;
$productInput->recommended = true;
$productInput->stock = true;
$productEditGroupInput = new ProductEditGroupInput();
$productEditGroupInput->id = 9717;
$productInput->groups[] = $productEditGroupInput;
$request = new ProductsBatchCreateRequest([$productInput]);
$mock = static::createApiMockBuilder('store/products/batch/create');
$mock->matchMethod(RequestMethod::POST)
->matchBody(self::encodeForm($request))
->reply(200)
->withBody($json);
$client = TestClientFactory::createClient($mock->getClient());
$response = $client->store->productsBatchCreate($request);
self::assertModelEqualsToResponse($json, $response);
}
public function testProductGroupsCreate(): void
{
$json = <<<'EOF'
{
"success": true,
"id": 9740
}
EOF;
$productGroup = new SerializedProductGroup();
$productGroup->parentId = 100;
$productGroup->name = 'TestGroup';
$productGroup->description = 'Test group of products';
$productGroup->externalId = 'xxx-001';
$productGroup->active = true;
$productGroup->site = 'gray_sale_2';
$request = new ProductGroupsCreateRequest($productGroup);
$mock = static::createApiMockBuilder('store/product-groups/create');
$mock->matchMethod(RequestMethod::POST)
->matchBody(self::encodeForm($request))
->reply(200)
->withBody($json);
$client = TestClientFactory::createClient($mock->getClient());
$response = $client->store->productGroupsCreate($request);
self::assertModelEqualsToResponse($json, $response);
}
public function testProductGroupsEdit(): void
{
$json = <<<'EOF'
{
"success": true,
"id": 9740
}
EOF;
$productGroup = new SerializedProductGroup();
$productGroup->name = 'TestGroup edit';
$productGroup->description = 'Test group of products edit';
$productGroup->externalId = 'xxx-001-edit';
$productGroup->active = true;
$request = new ProductGroupsEditRequest($productGroup, 'id', 'gray_sale_2');
$mock = static::createApiMockBuilder('store/product-groups/9740/edit');
$mock->matchMethod(RequestMethod::POST)
->matchBody(self::encodeForm($request))
->reply(200)
->withBody($json);
$client = TestClientFactory::createClient($mock->getClient());
$response = $client->store->productGroupsEdit(9740, $request);
self::assertModelEqualsToResponse($json, $response);
}
}