From 816316b558a502d2a8295ac92f15e7577ad573a4 Mon Sep 17 00:00:00 2001 From: Sinh Date: Wed, 2 Nov 2022 17:18:11 +0700 Subject: [PATCH] define nats func - get supplier order cash and supplier withdraw cash --- model/order_request.go | 4 ++++ model/order_response.go | 6 ++++++ model/withdraw_request.go | 5 +++++ model/withdraw_response.go | 7 +++++++ subject/config.go | 2 ++ subject/order.go | 2 ++ subject/withdraw.go | 13 +++++++++++++ 7 files changed, 39 insertions(+) create mode 100644 model/withdraw_request.go create mode 100644 model/withdraw_response.go create mode 100644 subject/withdraw.go diff --git a/model/order_request.go b/model/order_request.go index bd1fa73..a0ff6ee 100644 --- a/model/order_request.go +++ b/model/order_request.go @@ -49,3 +49,7 @@ type OrderSupplierQuery struct { SupplierID string `json:"supplierId"` WarehouseIDs []string `json:"warehouseIDs"` } + +type OrderSupplierCashReq struct { + SupplierID string `json:"supplierId"` +} diff --git a/model/order_response.go b/model/order_response.go index c08f87a..59b80d3 100644 --- a/model/order_response.go +++ b/model/order_response.go @@ -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"` +} diff --git a/model/withdraw_request.go b/model/withdraw_request.go new file mode 100644 index 0000000..7eb4a3f --- /dev/null +++ b/model/withdraw_request.go @@ -0,0 +1,5 @@ +package model + +type WithdrawSupplierCashReq struct { + SupplierID string `json:"supplierId"` +} diff --git a/model/withdraw_response.go b/model/withdraw_response.go new file mode 100644 index 0000000..9c5adc5 --- /dev/null +++ b/model/withdraw_response.go @@ -0,0 +1,7 @@ +package model + +type WithdrawSupplierCashRes struct { + PendingCash float64 `json:"pendingCash"` + SuccessCash float64 `json:"successCash"` + RejectCash float64 `json:"rejectCash"` +} diff --git a/subject/config.go b/subject/config.go index 90a014f..d428e4f 100644 --- a/subject/config.go +++ b/subject/config.go @@ -11,6 +11,7 @@ var prefixes = struct { Seller string SupplierUser string SupplierRole string + Withdraw string }{ Communication: "communication", Order: "order", @@ -22,4 +23,5 @@ var prefixes = struct { Seller: "seller", SupplierUser: "supplier_user", SupplierRole: "supplier_role", + Withdraw: "withdraw", } diff --git a/subject/order.go b/subject/order.go index 017f2be..e24e193 100644 --- a/subject/order.go +++ b/subject/order.go @@ -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"), } diff --git a/subject/withdraw.go b/subject/withdraw.go new file mode 100644 index 0000000..08f9a87 --- /dev/null +++ b/subject/withdraw.go @@ -0,0 +1,13 @@ +package subject + +import "fmt" + +func getWithdrawValue(val string) string { + return fmt.Sprintf("%s.%s", prefixes.Withdraw, val) +} + +var Withdraw = struct { + GetSupplierCash string +}{ + GetSupplierCash: getWithdrawValue("get_supplier_cash"), +}