1
0
mirror of synced 2024-11-24 06:16:27 +03:00

Add support for MG settings

This commit is contained in:
Kirill Sukhorukov 2024-07-09 10:59:51 +03:00
parent bc5d044282
commit 36bf34b511
6 changed files with 164 additions and 1 deletions

View File

@ -0,0 +1,45 @@
<?php
/**
* PHP version 7.3
*
* @category Feature
* @package RetailCrm\Api\Model\Entity\Settings
*/
namespace RetailCrm\Api\Model\Entity\Settings;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/**
* Class ChannelSetting
*
* @category ChannelSetting
* @package RetailCrm\Api\Model\Entity\Settings
*/
class ChannelSetting
{
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("site")
*/
public $site;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("order_type")
*/
public $orderType;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("order_method")
*/
public $orderMethod;
}

View File

@ -0,0 +1,37 @@
<?php
/**
* PHP version 7.3
*
* @category Feature
* @package RetailCrm\Api\Model\Entity\Settings
*/
namespace RetailCrm\Api\Model\Entity\Settings;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/**
* Class MgOrderCreationSettings
*
* @category MgOrderCreationSettings
* @package RetailCrm\Api\Model\Entity\Settings
*/
class MgOrderCreationSettings
{
/**
* @var \RetailCrm\Api\Model\Entity\Settings\ChannelSetting
*
* @JMS\Type("RetailCrm\Api\Model\Entity\Settings\ChannelSetting")
* @JMS\SerializedName("default")
*/
public $default;
/**
* @var array<int, \RetailCrm\Api\Model\Entity\Settings\ChannelSetting>
*
* @JMS\Type("array<int, RetailCrm\Api\Model\Entity\Settings\ChannelSetting>")
* @JMS\SerializedName("channels")
*/
public $channels;
}

View File

@ -0,0 +1,29 @@
<?php
/**
* PHP version 7.3
*
* @category Feature
* @package RetailCrm\Api\Model\Entity\Settings
*/
namespace RetailCrm\Api\Model\Entity\Settings;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/**
* Class MgSettings
*
* @category MgSettings
* @package RetailCrm\Api\Model\Entity\Settings
*/
class MgSettings
{
/**
* @var \RetailCrm\Api\Model\Entity\Settings\MgOrderCreationSettings
*
* @JMS\Type("RetailCrm\Api\Model\Entity\Settings\MgOrderCreationSettings")
* @JMS\SerializedName("order_creation")
*/
public $orderCreation;
}

View File

@ -58,4 +58,12 @@ class Settings
* @JMS\SerializedName("non_working_days")
*/
public $nonWorkingDays;
/**
* @var \RetailCrm\Api\Model\Entity\Settings\MgSettings
*
* @JMS\Type("RetailCrm\Api\Model\Entity\Settings\MgSettings")
* @JMS\SerializedName("mg")
*/
public $mgSettings;
}

View File

@ -11,6 +11,7 @@ namespace RetailCrm\Tests\Model\Callback\Entity\Integration;
use PHPUnit\Framework\TestCase;
use RetailCrm\Api\Factory\SerializerFactory;
use RetailCrm\Api\Model\Entity\Settings\MgSettings;
use RetailCrm\Api\Model\Entity\Settings\NonWorkingDay;
use RetailCrm\Api\Model\Entity\Settings\Settings as SystemSettings;
use RetailCrm\Api\Model\Callback\Entity\Integration\Settings;
@ -50,6 +51,27 @@ class SettingsTest extends TestCase
'start_date' => '05.29',
'end_date' => '06.29'
]
],
'mg' => [
'order_creation' => [
'default' => [
'site' => 'site',
'order_type' => 'type',
'order_method' => 'method',
],
'channels' => [
1111 => [
'site' => 'site_1',
'order_type' => 'type_1',
'order_method' => 'method_1',
],
2222 => [
'site' => 'site_2',
'order_type' => 'type_2',
'order_method' => 'method_2',
],
]
]
]
],
],
@ -61,5 +83,6 @@ class SettingsTest extends TestCase
self::assertInstanceOf(Value::class, $settings->settings->defaultCurrency);
self::assertInstanceOf(WorkTime::class, $settings->settings->workTimes[0]);
self::assertInstanceOf(NonWorkingDay::class, $settings->settings->nonWorkingDays[0]);
self::assertInstanceOf(MgSettings::class, $settings->settings->mgSettings);
}
}

View File

@ -54,7 +54,28 @@ class SettingsTest extends AbstractApiResourceGroupTestCase
"lunch_start_time": "12:30",
"lunch_end_time": "13:00"
}
]
],
"mg": {
"order_creation": {
"default": {
"site": "site",
"order_type": "type",
"order_method": "method"
},
"channels": {
"1111": {
"site": "site_1",
"order_type": "type_1",
"order_method": "method_1"
},
"2222": {
"site": "site_2",
"order_type": "type_2",
"order_method": "method_2"
}
}
}
}
}
}
EOF;