1
0
mirror of synced 2024-11-22 13:26:10 +03:00

ref #89535 Исправлено очищение корзины для корпоративных клиентов (#310)

This commit is contained in:
Kocmonavtik 2023-08-29 17:40:10 +03:00 committed by GitHub
parent e003b63f2f
commit 8ce4f5d6c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 44 additions and 8 deletions

View File

@ -1,3 +1,6 @@
## 2023-08-23 v.6.4.2
- Исправлена ошибка создания заказов для корпоративных клиентов при использовании функционала брошенных корзин
## 2023-08-22 v.6.4.1 ## 2023-08-22 v.6.4.1
- Исправлена передача даты регистрации клиента - Исправлена передача даты регистрации клиента

View File

@ -546,13 +546,24 @@ class RCrmActions
'errors' => !empty($result['errors']) ? $result['errors'] : '', 'errors' => !empty($result['errors']) ? $result['errors'] : '',
'params' => $params 'params' => $params
), 'uploadApiErrors'); ), 'uploadApiErrors');
} elseif ($methodApi == 'cartGet') {
Logger::getInstance()->write(
[
'api' => $version,
'methodApi' => $methodApi,
'errorMsg' => !empty($result['errorMsg']) ? $result['errorMsg'] : '',
'errors' => !empty($result['errors']) ? $result['errors'] : '',
'params' => $params,
],
'apiErrors'
);
} else { } else {
self::eventLog( self::eventLog(
__CLASS__ . '::' . $method, __CLASS__ . '::' . $method,
'RetailCrm\ApiClient::' . $methodApi, 'RetailCrm\ApiClient::' . $methodApi,
!empty($result['errorMsg']) ? $result['errorMsg'] : '' !empty($result['errorMsg']) ? $result['errorMsg'] : ''
); );
Logger::getInstance()->write(array( Logger::getInstance()->write(array(
'api' => $version, 'api' => $version,
'methodApi' => $methodApi, 'methodApi' => $methodApi,

View File

@ -109,8 +109,14 @@ class RetailCrmEvent
* *
* @param object $event * @param object $event
*/ */
public static function onChangeBasket($event) public static function onChangeBasket($event)
{ {
$apiVersion = COption::GetOptionString(self::$MODULE_ID, 'api_version', 0);
if ($apiVersion !== 'v5') {
return;
}
$id = \Bitrix\Main\Engine\CurrentUser::get()->getId(); $id = \Bitrix\Main\Engine\CurrentUser::get()->getId();
if ($id) { if ($id) {

View File

@ -17,6 +17,7 @@ use Intaro\RetailCrm\Service\LoyaltyAccountService;
use RetailCrm\Response\ApiResponse; use RetailCrm\Response\ApiResponse;
use \Bitrix\Sale\Location\Name\LocationTable as LocationTableName; use \Bitrix\Sale\Location\Name\LocationTable as LocationTableName;
use Intaro\RetailCrm\Component\ConfigProvider; use Intaro\RetailCrm\Component\ConfigProvider;
use Intaro\RetailCrm\Model\Api\Response\OrdersCreateResponse;
IncludeModuleLangFile(__FILE__); IncludeModuleLangFile(__FILE__);
@ -439,12 +440,27 @@ class RetailCrmOrder
} }
$crmBasket = RCrmActions::apiMethod($api, 'cartGet', __METHOD__, $externalId, $site); $crmBasket = RCrmActions::apiMethod($api, 'cartGet', __METHOD__, $externalId, $site);
$orderResponse = $client->createOrder($order, $site);
if (!empty($crmBasket['cart'])) { if (!empty($crmBasket['cart']) && $orderResponse instanceof OrdersCreateResponse && !empty($orderResponse->id) ) {
$order['isFromCart'] = true; RCrmActions::apiMethod(
$api,
'cartClear',
__METHOD__,
[
'clearedAt' => date('Y-m-d H:i:sP'),
'customer' => [
'externalId' => $externalId
],
'order' => [
'id' => $orderResponse->id
]
],
$site
);
} }
return $client->createOrder($order, $site); return $orderResponse;
} }
if ($methodApi === 'ordersEdit') { if ($methodApi === 'ordersEdit') {

View File

@ -1 +1 @@
- Исправлена передача даты регистрации клиента - Исправлена ошибка создания заказов для корпоративных клиентов при использовании функционала брошенных корзин

View File

@ -1,6 +1,6 @@
<?php <?php
$arModuleVersion = [ $arModuleVersion = [
'VERSION' => '6.4.1', 'VERSION' => '6.4.2',
'VERSION_DATE' => '2023-08-22 9:30:00' 'VERSION_DATE' => '2023-08-23 12:30:00'
]; ];