From 934d3ba751baf89fd4a17d4802316ba94c123697 Mon Sep 17 00:00:00 2001 From: Alexandr Streltsov Date: Wed, 10 Jul 2019 16:25:50 +0300 Subject: [PATCH] Add methods for intagration payments --- lib/RetailCrm/Client/ApiVersion5.php | 1 + .../Methods/V5/IntegrationPayments.php | 77 +++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 lib/RetailCrm/Methods/V5/IntegrationPayments.php diff --git a/lib/RetailCrm/Client/ApiVersion5.php b/lib/RetailCrm/Client/ApiVersion5.php index ea08891..bc1050b 100644 --- a/lib/RetailCrm/Client/ApiVersion5.php +++ b/lib/RetailCrm/Client/ApiVersion5.php @@ -57,4 +57,5 @@ class ApiVersion5 extends AbstractLoader use V5\Tasks; use V5\Telephony; use V5\Users; + use V5\IntegrationPayments; } diff --git a/lib/RetailCrm/Methods/V5/IntegrationPayments.php b/lib/RetailCrm/Methods/V5/IntegrationPayments.php new file mode 100644 index 0000000..32c4cec --- /dev/null +++ b/lib/RetailCrm/Methods/V5/IntegrationPayments.php @@ -0,0 +1,77 @@ + + * @license https://opensource.org/licenses/MIT MIT License + * @link http://www.retailcrm.ru/docs/Developers/ApiVersion5 + */ + +namespace RetailCrm\Methods\V5; + +/** + * PHP version 5.4 + * + * Orders class + * + * @category RetailCrm + * @package RetailCrm + * @author RetailCrm + * @license https://opensource.org/licenses/MIT MIT License + * @link http://www.retailcrm.ru/docs/Developers/ApiVersion5 + */ +trait IntegrationPayments +{ + /** + * Update Invoice + * + * @param array $updateInvoice + * @return \RetailCrm\Response\ApiResponse + */ + public function paymentUpdateInvoice($updateInvoice) + { + if (!count($updateInvoice)) { + throw new \InvalidArgumentException( + 'Parameters `updateInvoice` must contains a data' + ); + } + + /* @noinspection PhpUndefinedMethodInspection */ + return $this->client->makeRequest( + '/payment/update-invoice', + 'POST', + [ + 'updateInvoice' => json_encode($updateInvoice) + ] + ); + } + + /** + * Check Invoice + * + * @param array $check + * @return \RetailCrm\Response\ApiResponse + */ + public function paymentCheckInvoice($check) + { + if (!count($check)) { + throw new \InvalidArgumentException( + 'Parameters `check` must contains a data' + ); + } + + /* @noinspection PhpUndefinedMethodInspection */ + return $this->client->makeRequest( + '/payment/check', + 'POST', + [ + 'check' => json_encode($check) + ] + ); + } +}