mirror of
https://github.com/retailcrm/api-client-go.git
synced 2024-11-25 06:16:03 +03:00
new field Tags in Customer struct
This commit is contained in:
parent
a975815296
commit
84a002991f
@ -9,6 +9,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@ -273,6 +274,10 @@ func TestClient_CustomerChange(t *testing.T) {
|
|||||||
Street: "Кутузовский",
|
Street: "Кутузовский",
|
||||||
Building: "14",
|
Building: "14",
|
||||||
},
|
},
|
||||||
|
Tags: []Tag{
|
||||||
|
{"first", "#3e89b6", false},
|
||||||
|
{"second", "#ffa654", false},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
defer gock.Off()
|
defer gock.Off()
|
||||||
@ -337,7 +342,23 @@ func TestClient_CustomerChange(t *testing.T) {
|
|||||||
Get(fmt.Sprintf("/api/v5/customers/%v", f.ExternalID)).
|
Get(fmt.Sprintf("/api/v5/customers/%v", f.ExternalID)).
|
||||||
MatchParam("by", ByExternalID).
|
MatchParam("by", ByExternalID).
|
||||||
Reply(200).
|
Reply(200).
|
||||||
BodyString(`{"success": true}`)
|
BodyString(`{
|
||||||
|
"success": true,
|
||||||
|
"customer": {
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"name": "first",
|
||||||
|
"color": "#3e89b6",
|
||||||
|
"attached": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "second",
|
||||||
|
"color": "#ffa654",
|
||||||
|
"attached": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}`)
|
||||||
|
|
||||||
data, status, err := c.Customer(f.ExternalID, ByExternalID, "")
|
data, status, err := c.Customer(f.ExternalID, ByExternalID, "")
|
||||||
if err.Error() != "" {
|
if err.Error() != "" {
|
||||||
@ -351,6 +372,10 @@ func TestClient_CustomerChange(t *testing.T) {
|
|||||||
if data.Success != true {
|
if data.Success != true {
|
||||||
t.Errorf("%v", err.ApiError())
|
t.Errorf("%v", err.ApiError())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !reflect.DeepEqual(data.Customer.Tags, f.Tags) {
|
||||||
|
t.Errorf("%v", err.ApiError())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClient_CustomerChange_Fail(t *testing.T) {
|
func TestClient_CustomerChange_Fail(t *testing.T) {
|
||||||
|
49
v5/types.go
49
v5/types.go
@ -26,24 +26,24 @@ type Pagination struct {
|
|||||||
|
|
||||||
// Address type
|
// Address type
|
||||||
type Address struct {
|
type Address struct {
|
||||||
Index string `json:"index,omitempty"`
|
Index string `json:"index,omitempty"`
|
||||||
CountryIso string `json:"countryIso,omitempty"`
|
CountryIso string `json:"countryIso,omitempty"`
|
||||||
Region string `json:"region,omitempty"`
|
Region string `json:"region,omitempty"`
|
||||||
RegionID int `json:"regionId,omitempty"`
|
RegionID int `json:"regionId,omitempty"`
|
||||||
City string `json:"city,omitempty"`
|
City string `json:"city,omitempty"`
|
||||||
CityID int `json:"cityId,omitempty"`
|
CityID int `json:"cityId,omitempty"`
|
||||||
CityType string `json:"cityType,omitempty"`
|
CityType string `json:"cityType,omitempty"`
|
||||||
Street string `json:"street,omitempty"`
|
Street string `json:"street,omitempty"`
|
||||||
StreetID int `json:"streetId,omitempty"`
|
StreetID int `json:"streetId,omitempty"`
|
||||||
StreetType string `json:"streetType,omitempty"`
|
StreetType string `json:"streetType,omitempty"`
|
||||||
Building string `json:"building,omitempty"`
|
Building string `json:"building,omitempty"`
|
||||||
Flat string `json:"flat,omitempty"`
|
Flat string `json:"flat,omitempty"`
|
||||||
Floor int `json:"floor,omitempty"`
|
Floor int `json:"floor,omitempty"`
|
||||||
Block int `json:"block,omitempty"`
|
Block int `json:"block,omitempty"`
|
||||||
House string `json:"house,omitempty"`
|
House string `json:"house,omitempty"`
|
||||||
Metro string `json:"metro,omitempty"`
|
Metro string `json:"metro,omitempty"`
|
||||||
Notes string `json:"notes,omitempty"`
|
Notes string `json:"notes,omitempty"`
|
||||||
Text string `json:"text,omitempty"`
|
Text string `json:"text,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GeoHierarchyRow type
|
// GeoHierarchyRow type
|
||||||
@ -628,15 +628,15 @@ type Segment struct {
|
|||||||
|
|
||||||
// SettingsNode represents an item in settings. All settings nodes contains only string value and update time for now.
|
// SettingsNode represents an item in settings. All settings nodes contains only string value and update time for now.
|
||||||
type SettingsNode struct {
|
type SettingsNode struct {
|
||||||
Value string `json:"value"`
|
Value string `json:"value"`
|
||||||
UpdatedAt string `json:"updated_at"`
|
UpdatedAt string `json:"updated_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1101,3 +1101,10 @@ type Activity struct {
|
|||||||
Active bool `json:"active"`
|
Active bool `json:"active"`
|
||||||
Freeze bool `json:"freeze"`
|
Freeze bool `json:"freeze"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tag struct
|
||||||
|
type Tag struct {
|
||||||
|
Name string `json:"name,omitempty"`
|
||||||
|
Color string `json:"color,omitempty"`
|
||||||
|
Attached bool `json:"attached,omitempty"`
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user