Merge branch 'integrate-global-care' into develop

This commit is contained in:
Sinh 2022-08-31 10:54:04 +07:00
commit 3bc5f0673d
4 changed files with 34 additions and 4 deletions

View File

@ -50,3 +50,19 @@ func (o Order) CancelDelivery(p model.OrderCancelDelivery) error {
} }
return nil return nil
} }
// ChangeDeliveryStatus ...
func (o Order) ChangeDeliveryStatus(p model.OrderChangeDeliveryStatus) error {
msg, err := natsio.GetServer().Request(subject.Order.ChangeDeliveryStatus, 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
}

View File

@ -15,3 +15,8 @@ type DistinctWithField struct {
Conditions interface{} `json:"conditions"` Conditions interface{} `json:"conditions"`
Filed string `json:"filed"` Filed string `json:"filed"`
} }
type ActionBy struct {
ID string `json:"id"`
Name string `json:"name"`
}

View File

@ -13,3 +13,10 @@ type OrderUpdateORStatus struct {
type OrderCancelDelivery struct { type OrderCancelDelivery struct {
OrderID string `json:"orderId"` OrderID string `json:"orderId"`
} }
// OrderChangeDeliveryStatus ...
type OrderChangeDeliveryStatus struct {
OrderID string `json:"orderId"`
DeliveryStatus string `json:"deliveryStatus"`
ActionBy ActionBy `json:"actionBy"`
}

View File

@ -9,7 +9,9 @@ func getOrderValue(val string) string {
var Order = struct { var Order = struct {
UpdateORStatus string UpdateORStatus string
CancelDelivery string CancelDelivery string
ChangeDeliveryStatus string
}{ }{
UpdateORStatus: getOrderValue("update_outbound_request_status"), UpdateORStatus: getOrderValue("update_outbound_request_status"),
CancelDelivery: getOrderValue("cancel_delivery"), CancelDelivery: getOrderValue("cancel_delivery"),
ChangeDeliveryStatus: getOrderValue("change_delivery_status"),
} }