From e68a23885eb6de4d91971063fdfce4c322cf047b Mon Sep 17 00:00:00 2001 From: serega-kasyanow Date: Fri, 11 Sep 2020 17:23:24 +0400 Subject: [PATCH] Create invoice method (#89) Co-authored-by: seregakasyanow --- .../Methods/V5/IntegrationPayments.php | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/RetailCrm/Methods/V5/IntegrationPayments.php b/lib/RetailCrm/Methods/V5/IntegrationPayments.php index d02f993..798e585 100644 --- a/lib/RetailCrm/Methods/V5/IntegrationPayments.php +++ b/lib/RetailCrm/Methods/V5/IntegrationPayments.php @@ -27,6 +27,30 @@ namespace RetailCrm\Methods\V5; */ trait IntegrationPayments { + /** + * Create Invoice + * + * @param array $createInvoice + * @return \RetailCrm\Response\ApiResponse + */ + public function paymentCreateInvoice($createInvoice) + { + if (!count($createInvoice)) { + throw new \InvalidArgumentException( + 'Parameters `createInvoice` must contains a data' + ); + } + + /* @noinspection PhpUndefinedMethodInspection */ + return $this->client->makeRequest( + '/payment/create-invoice', + 'POST', + [ + 'createInvoice' => json_encode($createInvoice) + ] + ); + } + /** * Update Invoice *