define communication, warehouse func #5

Merged
luuvansinh merged 9 commits from define-communication-func into master 2022-08-24 02:42:24 +00:00
1 changed files with 19 additions and 2 deletions
Showing only changes of commit b82c017596 - Show all commits

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