Payment delete & custom dictionary creation fix (#46)
This commit is contained in:
parent
4f57734e92
commit
9aab02c189
@ -196,7 +196,7 @@ trait CustomFields
|
||||
}
|
||||
|
||||
return $this->client->makeRequest(
|
||||
"/custom-fields/dictionaries/{$customDictionary['code']}/create",
|
||||
"/custom-fields/dictionaries/create",
|
||||
"POST",
|
||||
['customDictionary' => json_encode($customDictionary)]
|
||||
);
|
||||
|
@ -94,14 +94,14 @@ trait Orders
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit an order payment
|
||||
*
|
||||
* @param array $payment order data
|
||||
* @param string $by by key
|
||||
* @param null $site site code
|
||||
*
|
||||
* @return \RetailCrm\Response\ApiResponse
|
||||
*/
|
||||
* Edit an order payment
|
||||
*
|
||||
* @param array $payment order data
|
||||
* @param string $by by key
|
||||
* @param null $site site code
|
||||
*
|
||||
* @return \RetailCrm\Response\ApiResponse
|
||||
*/
|
||||
public function ordersPaymentEdit(array $payment, $by = 'id', $site = null)
|
||||
{
|
||||
if (!count($payment)) {
|
||||
@ -127,4 +127,25 @@ trait Orders
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit an order payment
|
||||
*
|
||||
* @param string $id payment id
|
||||
*
|
||||
* @return \RetailCrm\Response\ApiResponse
|
||||
*/
|
||||
public function ordersPaymentDelete($id)
|
||||
{
|
||||
if (!$id) {
|
||||
throw new \InvalidArgumentException(
|
||||
'Parameter `id` must be set'
|
||||
);
|
||||
}
|
||||
|
||||
return $this->client->makeRequest(
|
||||
sprintf('/orders/payments/%s/delete', $id),
|
||||
"POST"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -403,10 +403,8 @@ class ApiClientOrdersTest extends TestCase
|
||||
|
||||
$paymentEdit = [
|
||||
'id' => $response['id'],
|
||||
'externalId' => $externalId,
|
||||
'amount' => 1500,
|
||||
'comment' => 'test payment!',
|
||||
'type' => 'cash',
|
||||
'status' => 'paid'
|
||||
];
|
||||
|
||||
@ -414,7 +412,14 @@ class ApiClientOrdersTest extends TestCase
|
||||
|
||||
static::assertTrue(
|
||||
$responseAgain->isSuccessful(),
|
||||
'Got payment'
|
||||
'Edit payment'
|
||||
);
|
||||
|
||||
$responseLast = $client->request->ordersPaymentDelete($response['id']);
|
||||
|
||||
static::assertTrue(
|
||||
$responseLast->isSuccessful(),
|
||||
'Delete payment'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user