1
0
mirror of synced 2024-11-22 04:26:01 +03:00

update bot-api-client, replaced amount by price

This commit is contained in:
DmitryZagorulko 2018-09-26 17:12:35 +03:00
parent fd546a060c
commit 06279fb4b4
3 changed files with 15 additions and 16 deletions

3
go.mod
View File

@ -31,7 +31,6 @@ require (
github.com/jinzhu/now v0.0.0-20180511015916-ed742868f2ae // indirect
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect
github.com/json-iterator/go v1.1.5 // indirect
github.com/jstemmer/go-junit-report v0.0.0-20180614143834-385fac0ced9a // indirect
github.com/jtolds/gls v4.2.1+incompatible // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/lib/pq v1.0.0 // indirect
@ -45,7 +44,7 @@ require (
github.com/pkg/errors v0.8.0
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/retailcrm/api-client-go v1.0.6
github.com/retailcrm/mg-transport-api-client-go v1.1.10
github.com/retailcrm/mg-transport-api-client-go v1.1.11
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf // indirect
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a // indirect
github.com/stevvooe/resumable v0.0.0-20180830230917-22b14a53ba50 // indirect

6
go.sum
View File

@ -64,8 +64,6 @@ github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5i
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/json-iterator/go v1.1.5 h1:gL2yXlmiIo4+t+y32d4WGwOjKGYcGOuyrg46vadswDE=
github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/jstemmer/go-junit-report v0.0.0-20180614143834-385fac0ced9a h1:2qq552JOlVHGYvqPc9ynBnGPDHeA7p0/QRn2NkrO8vk=
github.com/jstemmer/go-junit-report v0.0.0-20180614143834-385fac0ced9a/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE=
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
@ -95,8 +93,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/retailcrm/api-client-go v1.0.6 h1:4Q3e4ve8GOOHIQdq3/wTGqgWuWa1cKMKqmgrTv4FoDU=
github.com/retailcrm/api-client-go v1.0.6/go.mod h1:QRoPE2SM6ST7i2g0yEdqm7Iw98y7cYuq3q14Ot+6N8c=
github.com/retailcrm/mg-transport-api-client-go v1.1.10 h1:RR8S5NA6FPVrF6UVXaLwu/gJyKUg5aUObQ97S98M3Yc=
github.com/retailcrm/mg-transport-api-client-go v1.1.10/go.mod h1:AWV6BueE28/6SCoyfKURTo4lF0oXYoOKmHTzehd5vAI=
github.com/retailcrm/mg-transport-api-client-go v1.1.11 h1:jAIOKqkjA2r0v/V6lTHYQsD8q0lFpfpqzAffHAJlhCQ=
github.com/retailcrm/mg-transport-api-client-go v1.1.11/go.mod h1:AWV6BueE28/6SCoyfKURTo4lF0oXYoOKmHTzehd5vAI=
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf h1:6V1qxN6Usn4jy8unvggSJz/NC790tefw8Zdy6OZS5co=
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a h1:JSvGDIbmil4Ui/dDdFBExb7/cmkNjyX5F97oglmvCDo=

View File

@ -145,7 +145,7 @@ func saveHandler(c *gin.Context) {
if code == http.StatusInternalServerError {
c.Error(err)
} else {
c.AbortWithStatusJSON(BadRequest(err.Error()))
c.AbortWithStatusJSON(code, gin.H{"error": err.Error()})
}
return
}
@ -728,21 +728,23 @@ func getOrderMessage(dataOrder *v1.MessageDataOrder) string {
}
}
if dataOrder.Delivery.Name != "" {
mb += fmt.Sprintf(
"\n*%s:*\n%s",
getLocalizedMessage("delivery"),
dataOrder.Delivery.Name,
)
if dataOrder.Delivery != nil {
if dataOrder.Delivery.Name != "" {
mb += fmt.Sprintf(
"\n*%s:*\n%s",
getLocalizedMessage("delivery"),
dataOrder.Delivery.Name,
)
}
if dataOrder.Delivery.Amount != nil {
if val, ok := currency[strings.ToLower(dataOrder.Delivery.Amount.Currency)]; ok && dataOrder.Delivery.Amount.Value != 0 {
if dataOrder.Delivery.Price != nil {
if val, ok := currency[strings.ToLower(dataOrder.Delivery.Price.Currency)]; ok && dataOrder.Delivery.Price.Value != 0 {
mb += fmt.Sprintf(
"; %s",
getLocalizedTemplateMessage(
"cost_currency",
map[string]interface{}{
"Amount": dataOrder.Delivery.Amount.Value,
"Amount": dataOrder.Delivery.Price.Value,
"Currency": val,
},
),