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

Payment delete & custom dictionary creation fix (#46)

This commit is contained in:
Alex Lushpai 2017-07-24 15:12:13 +03:00 committed by GitHub
parent 4f57734e92
commit 9aab02c189
3 changed files with 38 additions and 12 deletions

View File

@ -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)]
);

View File

@ -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"
);
}
}

View File

@ -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'
);
}
}