mirror of
https://github.com/retailcrm/api-client-go.git
synced 2024-11-21 20:36:03 +03:00
minimal refactoring due to linter warnings, update .travis configuration
This commit is contained in:
parent
ac512fc03e
commit
78994985fd
@ -1,7 +1,8 @@
|
||||
language: go
|
||||
go:
|
||||
- "1.8"
|
||||
- "1.9"
|
||||
- '1.8'
|
||||
- '1.9'
|
||||
- '1.10'
|
||||
before_install:
|
||||
- go get -v github.com/google/go-querystring/query
|
||||
script: go test -v ./...
|
||||
|
@ -47,7 +47,7 @@ func main() {
|
||||
idata, status, err := c.InventoriesUpload(
|
||||
[]InventoryUpload{
|
||||
{
|
||||
XmlId: "pTKIKAeghYzX21HTdzFCe1",
|
||||
XMLID: "pTKIKAeghYzX21HTdzFCe1",
|
||||
Stores: []InventoryUploadStore{
|
||||
{Code: "test-store-v5", Available: 10, PurchasePrice: 1500},
|
||||
{Code: "test-store-v4", Available: 20, PurchasePrice: 1530},
|
||||
@ -55,7 +55,7 @@ func main() {
|
||||
},
|
||||
},
|
||||
{
|
||||
XmlId: "JQIvcrCtiSpOV3AAfMiQB3",
|
||||
XMLID: "JQIvcrCtiSpOV3AAfMiQB3",
|
||||
Stores: []InventoryUploadStore{
|
||||
{Code: "test-store-v5", Available: 45, PurchasePrice: 1500},
|
||||
{Code: "test-store-v4", Available: 32, PurchasePrice: 1530},
|
||||
|
208
v5/client.go
208
v5/client.go
@ -32,7 +32,7 @@ func (c *Client) GetRequest(urlWithParameters string) ([]byte, int, ErrorRespons
|
||||
var res []byte
|
||||
var bug ErrorResponse
|
||||
|
||||
req, err := http.NewRequest("GET", fmt.Sprintf("%s%s", c.Url, urlWithParameters), nil)
|
||||
req, err := http.NewRequest("GET", fmt.Sprintf("%s%s", c.URL, urlWithParameters), nil)
|
||||
if err != nil {
|
||||
bug.ErrorMsg = err.Error()
|
||||
return res, 0, bug
|
||||
@ -71,7 +71,7 @@ func (c *Client) PostRequest(url string, postParams url.Values) ([]byte, int, Er
|
||||
|
||||
req, err := http.NewRequest(
|
||||
"POST",
|
||||
fmt.Sprintf("%s%s", c.Url, url),
|
||||
fmt.Sprintf("%s%s", c.URL, url),
|
||||
strings.NewReader(postParams.Encode()),
|
||||
)
|
||||
if err != nil {
|
||||
@ -140,13 +140,13 @@ func fillSite(p *url.Values, site []string) {
|
||||
}
|
||||
}
|
||||
|
||||
// ApiVersions get all available API versions for exact account
|
||||
// APIVersions get all available API versions for exact account
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var client = v5.New("https://demo.url", "09jIJ")
|
||||
//
|
||||
// data, status, err := client.ApiVersions()
|
||||
// data, status, err := client.APIVersions()
|
||||
//
|
||||
// if err.ErrorMsg != "" {
|
||||
// fmt.Printf("%v", err.ErrorMsg)
|
||||
@ -159,7 +159,7 @@ func fillSite(p *url.Values, site []string) {
|
||||
// for _, value := range data.versions {
|
||||
// fmt.Printf("%v\n", value)
|
||||
// }
|
||||
func (c *Client) ApiVersions() (*VersionResponse, int, ErrorResponse) {
|
||||
func (c *Client) APIVersions() (*VersionResponse, int, ErrorResponse) {
|
||||
var resp VersionResponse
|
||||
|
||||
data, status, err := c.GetRequest(fmt.Sprintf("%s/api-versions", unversionedPrefix))
|
||||
@ -172,13 +172,13 @@ func (c *Client) ApiVersions() (*VersionResponse, int, ErrorResponse) {
|
||||
return &resp, status, err
|
||||
}
|
||||
|
||||
// ApiCredentials get all available API methods for exact account
|
||||
// APICredentials get all available API methods for exact account
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// var client = v5.New("https://demo.url", "09jIJ")
|
||||
//
|
||||
// data, status, err := client.ApiCredentials()
|
||||
// data, status, err := client.APICredentials()
|
||||
//
|
||||
// if err.ErrorMsg != "" {
|
||||
// fmt.Printf("%v", err.ErrorMsg)
|
||||
@ -191,7 +191,7 @@ func (c *Client) ApiVersions() (*VersionResponse, int, ErrorResponse) {
|
||||
// for _, value := range data.credentials {
|
||||
// fmt.Printf("%v\n", value)
|
||||
// }
|
||||
func (c *Client) ApiCredentials() (*CredentialResponse, int, ErrorResponse) {
|
||||
func (c *Client) APICredentials() (*CredentialResponse, int, ErrorResponse) {
|
||||
var resp CredentialResponse
|
||||
|
||||
data, status, err := c.GetRequest(fmt.Sprintf("%s/credentials", unversionedPrefix))
|
||||
@ -272,10 +272,10 @@ func (c *Client) Customers(parameters CustomersRequest) (*CustomersResponse, int
|
||||
func (c *Client) CustomerCreate(customer Customer, site ...string) (*CustomerChangeResponse, int, ErrorResponse) {
|
||||
var resp CustomerChangeResponse
|
||||
|
||||
customerJson, _ := json.Marshal(&customer)
|
||||
customerJSON, _ := json.Marshal(&customer)
|
||||
|
||||
p := url.Values{
|
||||
"customer": {string(customerJson[:])},
|
||||
"customer": {string(customerJSON[:])},
|
||||
}
|
||||
|
||||
fillSite(&p, site)
|
||||
@ -293,18 +293,18 @@ func (c *Client) CustomerCreate(customer Customer, site ...string) (*CustomerCha
|
||||
// CustomerEdit method
|
||||
func (c *Client) CustomerEdit(customer Customer, by string, site ...string) (*CustomerChangeResponse, int, ErrorResponse) {
|
||||
var resp CustomerChangeResponse
|
||||
var uid = strconv.Itoa(customer.Id)
|
||||
var uid = strconv.Itoa(customer.ID)
|
||||
var context = checkBy(by)
|
||||
|
||||
if context == "externalId" {
|
||||
uid = customer.ExternalId
|
||||
uid = customer.ExternalID
|
||||
}
|
||||
|
||||
customerJson, _ := json.Marshal(&customer)
|
||||
customerJSON, _ := json.Marshal(&customer)
|
||||
|
||||
p := url.Values{
|
||||
"by": {string(context)},
|
||||
"customer": {string(customerJson[:])},
|
||||
"customer": {string(customerJSON[:])},
|
||||
}
|
||||
|
||||
fillSite(&p, site)
|
||||
@ -323,10 +323,10 @@ func (c *Client) CustomerEdit(customer Customer, by string, site ...string) (*Cu
|
||||
func (c *Client) CustomersUpload(customers []Customer, site ...string) (*CustomersUploadResponse, int, ErrorResponse) {
|
||||
var resp CustomersUploadResponse
|
||||
|
||||
uploadJson, _ := json.Marshal(&customers)
|
||||
uploadJSON, _ := json.Marshal(&customers)
|
||||
|
||||
p := url.Values{
|
||||
"customers": {string(uploadJson[:])},
|
||||
"customers": {string(uploadJSON[:])},
|
||||
}
|
||||
|
||||
fillSite(&p, site)
|
||||
@ -345,12 +345,12 @@ func (c *Client) CustomersUpload(customers []Customer, site ...string) (*Custome
|
||||
func (c *Client) CustomersCombine(customers []Customer, resultCustomer Customer) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
|
||||
combineJsonIn, _ := json.Marshal(&customers)
|
||||
combineJsonOut, _ := json.Marshal(&resultCustomer)
|
||||
combineJSONIn, _ := json.Marshal(&customers)
|
||||
combineJSONOut, _ := json.Marshal(&resultCustomer)
|
||||
|
||||
p := url.Values{
|
||||
"customers": {string(combineJsonIn[:])},
|
||||
"resultCustomer": {string(combineJsonOut[:])},
|
||||
"customers": {string(combineJSONIn[:])},
|
||||
"resultCustomer": {string(combineJSONOut[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/customers/combine", versionedPrefix), p)
|
||||
@ -367,10 +367,10 @@ func (c *Client) CustomersCombine(customers []Customer, resultCustomer Customer)
|
||||
func (c *Client) CustomersFixExternalIds(customers []IdentifiersPair) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
|
||||
customersJson, _ := json.Marshal(&customers)
|
||||
customersJSON, _ := json.Marshal(&customers)
|
||||
|
||||
p := url.Values{
|
||||
"customers": {string(customersJson[:])},
|
||||
"customers": {string(customersJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/customers/fix-external-ids", versionedPrefix), p)
|
||||
@ -436,10 +436,10 @@ func (c *Client) Orders(parameters OrdersRequest) (*OrdersResponse, int, ErrorRe
|
||||
// OrderCreate method
|
||||
func (c *Client) OrderCreate(order Order, site ...string) (*CreateResponse, int, ErrorResponse) {
|
||||
var resp CreateResponse
|
||||
orderJson, _ := json.Marshal(&order)
|
||||
orderJSON, _ := json.Marshal(&order)
|
||||
|
||||
p := url.Values{
|
||||
"order": {string(orderJson[:])},
|
||||
"order": {string(orderJSON[:])},
|
||||
}
|
||||
|
||||
fillSite(&p, site)
|
||||
@ -457,18 +457,18 @@ func (c *Client) OrderCreate(order Order, site ...string) (*CreateResponse, int,
|
||||
// OrderEdit method
|
||||
func (c *Client) OrderEdit(order Order, by string, site ...string) (*CreateResponse, int, ErrorResponse) {
|
||||
var resp CreateResponse
|
||||
var uid = strconv.Itoa(order.Id)
|
||||
var uid = strconv.Itoa(order.ID)
|
||||
var context = checkBy(by)
|
||||
|
||||
if context == "externalId" {
|
||||
uid = order.ExternalId
|
||||
uid = order.ExternalID
|
||||
}
|
||||
|
||||
orderJson, _ := json.Marshal(&order)
|
||||
orderJSON, _ := json.Marshal(&order)
|
||||
|
||||
p := url.Values{
|
||||
"by": {string(context)},
|
||||
"order": {string(orderJson[:])},
|
||||
"order": {string(orderJSON[:])},
|
||||
}
|
||||
|
||||
fillSite(&p, site)
|
||||
@ -487,10 +487,10 @@ func (c *Client) OrderEdit(order Order, by string, site ...string) (*CreateRespo
|
||||
func (c *Client) OrdersUpload(orders []Order, site ...string) (*OrdersUploadResponse, int, ErrorResponse) {
|
||||
var resp OrdersUploadResponse
|
||||
|
||||
uploadJson, _ := json.Marshal(&orders)
|
||||
uploadJSON, _ := json.Marshal(&orders)
|
||||
|
||||
p := url.Values{
|
||||
"orders": {string(uploadJson[:])},
|
||||
"orders": {string(uploadJSON[:])},
|
||||
}
|
||||
|
||||
fillSite(&p, site)
|
||||
@ -509,13 +509,13 @@ func (c *Client) OrdersUpload(orders []Order, site ...string) (*OrdersUploadResp
|
||||
func (c *Client) OrdersCombine(technique string, order, resultOrder Order) (*OperationResponse, int, ErrorResponse) {
|
||||
var resp OperationResponse
|
||||
|
||||
combineJsonIn, _ := json.Marshal(&order)
|
||||
combineJsonOut, _ := json.Marshal(&resultOrder)
|
||||
combineJSONIn, _ := json.Marshal(&order)
|
||||
combineJSONOut, _ := json.Marshal(&resultOrder)
|
||||
|
||||
p := url.Values{
|
||||
"technique": {technique},
|
||||
"order": {string(combineJsonIn[:])},
|
||||
"resultOrder": {string(combineJsonOut[:])},
|
||||
"order": {string(combineJSONIn[:])},
|
||||
"resultOrder": {string(combineJSONOut[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/orders/combine", versionedPrefix), p)
|
||||
@ -532,10 +532,10 @@ func (c *Client) OrdersCombine(technique string, order, resultOrder Order) (*Ope
|
||||
func (c *Client) OrdersFixExternalIds(orders []IdentifiersPair) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
|
||||
ordersJson, _ := json.Marshal(&orders)
|
||||
ordersJSON, _ := json.Marshal(&orders)
|
||||
|
||||
p := url.Values{
|
||||
"orders": {string(ordersJson[:])},
|
||||
"orders": {string(ordersJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/orders/fix-external-ids", versionedPrefix), p)
|
||||
@ -597,10 +597,10 @@ func (c *Client) Packs(parameters PacksRequest) (*PacksResponse, int, ErrorRespo
|
||||
// PackCreate method
|
||||
func (c *Client) PackCreate(pack Pack) (*CreateResponse, int, ErrorResponse) {
|
||||
var resp CreateResponse
|
||||
packJson, _ := json.Marshal(&pack)
|
||||
packJSON, _ := json.Marshal(&pack)
|
||||
|
||||
p := url.Values{
|
||||
"pack": {string(packJson[:])},
|
||||
"pack": {string(packJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/orders/packs/create", versionedPrefix), p)
|
||||
@ -617,13 +617,13 @@ func (c *Client) PackCreate(pack Pack) (*CreateResponse, int, ErrorResponse) {
|
||||
func (c *Client) PackEdit(pack Pack) (*CreateResponse, int, ErrorResponse) {
|
||||
var resp CreateResponse
|
||||
|
||||
packJson, _ := json.Marshal(&pack)
|
||||
packJSON, _ := json.Marshal(&pack)
|
||||
|
||||
p := url.Values{
|
||||
"pack": {string(packJson[:])},
|
||||
"pack": {string(packJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/orders/packs/%d/edit", versionedPrefix, pack.Id), p)
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/orders/packs/%d/edit", versionedPrefix, pack.ID), p)
|
||||
if err.ErrorMsg != "" {
|
||||
return &resp, status, err
|
||||
}
|
||||
@ -758,10 +758,10 @@ func (c *Client) Tasks(parameters TasksRequest) (*TasksResponse, int, ErrorRespo
|
||||
// TaskCreate method
|
||||
func (c *Client) TaskCreate(task Task, site ...string) (*CreateResponse, int, ErrorResponse) {
|
||||
var resp CreateResponse
|
||||
taskJson, _ := json.Marshal(&task)
|
||||
taskJSON, _ := json.Marshal(&task)
|
||||
|
||||
p := url.Values{
|
||||
"task": {string(taskJson[:])},
|
||||
"task": {string(taskJSON[:])},
|
||||
}
|
||||
|
||||
fillSite(&p, site)
|
||||
@ -779,12 +779,12 @@ func (c *Client) TaskCreate(task Task, site ...string) (*CreateResponse, int, Er
|
||||
// TaskEdit method
|
||||
func (c *Client) TaskEdit(task Task, site ...string) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
var uid = strconv.Itoa(task.Id)
|
||||
var uid = strconv.Itoa(task.ID)
|
||||
|
||||
taskJson, _ := json.Marshal(&task)
|
||||
taskJSON, _ := json.Marshal(&task)
|
||||
|
||||
p := url.Values{
|
||||
"task": {string(taskJson[:])},
|
||||
"task": {string(taskJSON[:])},
|
||||
}
|
||||
|
||||
fillSite(&p, site)
|
||||
@ -819,10 +819,10 @@ func (c *Client) Notes(parameters NotesRequest) (*NotesResponse, int, ErrorRespo
|
||||
func (c *Client) NoteCreate(note Note, site ...string) (*CreateResponse, int, ErrorResponse) {
|
||||
var resp CreateResponse
|
||||
|
||||
noteJson, _ := json.Marshal(¬e)
|
||||
noteJSON, _ := json.Marshal(¬e)
|
||||
|
||||
p := url.Values{
|
||||
"note": {string(noteJson[:])},
|
||||
"note": {string(noteJSON[:])},
|
||||
}
|
||||
|
||||
fillSite(&p, site)
|
||||
@ -859,10 +859,10 @@ func (c *Client) NoteDelete(id int) (*SucessfulResponse, int, ErrorResponse) {
|
||||
func (c *Client) PaymentCreate(payment Payment, site ...string) (*CreateResponse, int, ErrorResponse) {
|
||||
var resp CreateResponse
|
||||
|
||||
paymentJson, _ := json.Marshal(&payment)
|
||||
paymentJSON, _ := json.Marshal(&payment)
|
||||
|
||||
p := url.Values{
|
||||
"payment": {string(paymentJson[:])},
|
||||
"payment": {string(paymentJSON[:])},
|
||||
}
|
||||
|
||||
fillSite(&p, site)
|
||||
@ -898,17 +898,17 @@ func (c *Client) PaymentDelete(id int) (*SucessfulResponse, int, ErrorResponse)
|
||||
// PaymentEdit method
|
||||
func (c *Client) PaymentEdit(payment Payment, by string, site ...string) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
var uid = strconv.Itoa(payment.Id)
|
||||
var uid = strconv.Itoa(payment.ID)
|
||||
var context = checkBy(by)
|
||||
|
||||
if context == "externalId" {
|
||||
uid = payment.ExternalId
|
||||
uid = payment.ExternalID
|
||||
}
|
||||
|
||||
paymentJson, _ := json.Marshal(&payment)
|
||||
paymentJSON, _ := json.Marshal(&payment)
|
||||
|
||||
p := url.Values{
|
||||
"payment": {string(paymentJson[:])},
|
||||
"payment": {string(paymentJSON[:])},
|
||||
}
|
||||
|
||||
fillSite(&p, site)
|
||||
@ -1165,10 +1165,10 @@ func (c *Client) Stores() (*StoresResponse, int, ErrorResponse) {
|
||||
func (c *Client) CostGroupEdit(costGroup CostGroup) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
|
||||
objJson, _ := json.Marshal(&costGroup)
|
||||
objJSON, _ := json.Marshal(&costGroup)
|
||||
|
||||
p := url.Values{
|
||||
"costGroup": {string(objJson[:])},
|
||||
"costGroup": {string(objJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/reference/cost-groups/%s/edit", versionedPrefix, costGroup.Code), p)
|
||||
@ -1185,10 +1185,10 @@ func (c *Client) CostGroupEdit(costGroup CostGroup) (*SucessfulResponse, int, Er
|
||||
func (c *Client) CostItemEdit(costItem CostItem) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
|
||||
objJson, _ := json.Marshal(&costItem)
|
||||
objJSON, _ := json.Marshal(&costItem)
|
||||
|
||||
p := url.Values{
|
||||
"costItem": {string(objJson[:])},
|
||||
"costItem": {string(objJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/reference/cost-items/%s/edit", versionedPrefix, costItem.Code), p)
|
||||
@ -1205,10 +1205,10 @@ func (c *Client) CostItemEdit(costItem CostItem) (*SucessfulResponse, int, Error
|
||||
func (c *Client) CourierCreate(courier Courier) (*CreateResponse, int, ErrorResponse) {
|
||||
var resp CreateResponse
|
||||
|
||||
objJson, _ := json.Marshal(&courier)
|
||||
objJSON, _ := json.Marshal(&courier)
|
||||
|
||||
p := url.Values{
|
||||
"courier": {string(objJson[:])},
|
||||
"courier": {string(objJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/reference/couriers/create", versionedPrefix), p)
|
||||
@ -1225,13 +1225,13 @@ func (c *Client) CourierCreate(courier Courier) (*CreateResponse, int, ErrorResp
|
||||
func (c *Client) CourierEdit(courier Courier) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
|
||||
objJson, _ := json.Marshal(&courier)
|
||||
objJSON, _ := json.Marshal(&courier)
|
||||
|
||||
p := url.Values{
|
||||
"courier": {string(objJson[:])},
|
||||
"courier": {string(objJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/reference/couriers/%d/edit", versionedPrefix, courier.Id), p)
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/reference/couriers/%d/edit", versionedPrefix, courier.ID), p)
|
||||
if err.ErrorMsg != "" {
|
||||
return &resp, status, err
|
||||
}
|
||||
@ -1245,10 +1245,10 @@ func (c *Client) CourierEdit(courier Courier) (*SucessfulResponse, int, ErrorRes
|
||||
func (c *Client) DeliveryServiceEdit(deliveryService DeliveryService) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
|
||||
objJson, _ := json.Marshal(&deliveryService)
|
||||
objJSON, _ := json.Marshal(&deliveryService)
|
||||
|
||||
p := url.Values{
|
||||
"deliveryService": {string(objJson[:])},
|
||||
"deliveryService": {string(objJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/reference/delivery-services/%s/edit", versionedPrefix, deliveryService.Code), p)
|
||||
@ -1265,10 +1265,10 @@ func (c *Client) DeliveryServiceEdit(deliveryService DeliveryService) (*Sucessfu
|
||||
func (c *Client) DeliveryTypeEdit(deliveryType DeliveryType) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
|
||||
objJson, _ := json.Marshal(&deliveryType)
|
||||
objJSON, _ := json.Marshal(&deliveryType)
|
||||
|
||||
p := url.Values{
|
||||
"deliveryType": {string(objJson[:])},
|
||||
"deliveryType": {string(objJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/reference/delivery-types/%s/edit", versionedPrefix, deliveryType.Code), p)
|
||||
@ -1281,14 +1281,14 @@ func (c *Client) DeliveryTypeEdit(deliveryType DeliveryType) (*SucessfulResponse
|
||||
return &resp, status, err
|
||||
}
|
||||
|
||||
// LegalEntityEditorderMe method
|
||||
// LegalEntityEdit method
|
||||
func (c *Client) LegalEntityEdit(legalEntity LegalEntity) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
|
||||
objJson, _ := json.Marshal(&legalEntity)
|
||||
objJSON, _ := json.Marshal(&legalEntity)
|
||||
|
||||
p := url.Values{
|
||||
"legalEntity": {string(objJson[:])},
|
||||
"legalEntity": {string(objJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/reference/legal-entities/%s/edit", versionedPrefix, legalEntity.Code), p)
|
||||
@ -1305,10 +1305,10 @@ func (c *Client) LegalEntityEdit(legalEntity LegalEntity) (*SucessfulResponse, i
|
||||
func (c *Client) OrderMethodEdit(orderMethod OrderMethod) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
|
||||
objJson, _ := json.Marshal(&orderMethod)
|
||||
objJSON, _ := json.Marshal(&orderMethod)
|
||||
|
||||
p := url.Values{
|
||||
"orderMethod": {string(objJson[:])},
|
||||
"orderMethod": {string(objJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/reference/order-methods/%s/edit", versionedPrefix, orderMethod.Code), p)
|
||||
@ -1325,10 +1325,10 @@ func (c *Client) OrderMethodEdit(orderMethod OrderMethod) (*SucessfulResponse, i
|
||||
func (c *Client) OrderTypeEdit(orderType OrderType) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
|
||||
objJson, _ := json.Marshal(&orderType)
|
||||
objJSON, _ := json.Marshal(&orderType)
|
||||
|
||||
p := url.Values{
|
||||
"orderType": {string(objJson[:])},
|
||||
"orderType": {string(objJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/reference/order-types/%s/edit", versionedPrefix, orderType.Code), p)
|
||||
@ -1345,10 +1345,10 @@ func (c *Client) OrderTypeEdit(orderType OrderType) (*SucessfulResponse, int, Er
|
||||
func (c *Client) PaymentStatusEdit(paymentStatus PaymentStatus) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
|
||||
objJson, _ := json.Marshal(&paymentStatus)
|
||||
objJSON, _ := json.Marshal(&paymentStatus)
|
||||
|
||||
p := url.Values{
|
||||
"paymentStatus": {string(objJson[:])},
|
||||
"paymentStatus": {string(objJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/reference/payment-statuses/%s/edit", versionedPrefix, paymentStatus.Code), p)
|
||||
@ -1365,10 +1365,10 @@ func (c *Client) PaymentStatusEdit(paymentStatus PaymentStatus) (*SucessfulRespo
|
||||
func (c *Client) PaymentTypeEdit(paymentType PaymentType) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
|
||||
objJson, _ := json.Marshal(&paymentType)
|
||||
objJSON, _ := json.Marshal(&paymentType)
|
||||
|
||||
p := url.Values{
|
||||
"paymentType": {string(objJson[:])},
|
||||
"paymentType": {string(objJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/reference/payment-types/%s/edit", versionedPrefix, paymentType.Code), p)
|
||||
@ -1385,10 +1385,10 @@ func (c *Client) PaymentTypeEdit(paymentType PaymentType) (*SucessfulResponse, i
|
||||
func (c *Client) PriceTypeEdit(priceType PriceType) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
|
||||
objJson, _ := json.Marshal(&priceType)
|
||||
objJSON, _ := json.Marshal(&priceType)
|
||||
|
||||
p := url.Values{
|
||||
"priceType": {string(objJson[:])},
|
||||
"priceType": {string(objJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/reference/price-types/%s/edit", versionedPrefix, priceType.Code), p)
|
||||
@ -1405,10 +1405,10 @@ func (c *Client) PriceTypeEdit(priceType PriceType) (*SucessfulResponse, int, Er
|
||||
func (c *Client) ProductStatusEdit(productStatus ProductStatus) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
|
||||
objJson, _ := json.Marshal(&productStatus)
|
||||
objJSON, _ := json.Marshal(&productStatus)
|
||||
|
||||
p := url.Values{
|
||||
"productStatus": {string(objJson[:])},
|
||||
"productStatus": {string(objJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/reference/product-statuses/%s/edit", versionedPrefix, productStatus.Code), p)
|
||||
@ -1425,10 +1425,10 @@ func (c *Client) ProductStatusEdit(productStatus ProductStatus) (*SucessfulRespo
|
||||
func (c *Client) StatusEdit(st Status) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
|
||||
objJson, _ := json.Marshal(&st)
|
||||
objJSON, _ := json.Marshal(&st)
|
||||
|
||||
p := url.Values{
|
||||
"status": {string(objJson[:])},
|
||||
"status": {string(objJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/reference/statuses/%s/edit", versionedPrefix, st.Code), p)
|
||||
@ -1445,10 +1445,10 @@ func (c *Client) StatusEdit(st Status) (*SucessfulResponse, int, ErrorResponse)
|
||||
func (c *Client) SiteEdit(site Site) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
|
||||
objJson, _ := json.Marshal(&site)
|
||||
objJSON, _ := json.Marshal(&site)
|
||||
|
||||
p := url.Values{
|
||||
"site": {string(objJson[:])},
|
||||
"site": {string(objJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/reference/sites/%s/edit", versionedPrefix, site.Code), p)
|
||||
@ -1465,10 +1465,10 @@ func (c *Client) SiteEdit(site Site) (*SucessfulResponse, int, ErrorResponse) {
|
||||
func (c *Client) StoreEdit(store Store) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
|
||||
objJson, _ := json.Marshal(&store)
|
||||
objJSON, _ := json.Marshal(&store)
|
||||
|
||||
p := url.Values{
|
||||
"store": {string(objJson[:])},
|
||||
"store": {string(objJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/reference/stores/%s/edit", versionedPrefix, store.Code), p)
|
||||
@ -1501,10 +1501,10 @@ func (c *Client) Inventories(parameters InventoriesRequest) (*InventoriesRespons
|
||||
func (c *Client) InventoriesUpload(inventories []InventoryUpload, site ...string) (*StoreUploadResponse, int, ErrorResponse) {
|
||||
var resp StoreUploadResponse
|
||||
|
||||
uploadJson, _ := json.Marshal(&inventories)
|
||||
uploadJSON, _ := json.Marshal(&inventories)
|
||||
|
||||
p := url.Values{
|
||||
"offers": {string(uploadJson[:])},
|
||||
"offers": {string(uploadJSON[:])},
|
||||
}
|
||||
|
||||
fillSite(&p, site)
|
||||
@ -1523,10 +1523,10 @@ func (c *Client) InventoriesUpload(inventories []InventoryUpload, site ...string
|
||||
func (c *Client) PricesUpload(prices []OfferPriceUpload) (*StoreUploadResponse, int, ErrorResponse) {
|
||||
var resp StoreUploadResponse
|
||||
|
||||
uploadJson, _ := json.Marshal(&prices)
|
||||
uploadJSON, _ := json.Marshal(&prices)
|
||||
|
||||
p := url.Values{
|
||||
"prices": {string(uploadJson[:])},
|
||||
"prices": {string(uploadJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/store/prices/upload", versionedPrefix), p)
|
||||
@ -1555,7 +1555,7 @@ func (c *Client) ProductsGroup(parameters ProductsGroupsRequest) (*ProductsGroup
|
||||
return &resp, status, err
|
||||
}
|
||||
|
||||
// ProductsGroup method
|
||||
// Products method
|
||||
func (c *Client) Products(parameters ProductsRequest) (*ProductsResponse, int, ErrorResponse) {
|
||||
var resp ProductsResponse
|
||||
|
||||
@ -1591,10 +1591,10 @@ func (c *Client) ProductsProperties(parameters ProductsPropertiesRequest) (*Prod
|
||||
func (c *Client) DeliveryTracking(parameters DeliveryTrackingRequest, subcode string) (*SucessfulResponse, int, ErrorResponse) {
|
||||
var resp SucessfulResponse
|
||||
|
||||
updateJson, _ := json.Marshal(¶meters)
|
||||
updateJSON, _ := json.Marshal(¶meters)
|
||||
|
||||
p := url.Values{
|
||||
"statusUpdate": {string(updateJson[:])},
|
||||
"statusUpdate": {string(updateJSON[:])},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/delivery/generic/%s/tracking", versionedPrefix, subcode), p)
|
||||
@ -1623,11 +1623,11 @@ func (c *Client) DeliveryShipments(parameters DeliveryShipmentsRequest) (*Delive
|
||||
return &resp, status, err
|
||||
}
|
||||
|
||||
// DeliveryShipments method
|
||||
// DeliveryShipment method
|
||||
func (c *Client) DeliveryShipment(id int) (*DeliveryShipmentResponse, int, ErrorResponse) {
|
||||
var resp DeliveryShipmentResponse
|
||||
|
||||
data, status, err := c.GetRequest(fmt.Sprintf("%s/delivery/shipments/%s", versionedPrefix, id))
|
||||
data, status, err := c.GetRequest(fmt.Sprintf("%s/delivery/shipments/%d", versionedPrefix, id))
|
||||
if err.ErrorMsg != "" {
|
||||
return &resp, status, err
|
||||
}
|
||||
@ -1640,15 +1640,15 @@ func (c *Client) DeliveryShipment(id int) (*DeliveryShipmentResponse, int, Error
|
||||
// DeliveryShipmentEdit method
|
||||
func (c *Client) DeliveryShipmentEdit(shipment DeliveryShipment, site ...string) (*DeliveryShipmentUpdateResponse, int, ErrorResponse) {
|
||||
var resp DeliveryShipmentUpdateResponse
|
||||
updateJson, _ := json.Marshal(&shipment)
|
||||
updateJSON, _ := json.Marshal(&shipment)
|
||||
|
||||
p := url.Values{
|
||||
"deliveryShipment": {string(updateJson[:])},
|
||||
"deliveryShipment": {string(updateJSON[:])},
|
||||
}
|
||||
|
||||
fillSite(&p, site)
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/delivery/shipments/%s/edit", versionedPrefix, strconv.Itoa(shipment.Id)), p)
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/delivery/shipments/%s/edit", versionedPrefix, strconv.Itoa(shipment.ID)), p)
|
||||
if err.ErrorMsg != "" {
|
||||
return &resp, status, err
|
||||
}
|
||||
@ -1661,11 +1661,11 @@ func (c *Client) DeliveryShipmentEdit(shipment DeliveryShipment, site ...string)
|
||||
// DeliveryShipmentCreate method
|
||||
func (c *Client) DeliveryShipmentCreate(shipment DeliveryShipment, deliveryType string, site ...string) (*DeliveryShipmentUpdateResponse, int, ErrorResponse) {
|
||||
var resp DeliveryShipmentUpdateResponse
|
||||
updateJson, _ := json.Marshal(&shipment)
|
||||
updateJSON, _ := json.Marshal(&shipment)
|
||||
|
||||
p := url.Values{
|
||||
"deliveryType": {string(deliveryType)},
|
||||
"deliveryShipment": {string(updateJson[:])},
|
||||
"deliveryShipment": {string(updateJSON[:])},
|
||||
}
|
||||
|
||||
fillSite(&p, site)
|
||||
@ -1697,9 +1697,9 @@ func (c *Client) IntegrationModule(code string) (*IntegrationModuleResponse, int
|
||||
// IntegrationModuleEdit method
|
||||
func (c *Client) IntegrationModuleEdit(integrationModule IntegrationModule) (*IntegrationModuleEditResponse, int, ErrorResponse) {
|
||||
var resp IntegrationModuleEditResponse
|
||||
updateJson, _ := json.Marshal(&integrationModule)
|
||||
updateJSON, _ := json.Marshal(&integrationModule)
|
||||
|
||||
p := url.Values{"integrationModule": {string(updateJson[:])}}
|
||||
p := url.Values{"integrationModule": {string(updateJSON[:])}}
|
||||
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("%s/integration-modules/%s/edit", versionedPrefix, integrationModule.Code), p)
|
||||
if err.ErrorMsg != "" {
|
||||
|
@ -55,7 +55,7 @@ func TestPostRequest(t *testing.T) {
|
||||
func TestClient_ApiVersionsVersions(t *testing.T) {
|
||||
c := client()
|
||||
|
||||
data, status, err := c.ApiVersions()
|
||||
data, status, err := c.APIVersions()
|
||||
if err.ErrorMsg != "" {
|
||||
t.Fail()
|
||||
}
|
||||
@ -72,7 +72,7 @@ func TestClient_ApiVersionsVersions(t *testing.T) {
|
||||
func TestClient_ApiCredentialsCredentials(t *testing.T) {
|
||||
c := client()
|
||||
|
||||
data, status, err := c.ApiCredentials()
|
||||
data, status, err := c.APICredentials()
|
||||
if err.ErrorMsg != "" {
|
||||
t.Fail()
|
||||
}
|
||||
@ -119,7 +119,7 @@ func TestClient_CustomerChange(t *testing.T) {
|
||||
FirstName: "Понтелей",
|
||||
LastName: "Турбин",
|
||||
Patronymic: "Аристархович",
|
||||
ExternalId: RandomString(8),
|
||||
ExternalID: RandomString(8),
|
||||
Email: fmt.Sprintf("%s@example.com", RandomString(8)),
|
||||
Address: &Address{
|
||||
City: "Москва",
|
||||
@ -144,7 +144,7 @@ func TestClient_CustomerChange(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
f.Id = cr.Id
|
||||
f.ID = cr.ID
|
||||
f.Vip = true
|
||||
|
||||
ed, se, err := c.CustomerEdit(f, "id")
|
||||
@ -163,7 +163,7 @@ func TestClient_CustomerChange(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
data, status, err := c.Customer(f.ExternalId, "externalId", "")
|
||||
data, status, err := c.Customer(f.ExternalID, "externalId", "")
|
||||
if err.ErrorMsg != "" {
|
||||
t.Errorf("%v", err.ErrorMsg)
|
||||
t.Fail()
|
||||
@ -179,7 +179,7 @@ func TestClient_CustomerChange(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
if data.Customer.ExternalId != f.ExternalId {
|
||||
if data.Customer.ExternalID != f.ExternalID {
|
||||
t.Errorf("%v", err.ErrorMsg)
|
||||
t.Fail()
|
||||
}
|
||||
@ -193,7 +193,7 @@ func TestClient_CustomersUpload(t *testing.T) {
|
||||
customers[i] = Customer{
|
||||
FirstName: fmt.Sprintf("Name_%s", RandomString(8)),
|
||||
LastName: fmt.Sprintf("Test_%s", RandomString(8)),
|
||||
ExternalId: RandomString(8),
|
||||
ExternalID: RandomString(8),
|
||||
Email: fmt.Sprintf("%s@example.com", RandomString(8)),
|
||||
}
|
||||
}
|
||||
@ -221,7 +221,7 @@ func TestClient_CustomersCombine(t *testing.T) {
|
||||
dataFirst, status, err := c.CustomerCreate(Customer{
|
||||
FirstName: fmt.Sprintf("Name_%s", RandomString(8)),
|
||||
LastName: fmt.Sprintf("Test_%s", RandomString(8)),
|
||||
ExternalId: RandomString(8),
|
||||
ExternalID: RandomString(8),
|
||||
Email: fmt.Sprintf("%s@example.com", RandomString(8)),
|
||||
})
|
||||
if err.ErrorMsg != "" {
|
||||
@ -242,7 +242,7 @@ func TestClient_CustomersCombine(t *testing.T) {
|
||||
dataSecond, status, err := c.CustomerCreate(Customer{
|
||||
FirstName: fmt.Sprintf("Name_%s", RandomString(8)),
|
||||
LastName: fmt.Sprintf("Test_%s", RandomString(8)),
|
||||
ExternalId: RandomString(8),
|
||||
ExternalID: RandomString(8),
|
||||
Email: fmt.Sprintf("%s@example.com", RandomString(8)),
|
||||
})
|
||||
if err.ErrorMsg != "" {
|
||||
@ -263,7 +263,7 @@ func TestClient_CustomersCombine(t *testing.T) {
|
||||
dataThird, status, err := c.CustomerCreate(Customer{
|
||||
FirstName: fmt.Sprintf("Name_%s", RandomString(8)),
|
||||
LastName: fmt.Sprintf("Test_%s", RandomString(8)),
|
||||
ExternalId: RandomString(8),
|
||||
ExternalID: RandomString(8),
|
||||
Email: fmt.Sprintf("%s@example.com", RandomString(8)),
|
||||
})
|
||||
if err.ErrorMsg != "" {
|
||||
@ -281,7 +281,7 @@ func TestClient_CustomersCombine(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
data, status, err := c.CustomersCombine([]Customer{{Id: dataFirst.Id}, {Id: dataSecond.Id}}, Customer{Id: dataThird.Id})
|
||||
data, status, err := c.CustomersCombine([]Customer{{ID: dataFirst.ID}, {ID: dataSecond.ID}}, Customer{ID: dataThird.ID})
|
||||
if err.ErrorMsg != "" {
|
||||
t.Errorf("%v", err.ErrorMsg)
|
||||
t.Fail()
|
||||
@ -303,7 +303,7 @@ func TestClient_CustomersFixExternalIds(t *testing.T) {
|
||||
f := Customer{
|
||||
FirstName: fmt.Sprintf("Name_%s", RandomString(8)),
|
||||
LastName: fmt.Sprintf("Test_%s", RandomString(8)),
|
||||
ExternalId: RandomString(8),
|
||||
ExternalID: RandomString(8),
|
||||
Email: fmt.Sprintf("%s@example.com", RandomString(8)),
|
||||
}
|
||||
|
||||
@ -324,8 +324,8 @@ func TestClient_CustomersFixExternalIds(t *testing.T) {
|
||||
}
|
||||
|
||||
customers := []IdentifiersPair{{
|
||||
Id: cr.Id,
|
||||
ExternalId: RandomString(8),
|
||||
ID: cr.ID,
|
||||
ExternalID: RandomString(8),
|
||||
}}
|
||||
|
||||
fx, fe, err := c.CustomersFixExternalIds(customers)
|
||||
@ -349,7 +349,7 @@ func TestClient_CustomersHistory(t *testing.T) {
|
||||
c := client()
|
||||
f := CustomersHistoryRequest{
|
||||
Filter: CustomersHistoryFilter{
|
||||
SinceId: 20,
|
||||
SinceID: 20,
|
||||
},
|
||||
}
|
||||
|
||||
@ -402,7 +402,7 @@ func TestClient_NotesCreateDelete(t *testing.T) {
|
||||
FirstName: "Понтелей",
|
||||
LastName: "Турбин",
|
||||
Patronymic: "Аристархович",
|
||||
ExternalId: RandomString(8),
|
||||
ExternalID: RandomString(8),
|
||||
Email: fmt.Sprintf("%s@example.com", RandomString(8)),
|
||||
})
|
||||
if err.ErrorMsg != "" {
|
||||
@ -422,9 +422,9 @@ func TestClient_NotesCreateDelete(t *testing.T) {
|
||||
|
||||
noteCreateResponse, noteCreateStatus, err := c.NoteCreate(Note{
|
||||
Text: "some text",
|
||||
ManagerId: user,
|
||||
ManagerID: user,
|
||||
Customer: &Customer{
|
||||
Id: createCustomerResponse.Id,
|
||||
ID: createCustomerResponse.ID,
|
||||
},
|
||||
})
|
||||
if err.ErrorMsg != "" {
|
||||
@ -442,7 +442,7 @@ func TestClient_NotesCreateDelete(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
noteDeleteResponse, noteDeleteStatus, err := c.NoteDelete(noteCreateResponse.Id)
|
||||
noteDeleteResponse, noteDeleteStatus, err := c.NoteDelete(noteCreateResponse.ID)
|
||||
if err.ErrorMsg != "" {
|
||||
t.Errorf("%v", err.ErrorMsg)
|
||||
t.Fail()
|
||||
@ -488,7 +488,7 @@ func TestClient_OrderChange(t *testing.T) {
|
||||
FirstName: "Понтелей",
|
||||
LastName: "Турбин",
|
||||
Patronymic: "Аристархович",
|
||||
ExternalId: random,
|
||||
ExternalID: random,
|
||||
Email: fmt.Sprintf("%s@example.com", random),
|
||||
}
|
||||
|
||||
@ -508,7 +508,7 @@ func TestClient_OrderChange(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
f.Id = cr.Id
|
||||
f.ID = cr.ID
|
||||
f.CustomerComment = "test comment"
|
||||
|
||||
ed, se, err := c.OrderEdit(f, "id")
|
||||
@ -527,7 +527,7 @@ func TestClient_OrderChange(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
data, status, err := c.Order(f.ExternalId, "externalId", "")
|
||||
data, status, err := c.Order(f.ExternalID, "externalId", "")
|
||||
if err.ErrorMsg != "" {
|
||||
t.Errorf("%v", err.ErrorMsg)
|
||||
t.Fail()
|
||||
@ -543,7 +543,7 @@ func TestClient_OrderChange(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
if data.Order.ExternalId != f.ExternalId {
|
||||
if data.Order.ExternalID != f.ExternalID {
|
||||
t.Errorf("%v", err.ErrorMsg)
|
||||
t.Fail()
|
||||
}
|
||||
@ -557,7 +557,7 @@ func TestClient_OrdersUpload(t *testing.T) {
|
||||
orders[i] = Order{
|
||||
FirstName: fmt.Sprintf("Name_%s", RandomString(8)),
|
||||
LastName: fmt.Sprintf("Test_%s", RandomString(8)),
|
||||
ExternalId: RandomString(8),
|
||||
ExternalID: RandomString(8),
|
||||
Email: fmt.Sprintf("%s@example.com", RandomString(8)),
|
||||
}
|
||||
}
|
||||
@ -585,7 +585,7 @@ func TestClient_OrdersCombine(t *testing.T) {
|
||||
dataFirst, status, err := c.OrderCreate(Order{
|
||||
FirstName: fmt.Sprintf("Name_%s", RandomString(8)),
|
||||
LastName: fmt.Sprintf("Test_%s", RandomString(8)),
|
||||
ExternalId: RandomString(8),
|
||||
ExternalID: RandomString(8),
|
||||
Email: fmt.Sprintf("%s@example.com", RandomString(8)),
|
||||
})
|
||||
if err.ErrorMsg != "" {
|
||||
@ -606,7 +606,7 @@ func TestClient_OrdersCombine(t *testing.T) {
|
||||
dataSecond, status, err := c.OrderCreate(Order{
|
||||
FirstName: fmt.Sprintf("Name_%s", RandomString(8)),
|
||||
LastName: fmt.Sprintf("Test_%s", RandomString(8)),
|
||||
ExternalId: RandomString(8),
|
||||
ExternalID: RandomString(8),
|
||||
Email: fmt.Sprintf("%s@example.com", RandomString(8)),
|
||||
})
|
||||
if err.ErrorMsg != "" {
|
||||
@ -624,7 +624,7 @@ func TestClient_OrdersCombine(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
data, status, err := c.OrdersCombine("ours", Order{Id: dataFirst.Id}, Order{Id: dataSecond.Id})
|
||||
data, status, err := c.OrdersCombine("ours", Order{ID: dataFirst.ID}, Order{ID: dataSecond.ID})
|
||||
if err.ErrorMsg != "" {
|
||||
t.Errorf("%v", err.ErrorMsg)
|
||||
t.Fail()
|
||||
@ -646,7 +646,7 @@ func TestClient_OrdersFixExternalIds(t *testing.T) {
|
||||
f := Order{
|
||||
FirstName: fmt.Sprintf("Name_%s", RandomString(8)),
|
||||
LastName: fmt.Sprintf("Test_%s", RandomString(8)),
|
||||
ExternalId: RandomString(8),
|
||||
ExternalID: RandomString(8),
|
||||
Email: fmt.Sprintf("%s@example.com", RandomString(8)),
|
||||
}
|
||||
|
||||
@ -667,8 +667,8 @@ func TestClient_OrdersFixExternalIds(t *testing.T) {
|
||||
}
|
||||
|
||||
orders := []IdentifiersPair{{
|
||||
Id: cr.Id,
|
||||
ExternalId: RandomString(8),
|
||||
ID: cr.ID,
|
||||
ExternalID: RandomString(8),
|
||||
}}
|
||||
|
||||
fx, fe, err := c.OrdersFixExternalIds(orders)
|
||||
@ -691,7 +691,7 @@ func TestClient_OrdersFixExternalIds(t *testing.T) {
|
||||
func TestClient_OrdersHistory(t *testing.T) {
|
||||
c := client()
|
||||
|
||||
data, status, err := c.OrdersHistory(OrdersHistoryRequest{Filter: OrdersHistoryFilter{SinceId: 20}})
|
||||
data, status, err := c.OrdersHistory(OrdersHistoryRequest{Filter: OrdersHistoryFilter{SinceID: 20}})
|
||||
if err.ErrorMsg != "" {
|
||||
t.Errorf("%v", err.ErrorMsg)
|
||||
t.Fail()
|
||||
@ -720,7 +720,7 @@ func TestClient_PaymentCreateEditDelete(t *testing.T) {
|
||||
FirstName: "Понтелей",
|
||||
LastName: "Турбин",
|
||||
Patronymic: "Аристархович",
|
||||
ExternalId: RandomString(8),
|
||||
ExternalID: RandomString(8),
|
||||
Email: fmt.Sprintf("%s@example.com", RandomString(8)),
|
||||
}
|
||||
|
||||
@ -742,7 +742,7 @@ func TestClient_PaymentCreateEditDelete(t *testing.T) {
|
||||
|
||||
f := Payment{
|
||||
Order: &Order{
|
||||
Id: createOrderResponse.Id,
|
||||
ID: createOrderResponse.ID,
|
||||
},
|
||||
Amount: 300,
|
||||
Type: "cash",
|
||||
@ -765,7 +765,7 @@ func TestClient_PaymentCreateEditDelete(t *testing.T) {
|
||||
}
|
||||
|
||||
k := Payment{
|
||||
Id: paymentCreateResponse.Id,
|
||||
ID: paymentCreateResponse.ID,
|
||||
Amount: 500,
|
||||
}
|
||||
|
||||
@ -785,7 +785,7 @@ func TestClient_PaymentCreateEditDelete(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
paymentDeleteResponse, status, err := c.PaymentDelete(paymentCreateResponse.Id)
|
||||
paymentDeleteResponse, status, err := c.PaymentDelete(paymentCreateResponse.ID)
|
||||
if err.ErrorMsg != "" {
|
||||
t.Errorf("%v", err.ErrorMsg)
|
||||
t.Fail()
|
||||
@ -834,7 +834,7 @@ func TestClient_TaskChange(t *testing.T) {
|
||||
|
||||
f := Task{
|
||||
Text: RandomString(15),
|
||||
PerformerId: user,
|
||||
PerformerID: user,
|
||||
}
|
||||
|
||||
cr, sc, err := c.TaskCreate(f)
|
||||
@ -853,10 +853,10 @@ func TestClient_TaskChange(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
f.Id = cr.Id
|
||||
f.ID = cr.ID
|
||||
f.Commentary = RandomString(20)
|
||||
|
||||
gt, sg, err := c.Task(f.Id)
|
||||
gt, sg, err := c.Task(f.ID)
|
||||
if err.ErrorMsg != "" {
|
||||
t.Errorf("%v", err.ErrorMsg)
|
||||
t.Fail()
|
||||
@ -1405,7 +1405,7 @@ func TestClient_Courier(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
cur.Id = data.Id
|
||||
cur.ID = data.ID
|
||||
cur.Patronymic = fmt.Sprintf("%s", RandomString(5))
|
||||
|
||||
idata, st, err := c.CourierEdit(cur)
|
||||
@ -1485,7 +1485,7 @@ func TestClient_OrderMethodEdit(t *testing.T) {
|
||||
Code: RandomString(5),
|
||||
Name: RandomString(5),
|
||||
Active: false,
|
||||
DefaultForCrm: false,
|
||||
DefaultForCRM: false,
|
||||
})
|
||||
if err.ErrorMsg != "" {
|
||||
t.Errorf("%v", err.ErrorMsg)
|
||||
@ -1510,7 +1510,7 @@ func TestClient_OrderTypeEdit(t *testing.T) {
|
||||
Code: RandomString(5),
|
||||
Name: RandomString(5),
|
||||
Active: false,
|
||||
DefaultForCrm: false,
|
||||
DefaultForCRM: false,
|
||||
})
|
||||
if err.ErrorMsg != "" {
|
||||
t.Errorf("%v", err.ErrorMsg)
|
||||
@ -1535,7 +1535,7 @@ func TestClient_PaymentStatusEdit(t *testing.T) {
|
||||
Code: RandomString(5),
|
||||
Name: RandomString(5),
|
||||
Active: false,
|
||||
DefaultForCrm: false,
|
||||
DefaultForCRM: false,
|
||||
PaymentTypes: []string{"cash"},
|
||||
PaymentComplete: false,
|
||||
})
|
||||
@ -1562,7 +1562,7 @@ func TestClient_PaymentTypeEdit(t *testing.T) {
|
||||
Code: RandomString(5),
|
||||
Name: RandomString(5),
|
||||
Active: false,
|
||||
DefaultForCrm: false,
|
||||
DefaultForCRM: false,
|
||||
})
|
||||
if err.ErrorMsg != "" {
|
||||
t.Errorf("%v", err.ErrorMsg)
|
||||
@ -1660,7 +1660,7 @@ func TestClient_SiteEdit(t *testing.T) {
|
||||
data, _, err := c.SiteEdit(Site{
|
||||
Code: RandomString(5),
|
||||
Name: RandomString(5),
|
||||
Url: fmt.Sprintf("https://%s.example.com", RandomString(4)),
|
||||
URL: fmt.Sprintf("https://%s.example.com", RandomString(4)),
|
||||
LoadFromYml: false,
|
||||
})
|
||||
if err.ErrorMsg == "" {
|
||||
@ -1707,9 +1707,9 @@ func TestClient_PackChange(t *testing.T) {
|
||||
FirstName: "Понтелей",
|
||||
LastName: "Турбин",
|
||||
Patronymic: "Аристархович",
|
||||
ExternalId: RandomString(8),
|
||||
ExternalID: RandomString(8),
|
||||
Email: fmt.Sprintf("%s@example.com", RandomString(8)),
|
||||
Items: []OrderItem{{Offer: Offer{Id: 1609}, Quantity: 5}},
|
||||
Items: []OrderItem{{Offer: Offer{ID: 1609}, Quantity: 5}},
|
||||
})
|
||||
if err.ErrorMsg != "" {
|
||||
t.Errorf("%v", err.ErrorMsg)
|
||||
@ -1726,7 +1726,7 @@ func TestClient_PackChange(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
g, status, err := c.Order(strconv.Itoa(o.Id), "id", "")
|
||||
g, status, err := c.Order(strconv.Itoa(o.ID), "id", "")
|
||||
if err.ErrorMsg != "" {
|
||||
t.Errorf("%v", err.ErrorMsg)
|
||||
t.Fail()
|
||||
@ -1744,7 +1744,7 @@ func TestClient_PackChange(t *testing.T) {
|
||||
|
||||
p, status, err := c.PackCreate(Pack{
|
||||
Store: "test-store",
|
||||
ItemId: g.Order.Items[0].Id,
|
||||
ItemID: g.Order.Items[0].ID,
|
||||
Quantity: 1,
|
||||
})
|
||||
if err.ErrorMsg != "" {
|
||||
@ -1762,7 +1762,7 @@ func TestClient_PackChange(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
s, status, err := c.Pack(p.Id)
|
||||
s, status, err := c.Pack(p.ID)
|
||||
if err.ErrorMsg != "" {
|
||||
t.Errorf("%v", err.ErrorMsg)
|
||||
t.Fail()
|
||||
@ -1778,7 +1778,7 @@ func TestClient_PackChange(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
e, status, err := c.PackEdit(Pack{Id: p.Id, Quantity: 2})
|
||||
e, status, err := c.PackEdit(Pack{ID: p.ID, Quantity: 2})
|
||||
if err.ErrorMsg != "" {
|
||||
t.Errorf("%v", err.ErrorMsg)
|
||||
t.Fail()
|
||||
@ -1794,7 +1794,7 @@ func TestClient_PackChange(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
d, status, err := c.PackDelete(p.Id)
|
||||
d, status, err := c.PackDelete(p.ID)
|
||||
if err.ErrorMsg != "" {
|
||||
t.Errorf("%v", err.ErrorMsg)
|
||||
t.Fail()
|
||||
@ -1814,7 +1814,7 @@ func TestClient_PackChange(t *testing.T) {
|
||||
func TestClient_PacksHistory(t *testing.T) {
|
||||
c := client()
|
||||
|
||||
data, status, err := c.PacksHistory(PacksHistoryRequest{Filter: OrdersHistoryFilter{SinceId: 5}})
|
||||
data, status, err := c.PacksHistory(PacksHistoryRequest{Filter: OrdersHistoryFilter{SinceID: 5}})
|
||||
if err.ErrorMsg != "" {
|
||||
t.Errorf("%v", err.ErrorMsg)
|
||||
t.Fail()
|
||||
@ -1907,9 +1907,9 @@ func TestClient_IntegrationModule(t *testing.T) {
|
||||
IntegrationCode: code,
|
||||
Active: false,
|
||||
Name: fmt.Sprintf("Integration module %s", name),
|
||||
AccountUrl: fmt.Sprintf("http://example.com/%s/account", name),
|
||||
BaseUrl: fmt.Sprintf("http://example.com/%s", name),
|
||||
ClientId: RandomString(10),
|
||||
AccountURL: fmt.Sprintf("http://example.com/%s/account", name),
|
||||
BaseURL: fmt.Sprintf("http://example.com/%s", name),
|
||||
ClientID: RandomString(10),
|
||||
Logo: "https://cdn.worldvectorlogo.com/logos/github-icon.svg",
|
||||
})
|
||||
if err.ErrorMsg != "" {
|
||||
|
@ -46,7 +46,7 @@ type CustomersFilter struct {
|
||||
FirstOrderTo string `url:"firstOrderTo,omitempty"`
|
||||
LastOrderFrom string `url:"lastOrderFrom,omitempty"`
|
||||
LastOrderTo string `url:"lastOrderTo,omitempty"`
|
||||
BrowserId string `url:"browserId,omitempty"`
|
||||
BrowserID string `url:"browserId,omitempty"`
|
||||
Commentary string `url:"commentary,omitempty"`
|
||||
SourceName string `url:"sourceName,omitempty"`
|
||||
MediumName string `url:"mediumName,omitempty"`
|
||||
@ -58,9 +58,9 @@ type CustomersFilter struct {
|
||||
|
||||
// CustomersHistoryFilter type
|
||||
type CustomersHistoryFilter struct {
|
||||
CustomerId int `url:"customerId,omitempty"`
|
||||
SinceId int `url:"sinceId,omitempty"`
|
||||
CustomerExternalId string `url:"customerExternalId,omitempty"`
|
||||
CustomerID int `url:"customerId,omitempty"`
|
||||
SinceID int `url:"sinceId,omitempty"`
|
||||
CustomerExternalID string `url:"customerExternalId,omitempty"`
|
||||
StartDate string `url:"startDate,omitempty"`
|
||||
EndDate string `url:"endDate,omitempty"`
|
||||
}
|
||||
@ -71,8 +71,8 @@ type OrdersFilter struct {
|
||||
ExternalIds []string `url:"externalIds,omitempty,brackets"`
|
||||
Numbers []string `url:"numbers,omitempty,brackets"`
|
||||
Customer string `url:"customer,omitempty"`
|
||||
CustomerId string `url:"customerId,omitempty"`
|
||||
CustomerExternalId string `url:"customerExternalId,omitempty"`
|
||||
CustomerID string `url:"customerId,omitempty"`
|
||||
CustomerExternalID string `url:"customerExternalId,omitempty"`
|
||||
Countries []string `url:"countries,omitempty,brackets"`
|
||||
City string `url:"city,omitempty"`
|
||||
Region string `url:"region,omitempty"`
|
||||
@ -158,9 +158,9 @@ type OrdersFilter struct {
|
||||
|
||||
// OrdersHistoryFilter type
|
||||
type OrdersHistoryFilter struct {
|
||||
OrderId int `url:"orderId,omitempty"`
|
||||
SinceId int `url:"sinceId,omitempty"`
|
||||
OrderExternalId string `url:"orderExternalId,omitempty"`
|
||||
OrderID int `url:"orderId,omitempty"`
|
||||
SinceID int `url:"sinceId,omitempty"`
|
||||
OrderExternalID string `url:"orderExternalId,omitempty"`
|
||||
StartDate string `url:"startDate,omitempty"`
|
||||
EndDate string `url:"endDate,omitempty"`
|
||||
}
|
||||
@ -217,11 +217,11 @@ type SegmentsFilter struct {
|
||||
type PacksFilter struct {
|
||||
Ids []int `url:"ids,omitempty,brackets"`
|
||||
Stores []string `url:"stores,omitempty"`
|
||||
ItemId int `url:"itemId,omitempty"`
|
||||
OfferXmlId string `url:"offerXmlId,omitempty"`
|
||||
OfferExternalId string `url:"offerExternalId,omitempty"`
|
||||
OrderId int `url:"orderId,omitempty"`
|
||||
OrderExternalId string `url:"orderExternalId,omitempty"`
|
||||
ItemID int `url:"itemId,omitempty"`
|
||||
OfferXMLID string `url:"offerXmlId,omitempty"`
|
||||
OfferExternalID string `url:"offerExternalId,omitempty"`
|
||||
OrderID int `url:"orderId,omitempty"`
|
||||
OrderExternalID string `url:"orderExternalId,omitempty"`
|
||||
ShipmentDateFrom string `url:"shipmentDateFrom,omitempty"`
|
||||
ShipmentDateTo string `url:"shipmentDateTo,omitempty"`
|
||||
InvoiceNumber string `url:"invoiceNumber,omitempty"`
|
||||
@ -231,10 +231,10 @@ type PacksFilter struct {
|
||||
// InventoriesFilter type
|
||||
type InventoriesFilter struct {
|
||||
Ids []int `url:"ids,omitempty,brackets"`
|
||||
ProductExternalId string `url:"productExternalId,omitempty"`
|
||||
ProductExternalID string `url:"productExternalId,omitempty"`
|
||||
ProductArticle string `url:"productArticle,omitempty"`
|
||||
OfferExternalId string `url:"offerExternalId,omitempty"`
|
||||
OfferXmlId string `url:"offerXmlId,omitempty"`
|
||||
OfferExternalID string `url:"offerExternalId,omitempty"`
|
||||
OfferXMLID string `url:"offerXmlId,omitempty"`
|
||||
OfferArticle string `url:"offerArticle,omitempty"`
|
||||
ProductActive int `url:"productActive,omitempty"`
|
||||
Details int `url:"details,omitempty"`
|
||||
@ -246,7 +246,7 @@ type ProductsGroupsFilter struct {
|
||||
Ids []int `url:"ids,omitempty,brackets"`
|
||||
Sites []string `url:"sites,omitempty,brackets"`
|
||||
Active int `url:"active,omitempty"`
|
||||
ParentGroupId string `url:"parentGroupId,omitempty"`
|
||||
ParentGroupID string `url:"parentGroupId,omitempty"`
|
||||
}
|
||||
|
||||
// ProductsFilter type
|
||||
@ -267,12 +267,12 @@ type ProductsFilter struct {
|
||||
Groups string `url:"groups,omitempty"`
|
||||
Name string `url:"name,omitempty"`
|
||||
ClassSegment string `url:"classSegment,omitempty"`
|
||||
XmlId string `url:"xmlId,omitempty"`
|
||||
ExternalId string `url:"externalId,omitempty"`
|
||||
XMLID string `url:"xmlId,omitempty"`
|
||||
ExternalID string `url:"externalId,omitempty"`
|
||||
Manufacturer string `url:"manufacturer,omitempty"`
|
||||
Url string `url:"url,omitempty"`
|
||||
URL string `url:"url,omitempty"`
|
||||
PriceType string `url:"priceType,omitempty"`
|
||||
OfferExternalId string `url:"offerExternalId,omitempty"`
|
||||
OfferExternalID string `url:"offerExternalId,omitempty"`
|
||||
Sites []string `url:"sites,omitempty,brackets"`
|
||||
Properties map[string]string `url:"properties,omitempty,brackets"`
|
||||
}
|
||||
@ -287,7 +287,7 @@ type ProductsPropertiesFilter struct {
|
||||
// ShipmentFilter type
|
||||
type ShipmentFilter struct {
|
||||
Ids []int `url:"ids,omitempty,brackets"`
|
||||
ExternalId string `url:"externalId,omitempty"`
|
||||
ExternalID string `url:"externalId,omitempty"`
|
||||
OrderNumber string `url:"orderNumber,omitempty"`
|
||||
DateFrom string `url:"dateFrom,omitempty"`
|
||||
DateTo string `url:"dateTo,omitempty"`
|
||||
|
@ -130,7 +130,7 @@ type ProductsPropertiesRequest struct {
|
||||
|
||||
// DeliveryTrackingRequest type
|
||||
type DeliveryTrackingRequest struct {
|
||||
DeliveryId string `url:"deliveryId,omitempty"`
|
||||
DeliveryID string `url:"deliveryId,omitempty"`
|
||||
TrackNumber string `url:"trackNumber,omitempty"`
|
||||
History []DeliveryHistoryRecord `url:"history,omitempty,brackets"`
|
||||
ExtraData map[string]string `url:"extraData,omitempty,brackets"`
|
||||
|
@ -24,7 +24,7 @@ type SucessfulResponse struct {
|
||||
// CreateResponse type
|
||||
type CreateResponse struct {
|
||||
Success bool `json:"success"`
|
||||
Id int `json:"id,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
}
|
||||
|
||||
// OperationResponse type
|
||||
@ -63,7 +63,7 @@ type CustomersResponse struct {
|
||||
// CustomerChangeResponse type
|
||||
type CustomerChangeResponse struct {
|
||||
Success bool `json:"success"`
|
||||
Id int `json:"id,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
}
|
||||
|
||||
@ -329,7 +329,7 @@ type DeliveryShipmentResponse struct {
|
||||
// DeliveryShipmentUpdateResponse type
|
||||
type DeliveryShipmentUpdateResponse struct {
|
||||
Success bool `json:"success"`
|
||||
Id int `json:"id,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
|
162
v5/types.go
162
v5/types.go
@ -4,7 +4,7 @@ import "net/http"
|
||||
|
||||
// Client type
|
||||
type Client struct {
|
||||
Url string
|
||||
URL string
|
||||
Key string
|
||||
httpClient *http.Client
|
||||
}
|
||||
@ -22,12 +22,12 @@ type Address struct {
|
||||
Index string `json:"index,omitempty"`
|
||||
CountryIso string `json:"countryIso,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
RegionId int `json:"regionId,omitempty"`
|
||||
RegionID int `json:"regionId,omitempty"`
|
||||
City string `json:"city,omitempty"`
|
||||
CityId int `json:"cityId,omitempty"`
|
||||
CityID int `json:"cityId,omitempty"`
|
||||
CityType string `json:"cityType,omitempty"`
|
||||
Street string `json:"street,omitempty"`
|
||||
StreetId int `json:"streetId,omitempty"`
|
||||
StreetID int `json:"streetId,omitempty"`
|
||||
StreetType string `json:"streetType,omitempty"`
|
||||
Building string `json:"building,omitempty"`
|
||||
Flat string `json:"flat,omitempty"`
|
||||
@ -44,9 +44,9 @@ type Address struct {
|
||||
type GeoHierarchyRow struct {
|
||||
Country string `json:"country,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
RegionId int `json:"regionId,omitempty"`
|
||||
RegionID int `json:"regionId,omitempty"`
|
||||
City string `json:"city,omitempty"`
|
||||
CityId int `json:"cityId,omitempty"`
|
||||
CityID int `json:"cityId,omitempty"`
|
||||
}
|
||||
|
||||
// Source type
|
||||
@ -77,8 +77,8 @@ type Contragent struct {
|
||||
BankAccount string `json:"bankAccount,omitempty"`
|
||||
}
|
||||
|
||||
// ApiKey type
|
||||
type ApiKey struct {
|
||||
// APIKey type
|
||||
type APIKey struct {
|
||||
Current bool `json:"current,omitempty"`
|
||||
}
|
||||
|
||||
@ -92,8 +92,8 @@ type Property struct {
|
||||
|
||||
// IdentifiersPair type
|
||||
type IdentifiersPair struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ExternalId string `json:"externalId,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
ExternalID string `json:"externalId,omitempty"`
|
||||
}
|
||||
|
||||
// DeliveryTime type
|
||||
@ -109,8 +109,8 @@ Customer related types
|
||||
|
||||
// Customer type
|
||||
type Customer struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ExternalId string `json:"externalId,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
ExternalID string `json:"externalId,omitempty"`
|
||||
FirstName string `json:"firstName,omitempty"`
|
||||
LastName string `json:"lastName,omitempty"`
|
||||
Patronymic string `json:"patronymic,omitempty"`
|
||||
@ -120,7 +120,7 @@ type Customer struct {
|
||||
Address *Address `json:"address,omitempty"`
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
Birthday string `json:"birthday,omitempty"`
|
||||
ManagerId int `json:"managerId,omitempty"`
|
||||
ManagerID int `json:"managerId,omitempty"`
|
||||
Vip bool `json:"vip,omitempty"`
|
||||
Bad bool `json:"bad,omitempty"`
|
||||
Site string `json:"site,omitempty"`
|
||||
@ -137,9 +137,9 @@ type Customer struct {
|
||||
OrdersCount int `json:"ordersCount,omitempty"`
|
||||
CostSumm float32 `json:"costSumm,omitempty"`
|
||||
MaturationTime int `json:"maturationTime,omitempty"`
|
||||
FirstClientId string `json:"firstClientId,omitempty"`
|
||||
LastClientId string `json:"lastClientId,omitempty"`
|
||||
BrowserId string `json:"browserId,omitempty"`
|
||||
FirstClientID string `json:"firstClientId,omitempty"`
|
||||
LastClientID string `json:"lastClientId,omitempty"`
|
||||
BrowserID string `json:"browserId,omitempty"`
|
||||
CustomFields []map[string]string `json:"customFields,omitempty,brackets"`
|
||||
}
|
||||
|
||||
@ -150,14 +150,14 @@ type Phone struct {
|
||||
|
||||
// CustomerHistoryRecord type
|
||||
type CustomerHistoryRecord struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
Created bool `json:"created,omitempty"`
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
Source string `json:"source,omitempty"`
|
||||
Field string `json:"field,omitempty"`
|
||||
User *User `json:"user,omitempty,brackets"`
|
||||
ApiKey *ApiKey `json:"apiKey,omitempty,brackets"`
|
||||
APIKey *APIKey `json:"apiKey,omitempty,brackets"`
|
||||
Customer *Customer `json:"customer,omitempty,brackets"`
|
||||
}
|
||||
|
||||
@ -167,8 +167,8 @@ Order related types
|
||||
|
||||
// Order type
|
||||
type Order struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ExternalId string `json:"externalId,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
ExternalID string `json:"externalId,omitempty"`
|
||||
Number string `json:"number,omitempty"`
|
||||
FirstName string `json:"firstName,omitempty"`
|
||||
LastName string `json:"lastName,omitempty"`
|
||||
@ -178,11 +178,11 @@ type Order struct {
|
||||
AdditionalPhone string `json:"additionalPhone,omitempty"`
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
StatusUpdatedAt string `json:"statusUpdatedAt,omitempty"`
|
||||
ManagerId int `json:"managerId,omitempty"`
|
||||
ManagerID int `json:"managerId,omitempty"`
|
||||
Mark int `json:"mark,omitempty"`
|
||||
Call bool `json:"call,omitempty"`
|
||||
Expired bool `json:"expired,omitempty"`
|
||||
FromApi bool `json:"fromApi,omitempty"`
|
||||
FromAPI bool `json:"fromApi,omitempty"`
|
||||
MarkDatetime string `json:"markDatetime,omitempty"`
|
||||
CustomerComment string `json:"customerComment,omitempty"`
|
||||
ManagerComment string `json:"managerComment,omitempty"`
|
||||
@ -205,7 +205,7 @@ type Order struct {
|
||||
Height int `json:"height,omitempty"`
|
||||
ShipmentStore string `json:"shipmentStore,omitempty"`
|
||||
ShipmentDate string `json:"shipmentDate,omitempty"`
|
||||
ClientId string `json:"clientId,omitempty"`
|
||||
ClientID string `json:"clientId,omitempty"`
|
||||
Shipped bool `json:"shipped,omitempty"`
|
||||
UploadedToExternalStoreSystem bool `json:"uploadedToExternalStoreSystem,omitempty"`
|
||||
Source *Source `json:"source,omitempty"`
|
||||
@ -257,13 +257,13 @@ type OrderDeliveryData struct {
|
||||
// OrderMarketplace type
|
||||
type OrderMarketplace struct {
|
||||
Code string `json:"code,omitempty"`
|
||||
OrderId string `json:"orderId,omitempty"`
|
||||
OrderID string `json:"orderId,omitempty"`
|
||||
}
|
||||
|
||||
// OrderPayment type
|
||||
type OrderPayment struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ExternalId string `json:"externalId,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
ExternalID string `json:"externalId,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
PaidAt string `json:"paidAt,omitempty"`
|
||||
@ -273,7 +273,7 @@ type OrderPayment struct {
|
||||
|
||||
// OrderItem type
|
||||
type OrderItem struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
InitialPrice float32 `json:"initialPrice,omitempty"`
|
||||
PurchasePrice float32 `json:"purchasePrice,omitempty"`
|
||||
DiscountTotal float32 `json:"discountTotal,omitempty"`
|
||||
@ -293,20 +293,20 @@ type OrderItem struct {
|
||||
|
||||
// OrdersHistoryRecord type
|
||||
type OrdersHistoryRecord struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
Created bool `json:"created,omitempty"`
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
Source string `json:"source,omitempty"`
|
||||
Field string `json:"field,omitempty"`
|
||||
User *User `json:"user,omitempty,brackets"`
|
||||
ApiKey *ApiKey `json:"apiKey,omitempty,brackets"`
|
||||
APIKey *APIKey `json:"apiKey,omitempty,brackets"`
|
||||
Order *Order `json:"order,omitempty,brackets"`
|
||||
}
|
||||
|
||||
// Pack type
|
||||
type Pack struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
PurchasePrice float32 `json:"purchasePrice,omitempty"`
|
||||
Quantity float32 `json:"quantity,omitempty"`
|
||||
Store string `json:"store,omitempty"`
|
||||
@ -314,19 +314,19 @@ type Pack struct {
|
||||
InvoiceNumber string `json:"invoiceNumber,omitempty"`
|
||||
DeliveryNoteNumber string `json:"deliveryNoteNumber,omitempty"`
|
||||
Item *PackItem `json:"item,omitempty"`
|
||||
ItemId int `json:"itemId,omitempty"`
|
||||
ItemID int `json:"itemId,omitempty"`
|
||||
}
|
||||
|
||||
// PackItem type
|
||||
type PackItem struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
Order *Order `json:"order,omitempty"`
|
||||
Offer *Offer `json:"offer,omitempty"`
|
||||
}
|
||||
|
||||
// PacksHistoryRecord type
|
||||
type PacksHistoryRecord struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
Created bool `json:"created,omitempty"`
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
@ -338,10 +338,10 @@ type PacksHistoryRecord struct {
|
||||
|
||||
// Offer type
|
||||
type Offer struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ExternalId string `json:"externalId,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
ExternalID string `json:"externalId,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
XmlId string `json:"xmlId,omitempty"`
|
||||
XMLID string `json:"xmlId,omitempty"`
|
||||
Article string `json:"article,omitempty"`
|
||||
VatRate string `json:"vatRate,omitempty"`
|
||||
Price float32 `json:"price,omitempty"`
|
||||
@ -366,9 +366,9 @@ type Inventory struct {
|
||||
|
||||
// InventoryUpload type
|
||||
type InventoryUpload struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ExternalId string `json:"externalId,omitempty"`
|
||||
XmlId string `json:"xmlId,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
ExternalID string `json:"externalId,omitempty"`
|
||||
XMLID string `json:"xmlId,omitempty"`
|
||||
Stores []InventoryUploadStore `json:"stores,omitempty"`
|
||||
}
|
||||
|
||||
@ -388,9 +388,9 @@ type OfferPrice struct {
|
||||
|
||||
// OfferPriceUpload type
|
||||
type OfferPriceUpload struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ExternalId string `json:"externalId,omitempty"`
|
||||
XmlId string `json:"xmlId,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
ExternalID string `json:"externalId,omitempty"`
|
||||
XMLID string `json:"xmlId,omitempty"`
|
||||
Site string `json:"site,omitempty"`
|
||||
Prices []PriceUpload `json:"prices,omitempty"`
|
||||
}
|
||||
@ -407,7 +407,7 @@ User related types
|
||||
|
||||
// User type
|
||||
type User struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
FirstName string `json:"firstName,omitempty"`
|
||||
LastName string `json:"lastName,omitempty"`
|
||||
Patronymic string `json:"patronymic,omitempty"`
|
||||
@ -443,8 +443,8 @@ Task related types
|
||||
|
||||
// Task type
|
||||
type Task struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
PerformerId int `json:"performerId,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
PerformerID int `json:"performerId,omitempty"`
|
||||
Text string `json:"text,omitempty"`
|
||||
Commentary string `json:"commentary,omitempty"`
|
||||
Datetime string `json:"datetime,omitempty"`
|
||||
@ -464,8 +464,8 @@ type Task struct {
|
||||
|
||||
// Note type
|
||||
type Note struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ManagerId int `json:"managerId,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
ManagerID int `json:"managerId,omitempty"`
|
||||
Text string `json:"text,omitempty"`
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
Customer *Customer `json:"customer,omitempty"`
|
||||
@ -477,8 +477,8 @@ type Note struct {
|
||||
|
||||
// Payment type
|
||||
type Payment struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ExternalId string `json:"externalId,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
ExternalID string `json:"externalId,omitempty"`
|
||||
PaidAt string `json:"paidAt,omitempty"`
|
||||
Amount float32 `json:"amount,omitempty"`
|
||||
Comment string `json:"comment,omitempty"`
|
||||
@ -493,7 +493,7 @@ type Payment struct {
|
||||
|
||||
// Segment type
|
||||
type Segment struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
Code string `json:"code,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
@ -530,7 +530,7 @@ type CostItem struct {
|
||||
|
||||
// Courier type
|
||||
type Courier struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
FirstName string `json:"firstName,omitempty"`
|
||||
LastName string `json:"lastName,omitempty"`
|
||||
Patronymic string `json:"patronymic,omitempty"`
|
||||
@ -589,8 +589,8 @@ type OrderMethod struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Code string `json:"code,omitempty"`
|
||||
Active bool `json:"active,omitempty"`
|
||||
DefaultForCrm bool `json:"defaultForCrm,omitempty"`
|
||||
DefaultForApi bool `json:"defaultForApi,omitempty"`
|
||||
DefaultForCRM bool `json:"defaultForCrm,omitempty"`
|
||||
DefaultForAPI bool `json:"defaultForApi,omitempty"`
|
||||
}
|
||||
|
||||
// OrderType type
|
||||
@ -598,8 +598,8 @@ type OrderType struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Code string `json:"code,omitempty"`
|
||||
Active bool `json:"active,omitempty"`
|
||||
DefaultForCrm bool `json:"defaultForCrm,omitempty"`
|
||||
DefaultForApi bool `json:"defaultForApi,omitempty"`
|
||||
DefaultForCRM bool `json:"defaultForCrm,omitempty"`
|
||||
DefaultForAPI bool `json:"defaultForApi,omitempty"`
|
||||
}
|
||||
|
||||
// PaymentStatus type
|
||||
@ -607,8 +607,8 @@ type PaymentStatus struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Code string `json:"code,omitempty"`
|
||||
Active bool `json:"active,omitempty"`
|
||||
DefaultForCrm bool `json:"defaultForCrm,omitempty"`
|
||||
DefaultForApi bool `json:"defaultForApi,omitempty"`
|
||||
DefaultForCRM bool `json:"defaultForCrm,omitempty"`
|
||||
DefaultForAPI bool `json:"defaultForApi,omitempty"`
|
||||
PaymentComplete bool `json:"paymentComplete,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Ordering int `json:"ordering,omitempty"`
|
||||
@ -620,8 +620,8 @@ type PaymentType struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Code string `json:"code,omitempty"`
|
||||
Active bool `json:"active,omitempty"`
|
||||
DefaultForCrm bool `json:"defaultForCrm,omitempty"`
|
||||
DefaultForApi bool `json:"defaultForApi,omitempty"`
|
||||
DefaultForCRM bool `json:"defaultForCrm,omitempty"`
|
||||
DefaultForAPI bool `json:"defaultForApi,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
DeliveryTypes []string `json:"deliveryTypes,omitempty,brackets"`
|
||||
PaymentStatuses []string `json:"PaymentStatuses,omitempty,brackets"`
|
||||
@ -629,7 +629,7 @@ type PaymentType struct {
|
||||
|
||||
// PriceType type
|
||||
type PriceType struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
Code string `json:"code,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Active bool `json:"active,omitempty"`
|
||||
@ -676,13 +676,13 @@ type StatusGroup struct {
|
||||
type Site struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Code string `json:"code,omitempty"`
|
||||
Url string `json:"url,omitempty"`
|
||||
URL string `json:"url,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Phones string `json:"phones,omitempty"`
|
||||
Zip string `json:"zip,omitempty"`
|
||||
Address string `json:"address,omitempty"`
|
||||
CountryIso string `json:"countryIso,omitempty"`
|
||||
YmlUrl string `json:"ymlUrl,omitempty"`
|
||||
YmlURL string `json:"ymlUrl,omitempty"`
|
||||
LoadFromYml bool `json:"loadFromYml,omitempty"`
|
||||
CatalogUpdatedAt string `json:"catalogUpdatedAt,omitempty"`
|
||||
CatalogLoadingAt string `json:"catalogLoadingAt,omitempty"`
|
||||
@ -693,9 +693,9 @@ type Site struct {
|
||||
type Store struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Code string `json:"code,omitempty"`
|
||||
ExternalId string `json:"externalId,omitempty"`
|
||||
ExternalID string `json:"externalId,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
XmlId string `json:"xmlId,omitempty"`
|
||||
XMLID string `json:"xmlId,omitempty"`
|
||||
Email string `json:"email,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
InventoryType string `json:"inventoryType,omitempty"`
|
||||
@ -706,8 +706,8 @@ type Store struct {
|
||||
|
||||
// ProductGroup type
|
||||
type ProductGroup struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ParentId int `json:"parentId,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
ParentID int `json:"parentId,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Site string `json:"site,omitempty"`
|
||||
Active bool `json:"active,omitempty"`
|
||||
@ -715,15 +715,15 @@ type ProductGroup struct {
|
||||
|
||||
// Product type
|
||||
type Product struct {
|
||||
Id int `json:"id,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
MaxPrice float32 `json:"maxPrice,omitempty"`
|
||||
MinPrice float32 `json:"minPrice,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Url string `json:"url,omitempty"`
|
||||
URL string `json:"url,omitempty"`
|
||||
Article string `json:"article,omitempty"`
|
||||
ExternalId string `json:"externalId,omitempty"`
|
||||
ExternalID string `json:"externalId,omitempty"`
|
||||
Manufacturer string `json:"manufacturer,omitempty"`
|
||||
ImageUrl string `json:"imageUrl,omitempty"`
|
||||
ImageURL string `json:"imageUrl,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Popular bool `json:"popular,omitempty"`
|
||||
Stock bool `json:"stock,omitempty"`
|
||||
@ -746,11 +746,11 @@ type DeliveryHistoryRecord struct {
|
||||
// DeliveryShipment type
|
||||
type DeliveryShipment struct {
|
||||
IntegrationCode string `json:"integrationCode,omitempty"`
|
||||
Id int `json:"id,omitempty"`
|
||||
ExternalId string `json:"externalId,omitempty"`
|
||||
ID int `json:"id,omitempty"`
|
||||
ExternalID string `json:"externalId,omitempty"`
|
||||
DeliveryType string `json:"deliveryType,omitempty"`
|
||||
Store string `json:"store,omitempty"`
|
||||
ManagerId int `json:"managerId,omitempty"`
|
||||
ManagerID int `json:"managerId,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
Date string `json:"date,omitempty"`
|
||||
Time *DeliveryTime `json:"time,omitempty"`
|
||||
@ -769,9 +769,9 @@ type IntegrationModule struct {
|
||||
Native bool `json:"native,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Logo string `json:"logo,omitempty"`
|
||||
ClientId string `json:"clientId,omitempty"`
|
||||
BaseUrl string `json:"baseUrl,omitempty"`
|
||||
AccountUrl string `json:"accountUrl,omitempty"`
|
||||
ClientID string `json:"clientId,omitempty"`
|
||||
BaseURL string `json:"baseUrl,omitempty"`
|
||||
AccountURL string `json:"accountUrl,omitempty"`
|
||||
AvailableCountries []string `json:"availableCountries,omitempty"`
|
||||
Actions []string `json:"actions,omitempty"`
|
||||
Integrations *Integrations `json:"integrations,omitempty"`
|
||||
@ -822,7 +822,7 @@ type DeliveryDataField struct {
|
||||
Label string `json:"label,omitempty"`
|
||||
Hint string `json:"hint,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
AutocompleteUrl string `json:"autocompleteUrl,omitempty"`
|
||||
AutocompleteURL string `json:"autocompleteUrl,omitempty"`
|
||||
Multiple bool `json:"multiple,omitempty"`
|
||||
Required bool `json:"required,omitempty"`
|
||||
AffectsCost bool `json:"affectsCost,omitempty"`
|
||||
@ -831,12 +831,12 @@ type DeliveryDataField struct {
|
||||
|
||||
// Telephony type
|
||||
type Telephony struct {
|
||||
MakeCallUrl string `json:"makeCallUrl,omitempty"`
|
||||
MakeCallURL string `json:"makeCallUrl,omitempty"`
|
||||
AllowEdit bool `json:"allowEdit,omitempty"`
|
||||
InputEventSupported bool `json:"inputEventSupported,omitempty"`
|
||||
OutputEventSupported bool `json:"outputEventSupported,omitempty"`
|
||||
HangupEventSupported bool `json:"hangupEventSupported,omitempty"`
|
||||
ChangeUserStatusUrl string `json:"changeUserStatusUrl,omitempty"`
|
||||
ChangeUserStatusURL string `json:"changeUserStatusUrl,omitempty"`
|
||||
AdditionalCodes []AdditionalCode `json:"additionalCodes,omitempty,brackets"`
|
||||
ExternalPhones []ExternalPhone `json:"externalPhones,omitempty,brackets"`
|
||||
}
|
||||
@ -844,7 +844,7 @@ type Telephony struct {
|
||||
// AdditionalCode type
|
||||
type AdditionalCode struct {
|
||||
Code string `json:"code,omitempty"`
|
||||
UserId string `json:"userId,omitempty"`
|
||||
UserID string `json:"userId,omitempty"`
|
||||
}
|
||||
|
||||
// ExternalPhone type
|
||||
@ -861,6 +861,6 @@ type Warehouse struct {
|
||||
// Action type
|
||||
type Action struct {
|
||||
Code string `json:"code,omitempty"`
|
||||
Url string `json:"url,omitempty"`
|
||||
URL string `json:"url,omitempty"`
|
||||
CallPoints []string `json:"callPoints,omitempty"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user