1
0
mirror of synced 2024-11-30 07:06:02 +03:00

update dependency, update order data

This commit is contained in:
Alex Lushpai 2018-09-21 20:03:14 +03:00
parent 8e5268a285
commit d0a5af4f81
2 changed files with 0 additions and 36 deletions

2
go.sum
View File

@ -95,8 +95,6 @@ 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/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 h1:4Q3e4ve8GOOHIQdq3/wTGqgWuWa1cKMKqmgrTv4FoDU=
github.com/retailcrm/api-client-go v1.0.6/go.mod h1:QRoPE2SM6ST7i2g0yEdqm7Iw98y7cYuq3q14Ot+6N8c= github.com/retailcrm/api-client-go v1.0.6/go.mod h1:QRoPE2SM6ST7i2g0yEdqm7Iw98y7cYuq3q14Ot+6N8c=
github.com/retailcrm/mg-transport-api-client-go v1.1.9 h1:ogh5ThoqZJM5v4ZY6CqctUj01pVVHfBLXkrmX+BFjHE=
github.com/retailcrm/mg-transport-api-client-go v1.1.9/go.mod h1:AWV6BueE28/6SCoyfKURTo4lF0oXYoOKmHTzehd5vAI=
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 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.10/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 h1:6V1qxN6Usn4jy8unvggSJz/NC790tefw8Zdy6OZS5co=

View File

@ -585,21 +585,12 @@ func mgWebhookHandler(c *gin.Context) {
switch msg.Type { switch msg.Type {
case "message_sent": case "message_sent":
var mb string var mb string
<<<<<<< HEAD
if msg.Data.Type == v1.MsgTypeProduct {
=======
switch msg.Data.Type { switch msg.Data.Type {
case v1.MsgTypeProduct: case v1.MsgTypeProduct:
>>>>>>> master
mb = fmt.Sprintf("%s\n", msg.Data.Product.Name) mb = fmt.Sprintf("%s\n", msg.Data.Product.Name)
if msg.Data.Product.Cost != nil && msg.Data.Product.Cost.Value != 0 { if msg.Data.Product.Cost != nil && msg.Data.Product.Cost.Value != 0 {
mb += fmt.Sprintf( mb += fmt.Sprintf(
<<<<<<< HEAD
"\n%v %s\n",
msg.Data.Product.Cost.Value,
currency[strings.ToLower(msg.Data.Product.Cost.Currency)],
=======
"\n%s: %s\n", "\n%s: %s\n",
getLocalizedMessage("item_cost"), getLocalizedMessage("item_cost"),
getLocalizedTemplateMessage( getLocalizedTemplateMessage(
@ -609,7 +600,6 @@ func mgWebhookHandler(c *gin.Context) {
"Currency": currency[strings.ToLower(msg.Data.Product.Cost.Currency)], "Currency": currency[strings.ToLower(msg.Data.Product.Cost.Currency)],
}, },
), ),
>>>>>>> master
) )
} }
@ -617,34 +607,10 @@ func mgWebhookHandler(c *gin.Context) {
mb += msg.Data.Product.Url mb += msg.Data.Product.Url
} else { } else {
mb += msg.Data.Product.Img mb += msg.Data.Product.Img
<<<<<<< HEAD
}
} else if msg.Data.Type == v1.MsgTypeOrder {
mb = "Заказ"
if msg.Data.Order.Number != "" {
mb += " " + msg.Data.Order.Number
}
if msg.Data.Order.Date != "" {
mb += fmt.Sprintf(" (%s)", msg.Data.Order.Date)
}
mb += "\n"
if len(msg.Data.Order.Items) > 0 {
for _, v := range msg.Data.Order.Items {
mb += fmt.Sprintf("%s %v x %v %s\n", v.Name, v.Quantity.Value, v.Price.Value, currency[strings.ToLower(v.Price.Currency)])
}
}
mb += fmt.Sprintf("Сумма: %v %s", msg.Data.Order.Cost.Value, currency[strings.ToLower(msg.Data.Order.Cost.Currency)])
} else {
=======
} }
case v1.MsgTypeOrder: case v1.MsgTypeOrder:
mb = getOrderMessage(msg.Data.Order) mb = getOrderMessage(msg.Data.Order)
case v1.MsgTypeText: case v1.MsgTypeText:
>>>>>>> master
mb = msg.Data.Content mb = msg.Data.Content
} }