ref #76758 Разрашено обновления номера телефона, адреса и других полей заказа, связанных с курьерской доставкой (#292)
This commit is contained in:
parent
c67eb37124
commit
cbf8c9ac17
@ -1,3 +1,6 @@
|
||||
## 2023-05-18 v.6.3.5
|
||||
- Добавлен функционал обновления номера телефона, адреса и других полей заказа, связанных с курьерской доставкой
|
||||
|
||||
## 2023-04-26 v.6.3.4
|
||||
- Оптимизирован алгоритм получения истории заказов и клиентов
|
||||
|
||||
|
@ -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']);
|
||||
|
@ -1 +1 @@
|
||||
- Оптимизирован алгоритм получения истории заказов и клиентов
|
||||
- Добавлен функционал обновления номера телефона, адреса и других полей заказа, связанных с курьерской доставкой
|
@ -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'
|
||||
];
|
||||
|
@ -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';
|
||||
|
@ -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
|
||||
|
45
tests/datasets/DataService.php
Normal file
45
tests/datasets/DataService.php
Normal 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',
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user