diff --git a/README.md b/README.md index 39e0cfb..28aa039 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,11 @@ 1. Скачайте и установите NetCat на сервер (https://netcat.ru/democentre). -2. Создайте папку rbkmoney в /netcat/modules и переместите туда папку src и следующие файлы: admin.inc.php, admin.php, - customers.php, en.lang.php, function.inc.php, index.php, install.php, page_order_waiting.php, page_recurrent.php, - page_recurrent_items.php, page_settings.php, page_transactions.php, recurrentCron.php, ru.lang.php, settings.php, - settings_table.php, ui_config.php, url_routes.js -3. Переместите в папку /netcat/modules/payment/classes/system файл rbkmoney.php -4. Зайдите на страницу по адресу http://ваш_сайт/netcat/modules/rbkmoney/install.php -5. После установки модуля нужно заполнить необходимые поля для его корректной работы. +2. Переместите папку netcat/modules в /netcat/modules с заменой файлов +3. Зайдите на страницу по адресу http://ваш_сайт/netcat/modules/rbkmoney/install.php +4. После установки модуля нужно заполнить необходимые поля для его корректной работы. Сделать это нужно через админку в настройках модуля (http://ваш_сайт/netcat/admin) Настройки­>Управление модулями, знак шестеренки напротив названия модуля   После заполнения полей нажмите кнопку сохранить в конце страницы -6. Перейдите в настройки модуля Интернет-магазин (Настройки­>Интернет­магазин), в меню слева выберите пункт Настройки->Оплата. +5. Перейдите в настройки модуля Интернет-магазин (Настройки­>Интернет­магазин), в меню слева выберите пункт Настройки->Оплата. Добавьте новый способ оплаты с указанием платежной системы RBKmoney (кнопка "Добавить" внизу страницы). +6. Также, для работы модуля необходимо заполнить ставки НДС у товаров в магазине. Настройка окончена, теперь при оплате товаров среди способов оплаты будет выводится RBKmoney \ No newline at end of file diff --git a/en.lang.php b/en.lang.php index ca92696..ffc1451 100644 --- a/en.lang.php +++ b/en.lang.php @@ -80,4 +80,6 @@ define('CUSTOMER_UNREADY', 'Unready'); define('RECURRENT_SUCCESS', 'Recurrent payment success: '); define('SHADING_CVV', 'Shading card cvv code'); define('RECURRENT_PAYMENT', 'Recurrent payment'); -define('RBKMONEY_RESPONSE_NOT_RECEIVED', 'Response from RBKmoney is not received'); \ No newline at end of file +define('RBKMONEY_RESPONSE_NOT_RECEIVED', 'Response from RBKmoney is not received'); +define('REDIRECT_TO_PAYMENT_PAGE', 'Now you will be redirected to the payment page.'); +define('CLICK_BUTTON_PAY', 'If this does not happen - click on the button "Pay"'); \ No newline at end of file diff --git a/files.txt b/files.txt index 92a5454..bbde184 100644 --- a/files.txt +++ b/files.txt @@ -1,19 +1,17 @@ /netcat/modules/rbkmoney/admin.inc.php /netcat/modules/rbkmoney/admin.php /netcat/modules/rbkmoney/customers.php -/netcat/modules/rbkmoney/en.lang.php -/netcat/modules/rbkmoney/function.inc.php -/netcat/modules/rbkmoney/index.php /netcat/modules/rbkmoney/page_order_waiting.php /netcat/modules/rbkmoney/page_recurrent.php /netcat/modules/rbkmoney/page_recurrent_items.php /netcat/modules/rbkmoney/page_settings.php /netcat/modules/rbkmoney/page_transactions.php /netcat/modules/rbkmoney/recurrentCron.php -/netcat/modules/rbkmoney/ru.lang.php /netcat/modules/rbkmoney/settings.php +/netcat/modules/rbkmoney/ru.lang.php +/netcat/modules/rbkmoney/en.lang.php /netcat/modules/rbkmoney/ui_config.php -/netcat/modules/rbkmoney/url_routes.js +/netcat/modules/rbkmoney/url_routes.js.php /netcat/modules/payment/classes/system/rbkmoney.php /netcat/modules/rbkmoney/src/Api/ContactInfo.php /netcat/modules/rbkmoney/src/Api/Customers/CreateCustomer/Request/CreateCustomerRequest.php diff --git a/id.txt b/id.txt index e13a0d5..23a6d8d 100644 --- a/id.txt +++ b/id.txt @@ -1,11 +1,8 @@ rbkmoney - 6 - 5.8 +0 +RBK_MONEY -RBKMoney - - -RBKMoney_DESCRIPTION \ No newline at end of file +RBK_MONEY \ No newline at end of file diff --git a/install.php b/install.php index 1da9734..c5c30ff 100644 --- a/install.php +++ b/install.php @@ -4,30 +4,30 @@ $modulePath = $_SERVER['DOCUMENT_ROOT'] . '/rbkmoney/'; include_once($_SERVER['DOCUMENT_ROOT'] . '/vars.inc.php'); include_once($ROOT_FOLDER . 'connect_io.php'); -include_once($modulePath . "$lang.lang.php"); +include_once(__DIR__ . "/$lang.lang.php"); -$db = $nc_core->db; +InstallThisModule(); -InstallThisModule($db); - -function InstallThisModule($db) +function CheckAbilityOfInstallation() { - $db->query("INSERT INTO `Module` (`Module_Name`, `Keyword`, `Description`, - `Parameters`, `Example_URL`, `Help_URL`, `Installed`, `Number`, `Inside_Admin`, `Checked`) - VALUES ('RBK_MONEY', 'rbkmoney', 'RBK_MONEY', 'ADMIN_SETTINGS_LOCATION=module.rbkmoney.settings', '', '', 1, '', 1, 1)" - ); + return array('Success'=>1); +} - $db->query("INSERT INTO `Classificator_PaymentSystem` (`PaymentSystem_Name`, `PaymentSystem_Priority`, `Value`, `Checked`) +function InstallThisModule() +{ + global $nc_core; + + $nc_core->db->query("INSERT INTO `Classificator_PaymentSystem` (`PaymentSystem_Name`, `PaymentSystem_Priority`, `Value`, `Checked`) VALUES ('RBKmoney', '1', 'nc_payment_system_rbkmoney', '1')" ); - $db->query("CREATE TABLE `RBKmoney_Recurrent_Items` ( + $nc_core->db->query("CREATE TABLE `RBKmoney_Recurrent_Items` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `article` VARCHAR (20) NOT NULL, PRIMARY KEY (`id`))" ); - $db->query("CREATE TABLE `RBKmoney_Recurrent` ( + $nc_core->db->query("CREATE TABLE `RBKmoney_Recurrent` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `recurrent_customer_id` INT(10) UNSIGNED NOT NULL, `amount` INT(11) NOT NULL, @@ -40,7 +40,7 @@ function InstallThisModule($db) KEY `recurrent_customer` (`recurrent_customer_id`))" ); - $db->query("CREATE TABLE `RBKmoney_Recurrent_Customers` ( + $nc_core->db->query("CREATE TABLE `RBKmoney_Recurrent_Customers` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `customer_id` VARCHAR(20) NOT NULL, @@ -50,7 +50,7 @@ function InstallThisModule($db) UNIQUE KEY `customer_id` (`customer_id`))" ); - $db->query("CREATE TABLE `RBKmoney_Invoice` ( + $nc_core->db->query("CREATE TABLE `RBKmoney_Invoice` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `invoice_id` VARCHAR(100) NOT NULL, `payload` TEXT NOT NULL, @@ -59,20 +59,19 @@ function InstallThisModule($db) PRIMARY KEY (`id`))" ); - $db->query("INSERT INTO `CronTasks` + $nc_core->db->query("INSERT INTO `CronTasks` (`Cron_Minutes`, `Cron_Hours`, `Cron_Days`, `Cron_Months`, `Cron_Weekdays`, `Cron_Script_URL`) VALUES (0, 0, 0, 0, 0, '/netcat/modules/rbkmoney/recurrentCron.php')" ); - $db->query("INSERT INTO `Settings` + $nc_core->db->query("INSERT INTO `Settings` (`Key`, `Value`, `Module`) VALUES ('apiKey', '', 'rbkmoney'), ('shopId', '', 'rbkmoney'), ('successUrl', 'http://example.ru', 'rbkmoney')" ); - $result["Success"] = 1; -} -echo INSTALLATION_SUCCESS; \ No newline at end of file + $result["Success"] = 1; +} \ No newline at end of file diff --git a/rbkmoney.php b/netcat/modules/payment/classes/system/rbkmoney.php similarity index 79% rename from rbkmoney.php rename to netcat/modules/payment/classes/system/rbkmoney.php index fb88947..689bc0b 100644 --- a/rbkmoney.php +++ b/netcat/modules/payment/classes/system/rbkmoney.php @@ -20,6 +20,7 @@ use src\Api\Webhooks\InvoicesTopicScope; use src\Api\Webhooks\WebhookResponse\WebhookResponse; use src\Client\Client; use src\Client\Sender; +use src\Exceptions\RBKMoneyException; use src\Exceptions\RequestException; class nc_payment_system_rbkmoney extends nc_payment_system @@ -39,6 +40,17 @@ class nc_payment_system_rbkmoney extends nc_payment_system */ private $nc_core; + /** + * @var array + */ + protected $vat_map = [ + 0 => '0%', + 10 => '10%', + 18 => '18%', + 10110 => '10/110', + 18118 => '18/118', + ]; + public function __construct() { $this->nc_core = nc_Core::get_object(); @@ -76,70 +88,94 @@ class nc_payment_system_rbkmoney extends nc_payment_system $this->add_error(ERROR_HOLD_STATUS_IS_NOT_VALID); } } + + $errors = $this->get_errors(); + if (!empty($errors)) { + $this->add_error('На главную'); + } } /** - * @param nc_payment_invoice|null $invoice - * - * @throws nc_record_exception + * @param nc_payment_invoice | null $invoice */ public function on_response(nc_payment_invoice $invoice = null) { - $message = file_get_contents('php://input'); - $callback = json_decode($message); - $invoice = new nc_payment_invoice(); + // + } - if (!isset($callback->invoice->metadata->orderId)) { - $invoice->load($callback->invoice->metadata->orderId); + /** + * @param $vat_rate + * + * @return string + */ + public function getVatRate($vat_rate) + { + if (isset($this->vat_map[$vat_rate])) { + return $this->vat_map[$vat_rate]; } - $invoiceStatus = $invoice->get('status'); - - if(!empty($invoiceStatus) && $invoice::STATUS_SUCCESS === $invoiceStatus){ - $this->on_payment_success($invoice); - } elseif (!empty($invoiceStatus) && $invoice::STATUS_SUCCESS !== $invoiceStatus) { - include dirname(__DIR__) . '/../../rbkmoney/page_order_waiting.php'; - } else { - $this->on_payment_failure($invoice); - } + return $vat_rate; } /** * @param nc_payment_invoice | null $invoice * * @throws Exception - * @throws RequestException - * @throws WrongDataException - * @throws WrongRequestException * @throws nc_record_exception */ public function validate_payment_callback_response(nc_payment_invoice $invoice = null) { - $signature = $this->getSignatureFromHeader(getenv('HTTP_CONTENT_SIGNATURE')); + try { + $signature = $this->getSignatureFromHeader(getenv('HTTP_CONTENT_SIGNATURE')); - if (empty($signature)) { - throw new WrongDataException(WRONG_VALUE . ' `Content-Signature`'); + if (empty($signature)) { + throw new WrongDataException(WRONG_SIGNATURE, 403); + } + + $signDecode = base64_decode(strtr($signature, '-_,', '+/=')); + + $message = file_get_contents('php://input'); + + if (empty($message)) { + throw new WrongDataException(WRONG_VALUE . ' `callback`', 400); + } + + if (!$this->verificationSignature($message, $signDecode)) { + throw new WrongDataException(WRONG_SIGNATURE, 403); + } + + $callback = json_decode($message); + + if (isset($callback->invoice)) { + $this->paymentCallback($callback); + } elseif (isset($callback->customer)) { + $this->customerCallback($callback->customer); + } + } catch (RBKMoneyException $exception) { + $this->callbackError($exception); } + } - $signDecode = base64_decode(strtr($signature, '-_,', '+/=')); - - $message = file_get_contents('php://input'); - - if (empty($message)) { - throw new WrongDataException(WRONG_VALUE . ' `callback`'); + /** + * @param RBKmoneyException $exception + * @param nc_payment_invoice | null $invoice + */ + private function callbackError(RBKMoneyException $exception, nc_payment_invoice $invoice = null) { + if (!empty($invoice)) { + $this->on_payment_failure($invoice); } + $this->printCallbackResponse($exception); - if (!$this->verificationSignature($message, $signDecode)) { - throw new WrongDataException(WRONG_SIGNATURE); - } + die; + } - $callback = json_decode($message); + /** + * @param RBKmoneyException $exception + */ + private function printCallbackResponse(RBKmoneyException $exception) { + header('Content-Type: application/json', true, $exception->getCode()); - if (isset($callback->invoice)) { - $this->paymentCallback($callback); - } elseif (isset($callback->customer)) { - $this->customerCallback($callback->customer); - } + echo json_encode(['message' => $exception->getMessage()]); } /** @@ -227,7 +263,7 @@ class nc_payment_system_rbkmoney extends nc_payment_system $invoiceStatus = $invoice::STATUS_WAITING; $netshopStatus = NETSHOP_STATUS_WAITING; } else { - throw new WrongDataException(ERROR_HOLD_STATUS_IS_NOT_VALID); + throw new WrongDataException(ERROR_HOLD_STATUS_IS_NOT_VALID, 400); } if (in_array($type, [ @@ -262,16 +298,6 @@ class nc_payment_system_rbkmoney extends nc_payment_system return number_format($price, 2, '', ''); } - /** - * @param string $tax - * - * @return string - */ - private function getTaxSlash($tax) - { - return substr_replace($tax, '/', 2, 0); - } - /** * @param string $data * @param string $signature @@ -305,7 +331,7 @@ class nc_payment_system_rbkmoney extends nc_payment_system $signature = preg_replace("/alg=(\S+);\sdigest=/", '', $contentSignature); if (empty($signature)) { - throw new WrongDataException(WRONG_VALUE . ' `Content-Signature`'); + throw new WrongDataException(WRONG_SIGNATURE, 403); } return $signature; @@ -361,18 +387,17 @@ class nc_payment_system_rbkmoney extends nc_payment_system $sourceItemId = $item->get('source_item_id'); if (empty($sourceItemId)) { - $tax = DELIVERY_VAT_SETTING; + $vat = DELIVERY_VAT_SETTING; } else { - $tax = $item->get('vat_rate'); + $vat = $item->get('vat_rate'); } - $taxSlash = $this->getTaxSlash($tax); + $vatRate = $this->getVatRate($vat); - if (in_array($taxSlash, TaxMode::$validValues)) { - $taxMode = new TaxMode($taxSlash); - } elseif (in_array("$tax%", TaxMode::$validValues)) { - $taxMode = new TaxMode("$tax%"); + if (in_array($vatRate, TaxMode::$validValues)) { + $taxMode = new TaxMode($vatRate); } else { - throw new WrongDataException(ERROR_TAX_RATE_IS_NOT_VALID . $itemName); + $this->add_error('На главную'); + throw new WrongDataException(ERROR_TAX_RATE_IS_NOT_VALID . $itemName, 400); } $carts[] = new Cart( @@ -430,13 +455,19 @@ class nc_payment_system_rbkmoney extends nc_payment_system /** * @param nc_payment_invoice $invoice * - * @return array | null + * @return array */ private function getInvoice(nc_payment_invoice $invoice) { - return $this->nc_core->db->get_results("SELECT * + $result = $this->nc_core->db->get_results("SELECT * FROM `RBKmoney_Invoice` WHERE `order_id` = '{$invoice->get_id()}'"); + + if (!empty($result)) { + return $result; + } + + return []; } /** @@ -516,28 +547,36 @@ class nc_payment_system_rbkmoney extends nc_payment_system $holdExpiration = 'data-hold-expiration="' . $this->getHoldType()->getValue() . '"'; } - $requireCardHolder = (NOT_SHOW_PARAMETER === $this->get_setting('cardHolder')); - $shadingCvv = (NOT_SHOW_PARAMETER === $this->get_setting('shadingCvv')); + // При echo true заменяется на 1, а checkout воспринимает только true + $holdType = $holdType ? 'true' : 'false'; + $requireCardHolder = (SHOW_PARAMETER === $this->get_setting('cardHolder')) ? 'true' : 'false'; + $shadingCvv = (SHOW_PARAMETER === $this->get_setting('shadingCvv')) ? 'true' : 'false'; + $customerEmail = $invoice->get('customer_email'); - $form = '
- - - -
-'; + $form = ' +
+'.REDIRECT_TO_PAYMENT_PAGE.'
+'.CLICK_BUTTON_PAY.' +
+ + + +
+ +
'; echo $form; } diff --git a/admin.inc.php b/netcat/modules/rbkmoney/admin.inc.php similarity index 99% rename from admin.inc.php rename to netcat/modules/rbkmoney/admin.inc.php index 62ea785..b07a4b7 100644 --- a/admin.inc.php +++ b/netcat/modules/rbkmoney/admin.inc.php @@ -227,13 +227,14 @@ class RbkMoneyAdmin { try { if (!$this->settings['apiKey']) { - throw new WrongDataException(ERROR_API_KEY_IS_NOT_VALID); + throw new WrongDataException(ERROR_API_KEY_IS_NOT_VALID, 400); } if (!$this->settings['shopId']) { - throw new WrongDataException(ERROR_SHOP_ID_IS_NOT_VALID); + throw new WrongDataException(ERROR_SHOP_ID_IS_NOT_VALID, 400); } } catch (WrongDataException $exception) { echo $exception->getMessage(); + die; } if ($fromTime->getTimestamp() > $toTime->getTimestamp()) { $fromTime = new DateTime('today'); diff --git a/admin.php b/netcat/modules/rbkmoney/admin.php similarity index 100% rename from admin.php rename to netcat/modules/rbkmoney/admin.php diff --git a/customers.php b/netcat/modules/rbkmoney/customers.php similarity index 100% rename from customers.php rename to netcat/modules/rbkmoney/customers.php diff --git a/netcat/modules/rbkmoney/en.lang.php b/netcat/modules/rbkmoney/en.lang.php new file mode 100644 index 0000000..ffc1451 --- /dev/null +++ b/netcat/modules/rbkmoney/en.lang.php @@ -0,0 +1,85 @@ +name); + throw new WrongDataException(ERROR_TAX_RATE_IS_NOT_VALID . $payment->name, 400); } $createInvoice->addCart(new Cart( diff --git a/netcat/modules/rbkmoney/ru.lang.php b/netcat/modules/rbkmoney/ru.lang.php new file mode 100644 index 0000000..5c0ef47 --- /dev/null +++ b/netcat/modules/rbkmoney/ru.lang.php @@ -0,0 +1,85 @@ +phoneNumber = $phoneNumber; diff --git a/src/Api/Customers/CreateCustomer/Request/CreateCustomerRequest.php b/netcat/modules/rbkmoney/src/Api/Customers/CreateCustomer/Request/CreateCustomerRequest.php similarity index 100% rename from src/Api/Customers/CreateCustomer/Request/CreateCustomerRequest.php rename to netcat/modules/rbkmoney/src/Api/Customers/CreateCustomer/Request/CreateCustomerRequest.php diff --git a/src/Api/Customers/CreateCustomer/Response/CreateCustomerResponse.php b/netcat/modules/rbkmoney/src/Api/Customers/CreateCustomer/Response/CreateCustomerResponse.php similarity index 100% rename from src/Api/Customers/CreateCustomer/Response/CreateCustomerResponse.php rename to netcat/modules/rbkmoney/src/Api/Customers/CreateCustomer/Response/CreateCustomerResponse.php diff --git a/src/Api/Customers/CustomerResponse/CustomerResponse.php b/netcat/modules/rbkmoney/src/Api/Customers/CustomerResponse/CustomerResponse.php similarity index 100% rename from src/Api/Customers/CustomerResponse/CustomerResponse.php rename to netcat/modules/rbkmoney/src/Api/Customers/CustomerResponse/CustomerResponse.php diff --git a/src/Api/Customers/CustomerResponse/Status.php b/netcat/modules/rbkmoney/src/Api/Customers/CustomerResponse/Status.php similarity index 98% rename from src/Api/Customers/CustomerResponse/Status.php rename to netcat/modules/rbkmoney/src/Api/Customers/CustomerResponse/Status.php index 3013c71..8bc8ecb 100644 --- a/src/Api/Customers/CustomerResponse/Status.php +++ b/netcat/modules/rbkmoney/src/Api/Customers/CustomerResponse/Status.php @@ -34,7 +34,7 @@ class Status public function __construct($value) { if (!in_array($value, $this->validValues)) { - throw new WrongDataException(WRONG_VALUE . ' `status`'); + throw new WrongDataException(WRONG_VALUE . ' `status`', 400); } $this->value = $value; diff --git a/src/Api/Error.php b/netcat/modules/rbkmoney/src/Api/Error.php similarity index 100% rename from src/Api/Error.php rename to netcat/modules/rbkmoney/src/Api/Error.php diff --git a/src/Api/Exceptions/WrongDataException.php b/netcat/modules/rbkmoney/src/Api/Exceptions/WrongDataException.php similarity index 100% rename from src/Api/Exceptions/WrongDataException.php rename to netcat/modules/rbkmoney/src/Api/Exceptions/WrongDataException.php diff --git a/src/Api/Exceptions/WrongRequestException.php b/netcat/modules/rbkmoney/src/Api/Exceptions/WrongRequestException.php similarity index 100% rename from src/Api/Exceptions/WrongRequestException.php rename to netcat/modules/rbkmoney/src/Api/Exceptions/WrongRequestException.php diff --git a/src/Api/Interfaces/FlowRequestInterface.php b/netcat/modules/rbkmoney/src/Api/Interfaces/FlowRequestInterface.php similarity index 100% rename from src/Api/Interfaces/FlowRequestInterface.php rename to netcat/modules/rbkmoney/src/Api/Interfaces/FlowRequestInterface.php diff --git a/src/Api/Interfaces/GetRequestInterface.php b/netcat/modules/rbkmoney/src/Api/Interfaces/GetRequestInterface.php similarity index 100% rename from src/Api/Interfaces/GetRequestInterface.php rename to netcat/modules/rbkmoney/src/Api/Interfaces/GetRequestInterface.php diff --git a/src/Api/Interfaces/PayerRequestInterface.php b/netcat/modules/rbkmoney/src/Api/Interfaces/PayerRequestInterface.php similarity index 100% rename from src/Api/Interfaces/PayerRequestInterface.php rename to netcat/modules/rbkmoney/src/Api/Interfaces/PayerRequestInterface.php diff --git a/src/Api/Interfaces/PostRequestInterface.php b/netcat/modules/rbkmoney/src/Api/Interfaces/PostRequestInterface.php similarity index 100% rename from src/Api/Interfaces/PostRequestInterface.php rename to netcat/modules/rbkmoney/src/Api/Interfaces/PostRequestInterface.php diff --git a/src/Api/Interfaces/RequestInterface.php b/netcat/modules/rbkmoney/src/Api/Interfaces/RequestInterface.php similarity index 100% rename from src/Api/Interfaces/RequestInterface.php rename to netcat/modules/rbkmoney/src/Api/Interfaces/RequestInterface.php diff --git a/src/Api/Interfaces/ResponseInterface.php b/netcat/modules/rbkmoney/src/Api/Interfaces/ResponseInterface.php similarity index 100% rename from src/Api/Interfaces/ResponseInterface.php rename to netcat/modules/rbkmoney/src/Api/Interfaces/ResponseInterface.php diff --git a/src/Api/Invoices/CreateInvoice/Cart.php b/netcat/modules/rbkmoney/src/Api/Invoices/CreateInvoice/Cart.php similarity index 100% rename from src/Api/Invoices/CreateInvoice/Cart.php rename to netcat/modules/rbkmoney/src/Api/Invoices/CreateInvoice/Cart.php diff --git a/src/Api/Invoices/CreateInvoice/Request/CreateInvoiceRequest.php b/netcat/modules/rbkmoney/src/Api/Invoices/CreateInvoice/Request/CreateInvoiceRequest.php similarity index 100% rename from src/Api/Invoices/CreateInvoice/Request/CreateInvoiceRequest.php rename to netcat/modules/rbkmoney/src/Api/Invoices/CreateInvoice/Request/CreateInvoiceRequest.php diff --git a/src/Api/Invoices/CreateInvoice/Response/CreateInvoiceResponse.php b/netcat/modules/rbkmoney/src/Api/Invoices/CreateInvoice/Response/CreateInvoiceResponse.php similarity index 100% rename from src/Api/Invoices/CreateInvoice/Response/CreateInvoiceResponse.php rename to netcat/modules/rbkmoney/src/Api/Invoices/CreateInvoice/Response/CreateInvoiceResponse.php diff --git a/src/Api/Invoices/CreateInvoice/TaxMode.php b/netcat/modules/rbkmoney/src/Api/Invoices/CreateInvoice/TaxMode.php similarity index 99% rename from src/Api/Invoices/CreateInvoice/TaxMode.php rename to netcat/modules/rbkmoney/src/Api/Invoices/CreateInvoice/TaxMode.php index 84d804d..ccbcdd4 100644 --- a/src/Api/Invoices/CreateInvoice/TaxMode.php +++ b/netcat/modules/rbkmoney/src/Api/Invoices/CreateInvoice/TaxMode.php @@ -70,7 +70,7 @@ class TaxMode public function __construct($rate) { if (!in_array($rate, self::$validValues)) { - throw new WrongDataException(WRONG_VALUE . ' `rate`'); + throw new WrongDataException(WRONG_VALUE . ' `rate`', 400); } $this->rate = $rate; diff --git a/src/Api/Invoices/GetInvoiceById/Request/GetInvoiceByIdRequest.php b/netcat/modules/rbkmoney/src/Api/Invoices/GetInvoiceById/Request/GetInvoiceByIdRequest.php similarity index 100% rename from src/Api/Invoices/GetInvoiceById/Request/GetInvoiceByIdRequest.php rename to netcat/modules/rbkmoney/src/Api/Invoices/GetInvoiceById/Request/GetInvoiceByIdRequest.php diff --git a/src/Api/Invoices/GetInvoiceById/Response/GetInvoiceByIdResponse.php b/netcat/modules/rbkmoney/src/Api/Invoices/GetInvoiceById/Response/GetInvoiceByIdResponse.php similarity index 100% rename from src/Api/Invoices/GetInvoiceById/Response/GetInvoiceByIdResponse.php rename to netcat/modules/rbkmoney/src/Api/Invoices/GetInvoiceById/Response/GetInvoiceByIdResponse.php diff --git a/src/Api/Invoices/InvoiceResponse/CartResponse.php b/netcat/modules/rbkmoney/src/Api/Invoices/InvoiceResponse/CartResponse.php similarity index 100% rename from src/Api/Invoices/InvoiceResponse/CartResponse.php rename to netcat/modules/rbkmoney/src/Api/Invoices/InvoiceResponse/CartResponse.php diff --git a/src/Api/Invoices/InvoiceResponse/InvoiceResponse.php b/netcat/modules/rbkmoney/src/Api/Invoices/InvoiceResponse/InvoiceResponse.php similarity index 100% rename from src/Api/Invoices/InvoiceResponse/InvoiceResponse.php rename to netcat/modules/rbkmoney/src/Api/Invoices/InvoiceResponse/InvoiceResponse.php diff --git a/src/Api/Invoices/Status.php b/netcat/modules/rbkmoney/src/Api/Invoices/Status.php similarity index 98% rename from src/Api/Invoices/Status.php rename to netcat/modules/rbkmoney/src/Api/Invoices/Status.php index 92c0265..b684232 100644 --- a/src/Api/Invoices/Status.php +++ b/netcat/modules/rbkmoney/src/Api/Invoices/Status.php @@ -38,7 +38,7 @@ class Status public function __construct($value) { if (!in_array($value, $this->validValues)) { - throw new WrongDataException(WRONG_VALUE . ' `status`'); + throw new WrongDataException(WRONG_VALUE . ' `status`', 400); } $this->value = $value; diff --git a/src/Api/Metadata.php b/netcat/modules/rbkmoney/src/Api/Metadata.php similarity index 100% rename from src/Api/Metadata.php rename to netcat/modules/rbkmoney/src/Api/Metadata.php diff --git a/src/Api/Payments/CancelPayment/Request/CancelPaymentRequest.php b/netcat/modules/rbkmoney/src/Api/Payments/CancelPayment/Request/CancelPaymentRequest.php similarity index 100% rename from src/Api/Payments/CancelPayment/Request/CancelPaymentRequest.php rename to netcat/modules/rbkmoney/src/Api/Payments/CancelPayment/Request/CancelPaymentRequest.php diff --git a/src/Api/Payments/CapturePayment/Request/CapturePaymentRequest.php b/netcat/modules/rbkmoney/src/Api/Payments/CapturePayment/Request/CapturePaymentRequest.php similarity index 100% rename from src/Api/Payments/CapturePayment/Request/CapturePaymentRequest.php rename to netcat/modules/rbkmoney/src/Api/Payments/CapturePayment/Request/CapturePaymentRequest.php diff --git a/src/Api/Payments/CreatePayment/HoldType.php b/netcat/modules/rbkmoney/src/Api/Payments/CreatePayment/HoldType.php similarity index 97% rename from src/Api/Payments/CreatePayment/HoldType.php rename to netcat/modules/rbkmoney/src/Api/Payments/CreatePayment/HoldType.php index 70749ae..e8547e2 100644 --- a/src/Api/Payments/CreatePayment/HoldType.php +++ b/netcat/modules/rbkmoney/src/Api/Payments/CreatePayment/HoldType.php @@ -34,7 +34,7 @@ class HoldType public function __construct($value) { if (!in_array($value, $this->validValues)) { - throw new WrongDataException(WRONG_VALUE . ' `onHoldExpiration`'); + throw new WrongDataException(WRONG_VALUE . ' `onHoldExpiration`', 400); } $this->value = $value; diff --git a/src/Api/Payments/CreatePayment/PayerType.php b/netcat/modules/rbkmoney/src/Api/Payments/CreatePayment/PayerType.php similarity index 98% rename from src/Api/Payments/CreatePayment/PayerType.php rename to netcat/modules/rbkmoney/src/Api/Payments/CreatePayment/PayerType.php index ebf6c74..4129e09 100644 --- a/src/Api/Payments/CreatePayment/PayerType.php +++ b/netcat/modules/rbkmoney/src/Api/Payments/CreatePayment/PayerType.php @@ -34,7 +34,7 @@ class PayerType public function __construct($value) { if (!in_array($value, $this->validValues)) { - throw new WrongDataException(WRONG_VALUE . ' `payerType`'); + throw new WrongDataException(WRONG_VALUE . ' `payerType`', 400); } $this->value = $value; diff --git a/src/Api/Payments/CreatePayment/PaymentResourcePayer.php b/netcat/modules/rbkmoney/src/Api/Payments/CreatePayment/PaymentResourcePayer.php similarity index 100% rename from src/Api/Payments/CreatePayment/PaymentResourcePayer.php rename to netcat/modules/rbkmoney/src/Api/Payments/CreatePayment/PaymentResourcePayer.php diff --git a/src/Api/Payments/CreatePayment/Request/CreatePaymentRequest.php b/netcat/modules/rbkmoney/src/Api/Payments/CreatePayment/Request/CreatePaymentRequest.php similarity index 100% rename from src/Api/Payments/CreatePayment/Request/CreatePaymentRequest.php rename to netcat/modules/rbkmoney/src/Api/Payments/CreatePayment/Request/CreatePaymentRequest.php diff --git a/src/Api/Payments/CreatePayment/Request/CustomerPayerRequest.php b/netcat/modules/rbkmoney/src/Api/Payments/CreatePayment/Request/CustomerPayerRequest.php similarity index 100% rename from src/Api/Payments/CreatePayment/Request/CustomerPayerRequest.php rename to netcat/modules/rbkmoney/src/Api/Payments/CreatePayment/Request/CustomerPayerRequest.php diff --git a/src/Api/Payments/CreatePayment/Request/PaymentFlowHoldRequest.php b/netcat/modules/rbkmoney/src/Api/Payments/CreatePayment/Request/PaymentFlowHoldRequest.php similarity index 100% rename from src/Api/Payments/CreatePayment/Request/PaymentFlowHoldRequest.php rename to netcat/modules/rbkmoney/src/Api/Payments/CreatePayment/Request/PaymentFlowHoldRequest.php diff --git a/src/Api/Payments/CreatePayment/Request/PaymentFlowInstantRequest.php b/netcat/modules/rbkmoney/src/Api/Payments/CreatePayment/Request/PaymentFlowInstantRequest.php similarity index 100% rename from src/Api/Payments/CreatePayment/Request/PaymentFlowInstantRequest.php rename to netcat/modules/rbkmoney/src/Api/Payments/CreatePayment/Request/PaymentFlowInstantRequest.php diff --git a/src/Api/Payments/CreatePayment/Response/CreatePaymentResponse.php b/netcat/modules/rbkmoney/src/Api/Payments/CreatePayment/Response/CreatePaymentResponse.php similarity index 100% rename from src/Api/Payments/CreatePayment/Response/CreatePaymentResponse.php rename to netcat/modules/rbkmoney/src/Api/Payments/CreatePayment/Response/CreatePaymentResponse.php diff --git a/src/Api/Payments/CreateRefund/Request/CreateRefundRequest.php b/netcat/modules/rbkmoney/src/Api/Payments/CreateRefund/Request/CreateRefundRequest.php similarity index 100% rename from src/Api/Payments/CreateRefund/Request/CreateRefundRequest.php rename to netcat/modules/rbkmoney/src/Api/Payments/CreateRefund/Request/CreateRefundRequest.php diff --git a/src/Api/Payments/PaymentResponse/ClientInfo.php b/netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/ClientInfo.php similarity index 100% rename from src/Api/Payments/PaymentResponse/ClientInfo.php rename to netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/ClientInfo.php diff --git a/src/Api/Payments/PaymentResponse/CustomerPayer.php b/netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/CustomerPayer.php similarity index 100% rename from src/Api/Payments/PaymentResponse/CustomerPayer.php rename to netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/CustomerPayer.php diff --git a/src/Api/Payments/PaymentResponse/DetailsBankCard.php b/netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/DetailsBankCard.php similarity index 100% rename from src/Api/Payments/PaymentResponse/DetailsBankCard.php rename to netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/DetailsBankCard.php diff --git a/src/Api/Payments/PaymentResponse/DetailsDigitalWallet.php b/netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/DetailsDigitalWallet.php similarity index 100% rename from src/Api/Payments/PaymentResponse/DetailsDigitalWallet.php rename to netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/DetailsDigitalWallet.php diff --git a/src/Api/Payments/PaymentResponse/DetailsPaymentTerminal.php b/netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/DetailsPaymentTerminal.php similarity index 100% rename from src/Api/Payments/PaymentResponse/DetailsPaymentTerminal.php rename to netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/DetailsPaymentTerminal.php diff --git a/src/Api/Payments/PaymentResponse/Flow.php b/netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/Flow.php similarity index 100% rename from src/Api/Payments/PaymentResponse/Flow.php rename to netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/Flow.php diff --git a/src/Api/Payments/PaymentResponse/FlowHold.php b/netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/FlowHold.php similarity index 100% rename from src/Api/Payments/PaymentResponse/FlowHold.php rename to netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/FlowHold.php diff --git a/src/Api/Payments/PaymentResponse/FlowInstant.php b/netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/FlowInstant.php similarity index 100% rename from src/Api/Payments/PaymentResponse/FlowInstant.php rename to netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/FlowInstant.php diff --git a/src/Api/Payments/PaymentResponse/Payer.php b/netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/Payer.php similarity index 100% rename from src/Api/Payments/PaymentResponse/Payer.php rename to netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/Payer.php diff --git a/src/Api/Payments/PaymentResponse/PaymentResourcePayer.php b/netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/PaymentResourcePayer.php similarity index 100% rename from src/Api/Payments/PaymentResponse/PaymentResourcePayer.php rename to netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/PaymentResourcePayer.php diff --git a/src/Api/Payments/PaymentResponse/PaymentResponse.php b/netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/PaymentResponse.php similarity index 100% rename from src/Api/Payments/PaymentResponse/PaymentResponse.php rename to netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/PaymentResponse.php diff --git a/src/Api/Payments/PaymentResponse/PaymentSystem.php b/netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/PaymentSystem.php similarity index 98% rename from src/Api/Payments/PaymentResponse/PaymentSystem.php rename to netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/PaymentSystem.php index 6da48dd..e64ca05 100644 --- a/src/Api/Payments/PaymentResponse/PaymentSystem.php +++ b/netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/PaymentSystem.php @@ -54,7 +54,7 @@ class PaymentSystem public function __construct($value) { if (!in_array($value, $this->validValues)) { - throw new WrongDataException(WRONG_VALUE . ' `paymentSystem`'); + throw new WrongDataException(WRONG_VALUE . ' `paymentSystem`', 400); } $this->value = $value; diff --git a/src/Api/Payments/PaymentResponse/PaymentToolDetails.php b/netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/PaymentToolDetails.php similarity index 100% rename from src/Api/Payments/PaymentResponse/PaymentToolDetails.php rename to netcat/modules/rbkmoney/src/Api/Payments/PaymentResponse/PaymentToolDetails.php diff --git a/src/Api/Payments/RefundResponse/RefundResponse.php b/netcat/modules/rbkmoney/src/Api/Payments/RefundResponse/RefundResponse.php similarity index 100% rename from src/Api/Payments/RefundResponse/RefundResponse.php rename to netcat/modules/rbkmoney/src/Api/Payments/RefundResponse/RefundResponse.php diff --git a/src/Api/Payments/RefundResponse/Status.php b/netcat/modules/rbkmoney/src/Api/Payments/RefundResponse/Status.php similarity index 98% rename from src/Api/Payments/RefundResponse/Status.php rename to netcat/modules/rbkmoney/src/Api/Payments/RefundResponse/Status.php index 85e4c8e..d06c822 100644 --- a/src/Api/Payments/RefundResponse/Status.php +++ b/netcat/modules/rbkmoney/src/Api/Payments/RefundResponse/Status.php @@ -36,7 +36,7 @@ class Status public function __construct($value) { if (!in_array($value, $this->validValues)) { - throw new WrongDataException(WRONG_VALUE . ' `status`'); + throw new WrongDataException(WRONG_VALUE . ' `status`', 400); } $this->value = $value; diff --git a/netcat/modules/rbkmoney/src/Api/RBKMoneyDataObject.php b/netcat/modules/rbkmoney/src/Api/RBKMoneyDataObject.php new file mode 100644 index 0000000..2bfee99 --- /dev/null +++ b/netcat/modules/rbkmoney/src/Api/RBKMoneyDataObject.php @@ -0,0 +1,39 @@ +__isset($name)) { + return $this->$name; + } + } + + /** + * Метод объявлен только для того, чтоб + * запретить динамически создавать поля объекта + * + * @param string $name + * @param mixed $value + */ + public function __set($name, $value) { + // Реализация не предполагается + } + +} diff --git a/src/Api/Search/PaymentMethod.php b/netcat/modules/rbkmoney/src/Api/Search/PaymentMethod.php similarity index 98% rename from src/Api/Search/PaymentMethod.php rename to netcat/modules/rbkmoney/src/Api/Search/PaymentMethod.php index 37b0305..f9e457e 100644 --- a/src/Api/Search/PaymentMethod.php +++ b/netcat/modules/rbkmoney/src/Api/Search/PaymentMethod.php @@ -34,7 +34,7 @@ class PaymentMethod public function __construct($value) { if (!in_array($value, $this->validValues)) { - throw new WrongDataException(WRONG_VALUE . ' `paymentMethod`'); + throw new WrongDataException(WRONG_VALUE . ' `paymentMethod`', 400); } $this->value = $value; diff --git a/src/Api/Search/SearchPayments/Request/SearchPaymentsRequest.php b/netcat/modules/rbkmoney/src/Api/Search/SearchPayments/Request/SearchPaymentsRequest.php similarity index 99% rename from src/Api/Search/SearchPayments/Request/SearchPaymentsRequest.php rename to netcat/modules/rbkmoney/src/Api/Search/SearchPayments/Request/SearchPaymentsRequest.php index c0d4ba1..e6ac2c1 100644 --- a/src/Api/Search/SearchPayments/Request/SearchPaymentsRequest.php +++ b/netcat/modules/rbkmoney/src/Api/Search/SearchPayments/Request/SearchPaymentsRequest.php @@ -271,7 +271,7 @@ class SearchPaymentsRequest extends RBKMoneyDataObject implements GetRequestInte public function setCardNumberMask($cardNumberMask) { if (!preg_match('/^\d{2,4}$/', $cardNumberMask)) { - throw new WrongDataException(WRONG_VALUE . ' `cardNumberMask`'); + throw new WrongDataException(WRONG_VALUE . ' `cardNumberMask`', 400); } $this->cardNumberMask = $cardNumberMask; diff --git a/src/Api/Search/SearchPayments/Response/GeoLocation.php b/netcat/modules/rbkmoney/src/Api/Search/SearchPayments/Response/GeoLocation.php similarity index 100% rename from src/Api/Search/SearchPayments/Response/GeoLocation.php rename to netcat/modules/rbkmoney/src/Api/Search/SearchPayments/Response/GeoLocation.php diff --git a/src/Api/Search/SearchPayments/Response/Payment.php b/netcat/modules/rbkmoney/src/Api/Search/SearchPayments/Response/Payment.php similarity index 100% rename from src/Api/Search/SearchPayments/Response/Payment.php rename to netcat/modules/rbkmoney/src/Api/Search/SearchPayments/Response/Payment.php diff --git a/src/Api/Search/SearchPayments/Response/SearchPaymentsResponse.php b/netcat/modules/rbkmoney/src/Api/Search/SearchPayments/Response/SearchPaymentsResponse.php similarity index 100% rename from src/Api/Search/SearchPayments/Response/SearchPaymentsResponse.php rename to netcat/modules/rbkmoney/src/Api/Search/SearchPayments/Response/SearchPaymentsResponse.php diff --git a/src/Api/Status.php b/netcat/modules/rbkmoney/src/Api/Status.php similarity index 99% rename from src/Api/Status.php rename to netcat/modules/rbkmoney/src/Api/Status.php index 7fb2b2e..75ad964 100644 --- a/src/Api/Status.php +++ b/netcat/modules/rbkmoney/src/Api/Status.php @@ -46,7 +46,7 @@ class Status public function __construct($value) { if (!in_array($value, $this->validValues)) { - throw new WrongDataException(WRONG_VALUE . ' `status`'); + throw new WrongDataException(WRONG_VALUE . ' `status`', 400); } $this->value = $value; diff --git a/src/Api/Tokens/CreatePaymentResource/Request/CardData.php b/netcat/modules/rbkmoney/src/Api/Tokens/CreatePaymentResource/Request/CardData.php similarity index 94% rename from src/Api/Tokens/CreatePaymentResource/Request/CardData.php rename to netcat/modules/rbkmoney/src/Api/Tokens/CreatePaymentResource/Request/CardData.php index c5eb1d6..2110c62 100644 --- a/src/Api/Tokens/CreatePaymentResource/Request/CardData.php +++ b/netcat/modules/rbkmoney/src/Api/Tokens/CreatePaymentResource/Request/CardData.php @@ -45,13 +45,13 @@ class CardData extends PaymentTool public function __construct($cardNumber, $expDate, $cvv) { if (!preg_match('/^\d{12,19}$/', $cardNumber)) { - throw new WrongDataException(WRONG_VALUE . ' `cardNumber`'); + throw new WrongDataException(WRONG_VALUE . ' `cardNumber`', 400); } if (!preg_match('/^\d{2}\/(\d{2}|\d{4})$/', $expDate)) { - throw new WrongDataException(WRONG_VALUE . ' `expDate`'); + throw new WrongDataException(WRONG_VALUE . ' `expDate`', 400); } if (!preg_match('/^\d{3,4}$/', $cvv)) { - throw new WrongDataException(WRONG_VALUE . ' `cvv`'); + throw new WrongDataException(WRONG_VALUE . ' `cvv`', 400); } $this->cardNumber = $cardNumber; diff --git a/src/Api/Tokens/CreatePaymentResource/Request/ClientInfo.php b/netcat/modules/rbkmoney/src/Api/Tokens/CreatePaymentResource/Request/ClientInfo.php similarity index 100% rename from src/Api/Tokens/CreatePaymentResource/Request/ClientInfo.php rename to netcat/modules/rbkmoney/src/Api/Tokens/CreatePaymentResource/Request/ClientInfo.php diff --git a/src/Api/Tokens/CreatePaymentResource/Request/CreatePaymentResourceRequest.php b/netcat/modules/rbkmoney/src/Api/Tokens/CreatePaymentResource/Request/CreatePaymentResourceRequest.php similarity index 100% rename from src/Api/Tokens/CreatePaymentResource/Request/CreatePaymentResourceRequest.php rename to netcat/modules/rbkmoney/src/Api/Tokens/CreatePaymentResource/Request/CreatePaymentResourceRequest.php diff --git a/src/Api/Tokens/CreatePaymentResource/Request/DigitalWalletData.php b/netcat/modules/rbkmoney/src/Api/Tokens/CreatePaymentResource/Request/DigitalWalletData.php similarity index 100% rename from src/Api/Tokens/CreatePaymentResource/Request/DigitalWalletData.php rename to netcat/modules/rbkmoney/src/Api/Tokens/CreatePaymentResource/Request/DigitalWalletData.php diff --git a/src/Api/Tokens/CreatePaymentResource/Request/PaymentTerminalData.php b/netcat/modules/rbkmoney/src/Api/Tokens/CreatePaymentResource/Request/PaymentTerminalData.php similarity index 100% rename from src/Api/Tokens/CreatePaymentResource/Request/PaymentTerminalData.php rename to netcat/modules/rbkmoney/src/Api/Tokens/CreatePaymentResource/Request/PaymentTerminalData.php diff --git a/src/Api/Tokens/CreatePaymentResource/Request/PaymentTool.php b/netcat/modules/rbkmoney/src/Api/Tokens/CreatePaymentResource/Request/PaymentTool.php similarity index 100% rename from src/Api/Tokens/CreatePaymentResource/Request/PaymentTool.php rename to netcat/modules/rbkmoney/src/Api/Tokens/CreatePaymentResource/Request/PaymentTool.php diff --git a/src/Api/Tokens/CreatePaymentResource/Request/TerminalProvider.php b/netcat/modules/rbkmoney/src/Api/Tokens/CreatePaymentResource/Request/TerminalProvider.php similarity index 97% rename from src/Api/Tokens/CreatePaymentResource/Request/TerminalProvider.php rename to netcat/modules/rbkmoney/src/Api/Tokens/CreatePaymentResource/Request/TerminalProvider.php index 1e31c1f..e5b825c 100644 --- a/src/Api/Tokens/CreatePaymentResource/Request/TerminalProvider.php +++ b/netcat/modules/rbkmoney/src/Api/Tokens/CreatePaymentResource/Request/TerminalProvider.php @@ -32,7 +32,7 @@ class TerminalProvider public function __construct($value) { if (!in_array($value, $this->validValues)) { - throw new WrongDataException(WRONG_VALUE . ' `terminalProvider`'); + throw new WrongDataException(WRONG_VALUE . ' `terminalProvider`', 400); } $this->value = $value; diff --git a/src/Api/Tokens/CreatePaymentResource/Response/CreatePaymentResourceResponse.php b/netcat/modules/rbkmoney/src/Api/Tokens/CreatePaymentResource/Response/CreatePaymentResourceResponse.php similarity index 100% rename from src/Api/Tokens/CreatePaymentResource/Response/CreatePaymentResourceResponse.php rename to netcat/modules/rbkmoney/src/Api/Tokens/CreatePaymentResource/Response/CreatePaymentResourceResponse.php diff --git a/src/Api/Webhooks/CreateWebhook/Request/CreateWebhookRequest.php b/netcat/modules/rbkmoney/src/Api/Webhooks/CreateWebhook/Request/CreateWebhookRequest.php similarity index 100% rename from src/Api/Webhooks/CreateWebhook/Request/CreateWebhookRequest.php rename to netcat/modules/rbkmoney/src/Api/Webhooks/CreateWebhook/Request/CreateWebhookRequest.php diff --git a/src/Api/Webhooks/CreateWebhook/Response/CreateWebhookResponse.php b/netcat/modules/rbkmoney/src/Api/Webhooks/CreateWebhook/Response/CreateWebhookResponse.php similarity index 100% rename from src/Api/Webhooks/CreateWebhook/Response/CreateWebhookResponse.php rename to netcat/modules/rbkmoney/src/Api/Webhooks/CreateWebhook/Response/CreateWebhookResponse.php diff --git a/src/Api/Webhooks/CustomersTopicScope.php b/netcat/modules/rbkmoney/src/Api/Webhooks/CustomersTopicScope.php similarity index 99% rename from src/Api/Webhooks/CustomersTopicScope.php rename to netcat/modules/rbkmoney/src/Api/Webhooks/CustomersTopicScope.php index c68d562..b19d067 100644 --- a/src/Api/Webhooks/CustomersTopicScope.php +++ b/netcat/modules/rbkmoney/src/Api/Webhooks/CustomersTopicScope.php @@ -68,7 +68,7 @@ class CustomersTopicScope extends WebhookScope $diff = array_diff($eventTypes, $this->validTypes); if (!empty($diff)) { - throw new WrongDataException(WRONG_VALUE . ' `eventTypes`'); + throw new WrongDataException(WRONG_VALUE . ' `eventTypes`', 400); } $this->eventTypes = $eventTypes; diff --git a/src/Api/Webhooks/GetWebhooks/Request/GetWebhooksRequest.php b/netcat/modules/rbkmoney/src/Api/Webhooks/GetWebhooks/Request/GetWebhooksRequest.php similarity index 100% rename from src/Api/Webhooks/GetWebhooks/Request/GetWebhooksRequest.php rename to netcat/modules/rbkmoney/src/Api/Webhooks/GetWebhooks/Request/GetWebhooksRequest.php diff --git a/src/Api/Webhooks/GetWebhooks/Response/GetWebhooksResponse.php b/netcat/modules/rbkmoney/src/Api/Webhooks/GetWebhooks/Response/GetWebhooksResponse.php similarity index 100% rename from src/Api/Webhooks/GetWebhooks/Response/GetWebhooksResponse.php rename to netcat/modules/rbkmoney/src/Api/Webhooks/GetWebhooks/Response/GetWebhooksResponse.php diff --git a/src/Api/Webhooks/InvoicesTopicScope.php b/netcat/modules/rbkmoney/src/Api/Webhooks/InvoicesTopicScope.php similarity index 99% rename from src/Api/Webhooks/InvoicesTopicScope.php rename to netcat/modules/rbkmoney/src/Api/Webhooks/InvoicesTopicScope.php index 4c96480..96e3edb 100644 --- a/src/Api/Webhooks/InvoicesTopicScope.php +++ b/netcat/modules/rbkmoney/src/Api/Webhooks/InvoicesTopicScope.php @@ -92,7 +92,7 @@ class InvoicesTopicScope extends WebhookScope $diff = array_diff($eventTypes, $this->validTypes); if (!empty($diff)) { - throw new WrongDataException(WRONG_VALUE . ' `eventTypes`'); + throw new WrongDataException(WRONG_VALUE . ' `eventTypes`', 400); } $this->eventTypes = $eventTypes; diff --git a/src/Api/Webhooks/WebhookResponse/WebhookResponse.php b/netcat/modules/rbkmoney/src/Api/Webhooks/WebhookResponse/WebhookResponse.php similarity index 97% rename from src/Api/Webhooks/WebhookResponse/WebhookResponse.php rename to netcat/modules/rbkmoney/src/Api/Webhooks/WebhookResponse/WebhookResponse.php index 1fdb8e1..a92b976 100644 --- a/src/Api/Webhooks/WebhookResponse/WebhookResponse.php +++ b/netcat/modules/rbkmoney/src/Api/Webhooks/WebhookResponse/WebhookResponse.php @@ -90,7 +90,7 @@ class WebhookResponse extends RBKMoneyDataObject implements ResponseInterface return new CustomersTopicScope($scope->shopID, $scope->eventTypes); } - throw new WrongDataException(WRONG_VALUE . ' `topic`'); + throw new WrongDataException(WRONG_VALUE . ' `topic`', 400); } } diff --git a/src/Api/Webhooks/WebhookScope.php b/netcat/modules/rbkmoney/src/Api/Webhooks/WebhookScope.php similarity index 100% rename from src/Api/Webhooks/WebhookScope.php rename to netcat/modules/rbkmoney/src/Api/Webhooks/WebhookScope.php diff --git a/src/Client/Client.php b/netcat/modules/rbkmoney/src/Client/Client.php similarity index 100% rename from src/Client/Client.php rename to netcat/modules/rbkmoney/src/Client/Client.php diff --git a/src/Client/Sender.php b/netcat/modules/rbkmoney/src/Client/Sender.php similarity index 100% rename from src/Client/Sender.php rename to netcat/modules/rbkmoney/src/Client/Sender.php diff --git a/netcat/modules/rbkmoney/src/Exceptions/RBKmoneyException.php b/netcat/modules/rbkmoney/src/Exceptions/RBKmoneyException.php new file mode 100644 index 0000000..84dab1a --- /dev/null +++ b/netcat/modules/rbkmoney/src/Exceptions/RBKmoneyException.php @@ -0,0 +1,13 @@ +