From cbf8c9ac1797693af1829c894097e207c665d637 Mon Sep 17 00:00:00 2001 From: Kocmonavtik <61938582+Kocmonavtik@users.noreply.github.com> Date: Mon, 29 May 2023 14:13:05 +0300 Subject: [PATCH] =?UTF-8?q?ref=20#76758=20=D0=A0=D0=B0=D0=B7=D1=80=D0=B0?= =?UTF-8?q?=D1=88=D0=B5=D0=BD=D0=BE=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BD=D0=BE=D0=BC=D0=B5=D1=80=D0=B0?= =?UTF-8?q?=20=D1=82=D0=B5=D0=BB=D0=B5=D1=84=D0=BE=D0=BD=D0=B0,=20=D0=B0?= =?UTF-8?q?=D0=B4=D1=80=D0=B5=D1=81=D0=B0=20=D0=B8=20=D0=B4=D1=80=D1=83?= =?UTF-8?q?=D0=B3=D0=B8=D1=85=20=D0=BF=D0=BE=D0=BB=D0=B5=D0=B9=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=BA=D0=B0=D0=B7=D0=B0,=20=D1=81=D0=B2=D1=8F=D0=B7?= =?UTF-8?q?=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D1=81=20=D0=BA=D1=83=D1=80?= =?UTF-8?q?=D1=8C=D0=B5=D1=80=D1=81=D0=BA=D0=BE=D0=B9=20=D0=B4=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D0=B2=D0=BA=D0=BE=D0=B9=20(#292)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 ++ .../general/services/RetailCrmService.php | 2 + intaro.retailcrm/description.ru | 2 +- intaro.retailcrm/install/version.php | 4 +- tests/bootstrap.php | 1 + .../general/services/RetailCrmServiceTest.php | 28 +++++------- tests/datasets/DataService.php | 45 +++++++++++++++++++ 7 files changed, 66 insertions(+), 19 deletions(-) create mode 100644 tests/datasets/DataService.php diff --git a/CHANGELOG.md b/CHANGELOG.md index cce34934..51f8a445 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2023-05-18 v.6.3.5 +- Добавлен функционал обновления номера телефона, адреса и других полей заказа, связанных с курьерской доставкой + ## 2023-04-26 v.6.3.4 - Оптимизирован алгоритм получения истории заказов и клиентов diff --git a/intaro.retailcrm/classes/general/services/RetailCrmService.php b/intaro.retailcrm/classes/general/services/RetailCrmService.php index 9a4a87e3..68ef1b87 100644 --- a/intaro.retailcrm/classes/general/services/RetailCrmService.php +++ b/intaro.retailcrm/classes/general/services/RetailCrmService.php @@ -13,6 +13,7 @@ class RetailCrmService public static function unsetIntegrationDeliveryFields(array $order): array { $integrationDelivery = RetailcrmConfigProvider::getCrmIntegrationDelivery(); + if (isset($order['delivery']['code'])) { $deliveryCode = $order['delivery']['code']; @@ -20,6 +21,7 @@ class RetailCrmService && $integrationDelivery[$deliveryCode] !== 'sdek' && $integrationDelivery[$deliveryCode] !== 'dpd' && $integrationDelivery[$deliveryCode] !== 'newpost' + && $integrationDelivery[$deliveryCode] !== 'courier' ) { unset($order['weight']); unset($order['firstName']); diff --git a/intaro.retailcrm/description.ru b/intaro.retailcrm/description.ru index 432b469d..464f841d 100644 --- a/intaro.retailcrm/description.ru +++ b/intaro.retailcrm/description.ru @@ -1 +1 @@ -- Оптимизирован алгоритм получения истории заказов и клиентов \ No newline at end of file +- Добавлен функционал обновления номера телефона, адреса и других полей заказа, связанных с курьерской доставкой \ No newline at end of file diff --git a/intaro.retailcrm/install/version.php b/intaro.retailcrm/install/version.php index a75eb0cd..0b5427f8 100644 --- a/intaro.retailcrm/install/version.php +++ b/intaro.retailcrm/install/version.php @@ -1,6 +1,6 @@ '6.3.4', - 'VERSION_DATE' => '2023-04-26 11:00:00' + 'VERSION' => '6.3.5', + 'VERSION_DATE' => '2023-05-18 18:00:00' ]; diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 7bd87020..3ed3669b 100755 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -45,3 +45,4 @@ $DB->Query($strSql); require_once __DIR__ . '/BitrixTestCase.php'; require_once __DIR__ . '/helpers/Helpers.php'; require_once __DIR__ . '/datasets/DataHistory.php'; +require_once __DIR__ . '/datasets/DataService.php'; diff --git a/tests/classes/general/services/RetailCrmServiceTest.php b/tests/classes/general/services/RetailCrmServiceTest.php index 3b61e7d0..3f0730dd 100644 --- a/tests/classes/general/services/RetailCrmServiceTest.php +++ b/tests/classes/general/services/RetailCrmServiceTest.php @@ -1,30 +1,17 @@ [ - 'code' => 'boxberry', - 'cost' => 'test', - 'address' => 'test', - 'data' => 'test', - ], - 'weight' => 'test', - 'firstName' => 'test', - 'lastName' => 'test', - 'phone' => 'test', - 'paymentType' => 'test', - 'shipmentStore' => 'test', - ]; - public function testOnUnsetIntegrationDeliveryFields() { $value = serialize(['boxberry' => 'test']); COption::SetOptionString(RetailcrmConstants::MODULE_ID, RetailcrmConstants::CRM_INTEGRATION_DELIVERY, $value); - $newParams = RetailCrmService::unsetIntegrationDeliveryFields($this->paramsExample); + $newParams = RetailCrmService::unsetIntegrationDeliveryFields(DataService::deliveryDataForValidation()); $expectedArray = [ 'delivery' => [ 'code' => 'boxberry', @@ -34,6 +21,15 @@ class RetailCrmServiceTest extends PHPUnit\Framework\TestCase $this->assertEquals($newParams, $expectedArray); } + public function testOnUnsetIntegrationDeliveryFieldsWithCourier() + { + $value = serialize(['test' => 'courier']); + COption::SetOptionString(RetailcrmConstants::MODULE_ID, RetailcrmConstants::CRM_INTEGRATION_DELIVERY, $value); + $result = RetailCrmService::unsetIntegrationDeliveryFields(DataService::deliveryDataCourier()); + + $this->assertEquals(DataService::deliveryDataCourier(), $result); + } + /** * @param array $data * @param array $expected diff --git a/tests/datasets/DataService.php b/tests/datasets/DataService.php new file mode 100644 index 00000000..69bab807 --- /dev/null +++ b/tests/datasets/DataService.php @@ -0,0 +1,45 @@ + [ + 'code' => 'boxberry', + 'cost' => 'test', + 'address' => 'test', + 'data' => 'test', + ], + 'weight' => 'test', + 'firstName' => 'test', + 'lastName' => 'test', + 'phone' => 'test', + 'paymentType' => 'test', + 'shipmentStore' => 'test', + ]; + } + + public static function deliveryDataCourier() + { + return [ + 'delivery' => [ + 'code' => 'test', + 'cost' => 500, + 'address' => 'test address', + 'data' => 'test data' + ], + 'weight' => '3', + 'firstName' => 'TestName', + 'lastName' => 'TestLastName', + 'phone' => '89998887766', + 'paymentType' => 'test', + 'shipmentStore' => 'test', + ]; + } +}