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' ];