add cancel OR func

This commit is contained in:
Sinh 2022-08-19 11:47:34 +07:00
parent fcc9099533
commit b82c017596
1 changed files with 19 additions and 2 deletions

View File

@ -43,8 +43,25 @@ func (w Warehouse) UpdateOutboundRequestLogisticInfo(p model.UpdateOutboundReque
return err
}
var r struct {
Data *model.OutboundRequestResponse `json:"data"`
Error string `json:"error"`
Error string `json:"error"`
}
if err = json.Unmarshal(msg.Data, &r); err != nil {
return err
}
if r.Error != "" {
return errors.New(r.Error)
}
return nil
}
// CancelOutboundRequest ...
func (w Warehouse) CancelOutboundRequest(p model.CancelOutboundRequest) error {
msg, err := natsio.GetServer().Request(subject.WarehouseCancelOutboundRequest, toBytes(p))
if err != nil {
return err
}
var r struct {
Error string `json:"error"`
}
if err = json.Unmarshal(msg.Data, &r); err != nil {
return err