From c1deb9e91eb136e23f92987e876fbb9c4ed598e7 Mon Sep 17 00:00:00 2001 From: ellynoize <111681973+ellynoize@users.noreply.github.com> Date: Tue, 24 Sep 2024 14:12:33 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BB=D0=BE=D0=B3=D0=B8=D1=80=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BE=D1=82=D0=B2=D0=B5=D1=82=D0=B0=20?= =?UTF-8?q?=D0=BE=D1=82=20API=20=D0=BF=D1=80=D0=B8=20=D0=BD=D0=B5=D1=83?= =?UTF-8?q?=D0=B4=D0=B0=D1=87=D0=BD=D0=BE=D0=BC=20=D1=81=D0=BE=D0=B7=D0=B4?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B8=20=D0=B7=D0=B0=D0=BA=D0=B0=D0=B7=D0=B0?= =?UTF-8?q?=20(#364)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +++ .../classes/general/order/RetailCrmOrder_v5.php | 11 +++++++++++ intaro.retailcrm/description.ru | 2 +- intaro.retailcrm/install/version.php | 4 ++-- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cf48e6c..0b718ad8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2024-09-23 v6.5.31 +- Добавлено логирование ответа от API при неудачном создании заказа + ## 2024-09-23 v6.5.30 - Добавлена передача контрагентов с типом ИП diff --git a/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php b/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php index fbf4dfa4..37f07d1f 100644 --- a/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php +++ b/intaro.retailcrm/classes/general/order/RetailCrmOrder_v5.php @@ -472,6 +472,17 @@ class RetailCrmOrder $crmBasket = RCrmActions::apiMethod($api, 'cartGet', __METHOD__, $externalId, $site); $orderResponse = $client->createOrder($order, $site); + if ($orderResponse instanceof OrdersCreateResponse && !$orderResponse->success) { + + Logger::getInstance()->write([ + 'methodApi' => 'orderCreate', + 'errorMsg' => $orderResponse->errorMsg ?? '', + 'errors' => $orderResponse->errors ?? '', + 'params' => ['number' => $order['number'], 'externalId' => $order['externalId']] + ], 'apiErrors'); + + } + if (!empty($crmBasket['cart']) && $orderResponse instanceof OrdersCreateResponse && !empty($orderResponse->id) ) { RCrmActions::apiMethod( $api, diff --git a/intaro.retailcrm/description.ru b/intaro.retailcrm/description.ru index 9cfe9edd..e15f0f21 100644 --- a/intaro.retailcrm/description.ru +++ b/intaro.retailcrm/description.ru @@ -1 +1 @@ -- Добавлена передача контрагентов с типом ИП +- Добавлено логирование ответа от API при неудачном создании заказа diff --git a/intaro.retailcrm/install/version.php b/intaro.retailcrm/install/version.php index 3b3c1356..bc3cad90 100644 --- a/intaro.retailcrm/install/version.php +++ b/intaro.retailcrm/install/version.php @@ -1,6 +1,6 @@ '6.5.30', - 'VERSION_DATE' => '2024-09-23 15:00:00' + 'VERSION' => '6.5.31', + 'VERSION_DATE' => '2024-09-23 17:00:00' ];