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

Add a method to create links between orders (#198)

This commit is contained in:
Uryvskiy Dima 2024-08-02 15:25:37 +03:00 committed by GitHub
parent cbf5237689
commit 8ea13cbbcb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -12,6 +12,7 @@
namespace RetailCrm\Methods\V5;
use RetailCrm\Methods\V4\Orders as Previous;
use RetailCrm\Response\ApiResponse;
/**
* PHP version 5.4
@ -32,7 +33,7 @@ trait Orders
* @param array $resultOrder result order
* @param string $technique combining technique
*
* @return \RetailCrm\Response\ApiResponse
* @return ApiResponse
*/
public function ordersCombine($order, $resultOrder, $technique = 'ours')
{
@ -72,7 +73,7 @@ trait Orders
* @throws \RetailCrm\Exception\CurlException
* @throws \RetailCrm\Exception\InvalidJsonException
*
* @return \RetailCrm\Response\ApiResponse
* @return ApiResponse
*/
public function ordersPaymentCreate(array $payment, $site = null)
{
@ -100,7 +101,7 @@ trait Orders
* @param string $by by key
* @param null $site site code
*
* @return \RetailCrm\Response\ApiResponse
* @return ApiResponse
*/
public function ordersPaymentEdit(array $payment, $by = 'id', $site = null)
{
@ -134,7 +135,7 @@ trait Orders
*
* @param string $id payment id
*
* @return \RetailCrm\Response\ApiResponse
* @return ApiResponse
*/
public function ordersPaymentDelete($id)
{
@ -162,7 +163,7 @@ trait Orders
* @throws \RetailCrm\Exception\CurlException
* @throws \RetailCrm\Exception\InvalidJsonException
*
* @return \RetailCrm\Response\ApiResponse
* @return ApiResponse
*/
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)]
)
);
}
}