1
0
mirror of synced 2024-11-23 13:56:08 +03:00
bitrix-module/intaro.retailcrm/lib/component/apiclient/traits/ordertrait.php
Сергей Чазов 34e8105583
Loyalty (#241)
* Loyalty program
* fix dot bug for shops-exoprt option
* delete credantials request from services
* add CurlException for credentials catch
* add catching CurlException
* edit error msgs
* add supportind double bonuses
* add any step for bonus-input field in sale.order.ajax template
* recalculate bonuses
* fix bonus rounded
* strtoupper for params in icml
* change delivery service code
2022-03-02 15:40:53 +03:00

63 lines
2.0 KiB
PHP

<?php
/**
* PHP version 7.1
*
* @category Integration
* @package Intaro\RetailCrm\Component\ApiClient\Traits
* @author RetailCRM <integration@retailcrm.ru>
* @license MIT
* @link http://retailcrm.ru
* @see http://retailcrm.ru/docs
*/
namespace Intaro\RetailCrm\Component\ApiClient\Traits;
use Intaro\RetailCrm\Component\Json\Deserializer;
use Intaro\RetailCrm\Model\Api\Response\OrdersCreateResponse;
use Intaro\RetailCrm\Model\Api\Response\OrdersEditResponse;
use Intaro\RetailCrm\Model\Api\Response\OrdersGetResponse;
/**
* Trait OrderTrait
* @package Intaro\RetailCrm\Component\ApiClient\Traits
*/
trait OrderTrait
{
/**
* @param array $request
* @param string|null $site
* @return \Intaro\RetailCrm\Model\Api\Response\OrdersCreateResponse|null
*/
public function createOrder(array $request, string $site = null): ?OrdersCreateResponse
{
$response = $this->client->ordersCreate($request, 'externalId', $site);
return Deserializer::deserializeArray($response->getResponseBody(), OrdersCreateResponse::class);
}
/**
* @param array $request
* @param string|null $site
* @return \Intaro\RetailCrm\Model\Api\Response\OrdersEditResponse|null
*/
public function editOrder(array $request, string $site = null): ?OrdersEditResponse
{
$response = $this->client->ordersEdit($request, 'externalId', $site);
return Deserializer::deserializeArray($response->getResponseBody(), OrdersEditResponse::class);
}
/**
* @param int $orderId
* @param string|null $site
* @return \Intaro\RetailCrm\Model\Api\Response\OrdersGetResponse|null
*/
public function getOrder(int $orderId, string $site = null): ?OrdersGetResponse
{
$response = $this->client->ordersGet($orderId, 'externalId', $site);
return Deserializer::deserializeArray($response->getResponseBody(), OrdersGetResponse::class);
}
}