From ad51f45871bb25c6aaa68797be82187c859d7134 Mon Sep 17 00:00:00 2001 From: Sinh Date: Thu, 25 Aug 2022 16:57:42 +0700 Subject: [PATCH 1/4] add request json encode --- json_encoder.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/json_encoder.go b/json_encoder.go index 4a0bdb8..af13573 100644 --- a/json_encoder.go +++ b/json_encoder.go @@ -26,3 +26,8 @@ func (e JSONEncoder) Subscribe(subject string, cb nats.Handler) (*nats.Subscript func (e JSONEncoder) Publish(reply string, data interface{}) error { return e.encConn.Publish(reply, data) } + +// Request ... +func (e JSONEncoder) Request(subject string, data interface{}, res interface{}) error { + return e.encConn.Request(subject, data, res, requestTimeout) +} -- 2.34.1 From e860b97c5b67436dfe76303513dfcb2d509379a1 Mon Sep 17 00:00:00 2001 From: Sinh Date: Fri, 26 Aug 2022 10:31:36 +0700 Subject: [PATCH 2/4] update json tag --- model/warehouse_response.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/model/warehouse_response.go b/model/warehouse_response.go index deaeff1..2e19c9a 100644 --- a/model/warehouse_response.go +++ b/model/warehouse_response.go @@ -34,8 +34,8 @@ type WarehouseSupplier struct { type WarehouseOrder struct { MinimumValue float64 `json:"minimumValue"` PaymentMethod WarehousePaymentMethod `json:"paymentMethod"` - IsLimitNumberOfPurchases bool `json:"isLimitNumberOfPurchases" json:"isLimitNumberOfPurchases"` - LimitNumberOfPurchases int64 `json:"limitNumberOfPurchases" json:"limitNumberOfPurchases"` + IsLimitNumberOfPurchases bool `json:"isLimitNumberOfPurchases"` + LimitNumberOfPurchases int64 `json:"limitNumberOfPurchases"` } // WarehousePaymentMethod ... @@ -47,9 +47,9 @@ type WarehousePaymentMethod struct { // WarehouseDelivery ... type WarehouseDelivery struct { DeliveryMethods []string `json:"deliveryMethods"` - PriorityServiceCodes []string `json:"priorityDeliveryServiceCodes"` - EnabledSources []int `json:"enabledDeliverySources"` - Types []string `json:"type"` + PriorityServiceCodes []string `json:"priorityServiceCodes"` + EnabledSources []int `json:"enabledSources"` + Types []string `json:"types"` } // WarehousePartner ... -- 2.34.1 From 924935fdf3bc03b455d680d66e44b3540b01dd7b Mon Sep 17 00:00:00 2001 From: Sinh Date: Fri, 26 Aug 2022 11:25:09 +0700 Subject: [PATCH 3/4] change subject cancel delivery --- client/order.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/order.go b/client/order.go index 949bb51..3459f52 100644 --- a/client/order.go +++ b/client/order.go @@ -37,7 +37,7 @@ func (o Order) UpdateORStatus(p model.OrderUpdateORStatus) error { // CancelDelivery ... func (o Order) CancelDelivery(p model.OrderCancelDelivery) error { - msg, err := natsio.GetServer().Request(subject.OrderUpdateORStatus, toBytes(p)) + msg, err := natsio.GetServer().Request(subject.OrderCancelDelivery, toBytes(p)) if err != nil { return err } -- 2.34.1 From 21aa37507aae3b88c04e7e154fe0ef453b00e290 Mon Sep 17 00:00:00 2001 From: phuanbui Date: Mon, 29 Aug 2022 18:07:58 +0700 Subject: [PATCH 4/4] edit type field code --- model/location_response.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/model/location_response.go b/model/location_response.go index f383d12..436d1f7 100644 --- a/model/location_response.go +++ b/model/location_response.go @@ -10,19 +10,19 @@ type ResponseLocationAddress struct { type LocationProvince struct { ID string `json:"id"` Name string `json:"name"` - Code string `json:"code"` + Code int `json:"code"` } // LocationDistrict ... type LocationDistrict struct { ID string `json:"id"` Name string `json:"name"` - Code string `json:"code"` + Code int `json:"code"` } // LocationWard ... type LocationWard struct { ID string `json:"id"` Name string `json:"name"` - Code string `json:"code"` + Code int `json:"code"` } -- 2.34.1