mergeDev/campaign #73
|
@ -119,3 +119,24 @@ func (o Order) GetSupplierOrders(p model.OrderSupplierQuery) (*model.SupplierOrd
|
|||
}
|
||||
return &r.Data, nil
|
||||
}
|
||||
|
||||
// GetSupplierCash ...
|
||||
func (o Order) GetSupplierCash(p model.OrderSupplierCashReq) (*model.OrderSupplierCashRes, error) {
|
||||
msg, err := natsio.GetServer().Request(subject.Order.GetSupplierCash, toBytes(p))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var (
|
||||
r struct {
|
||||
Data model.OrderSupplierCashRes `json:"data"`
|
||||
Error string `json:"error"`
|
||||
}
|
||||
)
|
||||
if err = json.Unmarshal(msg.Data, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if r.Error != "" {
|
||||
return nil, errors.New(r.Error)
|
||||
}
|
||||
return &r.Data, nil
|
||||
}
|
||||
|
|
|
@ -49,3 +49,7 @@ type OrderSupplierQuery struct {
|
|||
SupplierID string `json:"supplierId"`
|
||||
WarehouseIDs []string `json:"warehouseIDs"`
|
||||
}
|
||||
|
||||
type OrderSupplierCashReq struct {
|
||||
SupplierID string `json:"supplierId"`
|
||||
}
|
||||
|
|
|
@ -33,3 +33,9 @@ type SupplierOrderDelivery struct {
|
|||
Status string `json:"status" enums:"waiting_to_confirm,waiting_to_pick,picking,picked,delay_pickup,pickup_failed,delivering,delay_delivery,delivered,cancelled,delivery_failed,waiting_to_return,returning,delay_return,compensation,returned"`
|
||||
TPLCode string `json:"tplCode" enums:"SLY,GHTK,GHN,SSC,SPY,VTP,SE,NTL,BEST"`
|
||||
}
|
||||
|
||||
type OrderSupplierCashRes struct {
|
||||
PendingCash float64 `json:"pendingCash"`
|
||||
WaitingForReconcileCash float64 `json:"waitingForReconcileCash"`
|
||||
ReconciledCash float64 `json:"reconciledCash"`
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ var Order = struct {
|
|||
UpdateLogisticInfoFailed string
|
||||
ORNotUpdateStatus string
|
||||
GetSupplierOrders string
|
||||
GetSupplierCash string
|
||||
}{
|
||||
UpdateORStatus: getOrderValue("update_outbound_request_status"),
|
||||
CancelDelivery: getOrderValue("cancel_delivery"),
|
||||
|
@ -20,4 +21,5 @@ var Order = struct {
|
|||
UpdateLogisticInfoFailed: getOrderValue("update_logistic_info_failed"),
|
||||
ORNotUpdateStatus: getOrderValue("outbound_request_not_update_status"),
|
||||
GetSupplierOrders: getOrderValue("get_supplier_orders"),
|
||||
GetSupplierCash: getOrderValue("get_supplier_cash"),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue