Merge pull request #18 from Selly-Modules/integrate-global-care
add order func
This commit is contained in:
commit
40e71440f1
|
@ -66,3 +66,19 @@ func (o Order) ChangeDeliveryStatus(p model.OrderChangeDeliveryStatus) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateLogisticInfoFailed ...
|
||||
func (o Order) UpdateLogisticInfoFailed(p model.OrderUpdateLogisticInfoFailed) error {
|
||||
msg, err := natsio.GetServer().Request(subject.Order.UpdateLogisticInfoFailed, toBytes(p))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var r model.CommonResponseData
|
||||
if err = json.Unmarshal(msg.Data, &r); err != nil {
|
||||
return err
|
||||
}
|
||||
if r.Error != "" {
|
||||
return errors.New(r.Error)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -26,3 +26,10 @@ type OrderChangeDeliveryStatus struct {
|
|||
type OrderORData struct {
|
||||
Link string `json:"link"`
|
||||
}
|
||||
|
||||
// OrderUpdateLogisticInfoFailed ...
|
||||
type OrderUpdateLogisticInfoFailed struct {
|
||||
OrderID string `json:"orderId"`
|
||||
ORCode string `json:"orCode"`
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
|
|
@ -7,11 +7,13 @@ func getOrderValue(val string) string {
|
|||
}
|
||||
|
||||
var Order = struct {
|
||||
UpdateORStatus string
|
||||
CancelDelivery string
|
||||
ChangeDeliveryStatus string
|
||||
UpdateORStatus string
|
||||
CancelDelivery string
|
||||
ChangeDeliveryStatus string
|
||||
UpdateLogisticInfoFailed string
|
||||
}{
|
||||
UpdateORStatus: getOrderValue("update_outbound_request_status"),
|
||||
CancelDelivery: getOrderValue("cancel_delivery"),
|
||||
ChangeDeliveryStatus: getOrderValue("change_delivery_status"),
|
||||
UpdateORStatus: getOrderValue("update_outbound_request_status"),
|
||||
CancelDelivery: getOrderValue("cancel_delivery"),
|
||||
ChangeDeliveryStatus: getOrderValue("change_delivery_status"),
|
||||
UpdateLogisticInfoFailed: getOrderValue("update_logistic_info_failed"),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue