В метод Setting добавлены настройки рабочего времени

This commit is contained in:
Vragov Roman 2022-04-29 12:26:38 +03:00 committed by Vragov Roman
parent 06433b7c19
commit 1355012c58
2 changed files with 31 additions and 1 deletions

View File

@ -5035,7 +5035,23 @@ func TestClient_Settings(t *testing.T) {
"timezone": { "timezone": {
"value": "Europe/Moscow", "value": "Europe/Moscow",
"updated_at": "2019-02-13 13:57:20" "updated_at": "2019-02-13 13:57:20"
},
"work_times": [
{
"day_type": "Monday",
"start_time": "08:00",
"end_time": "18:30",
"lunch_start_time": "15:00",
"lunch_end_time": "16:00"
},
{
"day_type": "Tuesday",
"start_time": "09:00",
"end_time": "17:00",
"lunch_start_time": "13:00",
"lunch_end_time": "14:00"
} }
]
} }
} }
`) `)
@ -5064,6 +5080,10 @@ func TestClient_Settings(t *testing.T) {
if data.Settings.Timezone.Value != "Europe/Moscow" { if data.Settings.Timezone.Value != "Europe/Moscow" {
t.Errorf("Invalid timezone value: %v", data.Settings.Timezone.Value) t.Errorf("Invalid timezone value: %v", data.Settings.Timezone.Value)
} }
if data.Settings.WorkTimes[0].DayType != "Monday" {
t.Errorf("Invalid work times: %v", data.Settings.WorkTimes[0].DayType)
}
} }
func TestClient_Segments_Fail(t *testing.T) { func TestClient_Segments_Fail(t *testing.T) {

View File

@ -694,11 +694,21 @@ type SettingsNode struct {
UpdatedAt string `json:"updated_at"` UpdatedAt string `json:"updated_at"`
} }
// WorkTime type.
type WorkTime struct {
DayType string `json:"day_type"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
LunchStartTime string `json:"lunch_start_time"`
LunchEndTime string `json:"lunch_end_time"`
}
// Settings type. Contains retailCRM configuration. // Settings type. Contains retailCRM configuration.
type Settings struct { type Settings struct {
DefaultCurrency SettingsNode `json:"default_currency"` DefaultCurrency SettingsNode `json:"default_currency"`
SystemLanguage SettingsNode `json:"system_language"` SystemLanguage SettingsNode `json:"system_language"`
Timezone SettingsNode `json:"timezone"` Timezone SettingsNode `json:"timezone"`
WorkTimes []WorkTime `json:"work_times"`
} }
/** /**