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', + ]; + } +}