build auth sms

This commit is contained in:
Tue 2022-11-08 14:15:47 +07:00
parent ca99cdad86
commit 2872e4f75b
4 changed files with 33 additions and 0 deletions

View File

@ -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
}

View File

@ -49,3 +49,7 @@ type OrderSupplierQuery struct {
SupplierID string `json:"supplierId"`
WarehouseIDs []string `json:"warehouseIDs"`
}
type OrderSupplierCashReq struct {
SupplierID string `json:"supplierId"`
}

View File

@ -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"`
}

View File

@ -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"),
}