1
0
mirror of synced 2024-11-21 21:06:09 +03:00

ref #76758 Разрашено обновления номера телефона, адреса и других полей заказа, связанных с курьерской доставкой (#292)

This commit is contained in:
Kocmonavtik 2023-05-29 14:13:05 +03:00 committed by GitHub
parent c67eb37124
commit cbf8c9ac17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 66 additions and 19 deletions

View File

@ -1,3 +1,6 @@
## 2023-05-18 v.6.3.5
- Добавлен функционал обновления номера телефона, адреса и других полей заказа, связанных с курьерской доставкой
## 2023-04-26 v.6.3.4
- Оптимизирован алгоритм получения истории заказов и клиентов

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<?php
$arModuleVersion = [
'VERSION' => '6.3.4',
'VERSION_DATE' => '2023-04-26 11:00:00'
'VERSION' => '6.3.5',
'VERSION_DATE' => '2023-05-18 18:00:00'
];

View File

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

View File

@ -1,30 +1,17 @@
<?php
use Tests\Intaro\RetailCrm\DataService;
/**
* Class RetailCrmServiceTest
*/
class RetailCrmServiceTest extends PHPUnit\Framework\TestCase
{
private $paramsExample = [
'delivery' => [
'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

View File

@ -0,0 +1,45 @@
<?php
namespace Tests\Intaro\RetailCrm;
/**
* Class DataService
*/
class DataService
{
public static function deliveryDataForValidation()
{
return [
'delivery' => [
'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',
];
}
}