From bafdf24755b0b473187badf06d67f3409870aee6 Mon Sep 17 00:00:00 2001 From: Vragov Roman Date: Mon, 26 Dec 2022 16:18:03 +0300 Subject: [PATCH] Add `Settings` field `NonWorkingDays` --- client_test.go | 14 ++++++++++++++ types.go | 15 +++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/client_test.go b/client_test.go index db426fa..63ffdf2 100644 --- a/client_test.go +++ b/client_test.go @@ -5149,6 +5149,16 @@ func TestClient_Settings(t *testing.T) { "lunch_start_time": "13:00", "lunch_end_time": "14:00" } + ], + "non_working_days": [ + { + "start_date": "01.02", + "end_date": "01.07" + }, + { + "start_date": "12.31", + "end_date": "12.31" + } ] } } @@ -5182,6 +5192,10 @@ func TestClient_Settings(t *testing.T) { if data.Settings.WorkTimes[0].DayType != "Monday" { t.Errorf("Invalid work times: %v", data.Settings.WorkTimes[0].DayType) } + + if data.Settings.NonWorkingDays[0].StartDate != "01.02" { + t.Errorf("Invalid excluded days: %v", data.Settings.NonWorkingDays[0].StartDate) + } } func TestClient_Segments_Fail(t *testing.T) { diff --git a/types.go b/types.go index 1144f38..6e48fcf 100644 --- a/types.go +++ b/types.go @@ -705,6 +705,12 @@ type WorkTime struct { LunchEndTime string `json:"lunch_end_time"` } +// NonWorkingDays type. +type NonWorkingDays struct { + StartDate string `json:"start_date"` + EndDate string `json:"end_date"` +} + type SerializedBaseLoyaltyAccount struct { PhoneNumber string `json:"phoneNumber,omitempty"` CardNumber string `json:"cardNumber,omitempty"` @@ -722,10 +728,11 @@ type SerializedEditLoyaltyAccount struct { // Settings type. Contains retailCRM configuration. type Settings struct { - DefaultCurrency SettingsNode `json:"default_currency"` - SystemLanguage SettingsNode `json:"system_language"` - Timezone SettingsNode `json:"timezone"` - WorkTimes []WorkTime `json:"work_times"` + DefaultCurrency SettingsNode `json:"default_currency"` + SystemLanguage SettingsNode `json:"system_language"` + Timezone SettingsNode `json:"timezone"` + WorkTimes []WorkTime `json:"work_times"` + NonWorkingDays []NonWorkingDays `json:"non_working_days"` } /**