Add a method to create links between orders (#198)
This commit is contained in:
parent
cbf5237689
commit
8ea13cbbcb
1 changed files with 33 additions and 5 deletions
|
@ -12,6 +12,7 @@
|
||||||
namespace RetailCrm\Methods\V5;
|
namespace RetailCrm\Methods\V5;
|
||||||
|
|
||||||
use RetailCrm\Methods\V4\Orders as Previous;
|
use RetailCrm\Methods\V4\Orders as Previous;
|
||||||
|
use RetailCrm\Response\ApiResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHP version 5.4
|
* PHP version 5.4
|
||||||
|
@ -32,7 +33,7 @@ trait Orders
|
||||||
* @param array $resultOrder result order
|
* @param array $resultOrder result order
|
||||||
* @param string $technique combining technique
|
* @param string $technique combining technique
|
||||||
*
|
*
|
||||||
* @return \RetailCrm\Response\ApiResponse
|
* @return ApiResponse
|
||||||
*/
|
*/
|
||||||
public function ordersCombine($order, $resultOrder, $technique = 'ours')
|
public function ordersCombine($order, $resultOrder, $technique = 'ours')
|
||||||
{
|
{
|
||||||
|
@ -72,7 +73,7 @@ trait Orders
|
||||||
* @throws \RetailCrm\Exception\CurlException
|
* @throws \RetailCrm\Exception\CurlException
|
||||||
* @throws \RetailCrm\Exception\InvalidJsonException
|
* @throws \RetailCrm\Exception\InvalidJsonException
|
||||||
*
|
*
|
||||||
* @return \RetailCrm\Response\ApiResponse
|
* @return ApiResponse
|
||||||
*/
|
*/
|
||||||
public function ordersPaymentCreate(array $payment, $site = null)
|
public function ordersPaymentCreate(array $payment, $site = null)
|
||||||
{
|
{
|
||||||
|
@ -100,7 +101,7 @@ trait Orders
|
||||||
* @param string $by by key
|
* @param string $by by key
|
||||||
* @param null $site site code
|
* @param null $site site code
|
||||||
*
|
*
|
||||||
* @return \RetailCrm\Response\ApiResponse
|
* @return ApiResponse
|
||||||
*/
|
*/
|
||||||
public function ordersPaymentEdit(array $payment, $by = 'id', $site = null)
|
public function ordersPaymentEdit(array $payment, $by = 'id', $site = null)
|
||||||
{
|
{
|
||||||
|
@ -134,7 +135,7 @@ trait Orders
|
||||||
*
|
*
|
||||||
* @param string $id payment id
|
* @param string $id payment id
|
||||||
*
|
*
|
||||||
* @return \RetailCrm\Response\ApiResponse
|
* @return ApiResponse
|
||||||
*/
|
*/
|
||||||
public function ordersPaymentDelete($id)
|
public function ordersPaymentDelete($id)
|
||||||
{
|
{
|
||||||
|
@ -162,7 +163,7 @@ trait Orders
|
||||||
* @throws \RetailCrm\Exception\CurlException
|
* @throws \RetailCrm\Exception\CurlException
|
||||||
* @throws \RetailCrm\Exception\InvalidJsonException
|
* @throws \RetailCrm\Exception\InvalidJsonException
|
||||||
*
|
*
|
||||||
* @return \RetailCrm\Response\ApiResponse
|
* @return ApiResponse
|
||||||
*/
|
*/
|
||||||
public function ordersLoyaltyApply(array $order, float $bonuses, $site = null)
|
public function ordersLoyaltyApply(array $order, float $bonuses, $site = null)
|
||||||
{
|
{
|
||||||
|
@ -197,4 +198,31 @@ trait Orders
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create links between orders
|
||||||
|
*
|
||||||
|
* @param array $links links data
|
||||||
|
* @param null $site site code
|
||||||
|
*
|
||||||
|
* @return ApiResponse
|
||||||
|
*/
|
||||||
|
public function ordersLinksCreate(array $links, $site = null)
|
||||||
|
{
|
||||||
|
if (!count($links)) {
|
||||||
|
throw new \InvalidArgumentException(
|
||||||
|
'Parameters `links` must contains a data'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @noinspection PhpUndefinedMethodInspection */
|
||||||
|
return $this->client->makeRequest(
|
||||||
|
'/orders/links/create',
|
||||||
|
'POST',
|
||||||
|
$this->fillSite(
|
||||||
|
$site,
|
||||||
|
['links' => json_encode($links)]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue