From 1355012c58f58b18006df11d90cb51628f97f1f5 Mon Sep 17 00:00:00 2001 From: Vragov Roman Date: Fri, 29 Apr 2022 12:26:38 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=20Setti?= =?UTF-8?q?ng=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B=20?= =?UTF-8?q?=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA=D0=B8=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=87=D0=B5=D0=B3=D0=BE=20=D0=B2=D1=80=D0=B5?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client_test.go | 22 +++++++++++++++++++++- types.go | 10 ++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/client_test.go b/client_test.go index 57e20ac..771acc9 100644 --- a/client_test.go +++ b/client_test.go @@ -5035,7 +5035,23 @@ func TestClient_Settings(t *testing.T) { "timezone": { "value": "Europe/Moscow", "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" { 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) { diff --git a/types.go b/types.go index 54bee5f..2b4c90d 100644 --- a/types.go +++ b/types.go @@ -694,11 +694,21 @@ type SettingsNode struct { 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. type Settings struct { DefaultCurrency SettingsNode `json:"default_currency"` SystemLanguage SettingsNode `json:"system_language"` Timezone SettingsNode `json:"timezone"` + WorkTimes []WorkTime `json:"work_times"` } /**