app-cloudep-trade-service/internal/server/walletservice/wallet_service_server.go

90 lines
3.7 KiB
Go
Raw Permalink Normal View History

2024-10-25 10:17:27 +00:00
// Code generated by goctl. DO NOT EDIT.
// Source: trade.proto
package server
import (
"context"
"app-cloudep-trade-service/gen_result/pb/trade"
2024-10-25 16:42:58 +00:00
walletservicelogic "app-cloudep-trade-service/internal/logic/walletservice"
2024-10-25 10:17:27 +00:00
"app-cloudep-trade-service/internal/svc"
)
type WalletServiceServer struct {
svcCtx *svc.ServiceContext
trade.UnimplementedWalletServiceServer
}
func NewWalletServiceServer(svcCtx *svc.ServiceContext) *WalletServiceServer {
return &WalletServiceServer{
svcCtx: svcCtx,
}
}
// CreateWallet 建立錢包
func (s *WalletServiceServer) CreateWallet(ctx context.Context, in *trade.CreateWalletReq) (*trade.OKResp, error) {
l := walletservicelogic.NewCreateWalletLogic(ctx, s.svcCtx)
return l.CreateWallet(in)
}
// DepositFunds 充值 - 增加 [可用餘額] 或 [限制餘額]
func (s *WalletServiceServer) DepositFunds(ctx context.Context, in *trade.WalletTransactionReq) (*trade.OKResp, error) {
l := walletservicelogic.NewDepositFundsLogic(ctx, s.svcCtx)
return l.DepositFunds(in)
}
// WithdrawFunds 提現 - 減少 [可用餘額]
func (s *WalletServiceServer) WithdrawFunds(ctx context.Context, in *trade.WalletTransactionReq) (*trade.OKResp, error) {
l := walletservicelogic.NewWithdrawFundsLogic(ctx, s.svcCtx)
return l.WithdrawFunds(in)
}
// FreezeFunds 凍結 - 將 [可用餘額] 減少,加到 [凍結餘額]
func (s *WalletServiceServer) FreezeFunds(ctx context.Context, in *trade.WalletTransactionReq) (*trade.OKResp, error) {
l := walletservicelogic.NewFreezeFundsLogic(ctx, s.svcCtx)
return l.FreezeFunds(in)
}
// UnfreezeFunds 解凍 - 減少 [凍結餘額]
func (s *WalletServiceServer) UnfreezeFunds(ctx context.Context, in *trade.WalletTransactionReq) (*trade.OKResp, error) {
l := walletservicelogic.NewUnfreezeFundsLogic(ctx, s.svcCtx)
return l.UnfreezeFunds(in)
}
// AppendToFreeze 追加凍結 - 減少可用餘額,追加到現有的 [凍結餘額] (基於原order_id)
func (s *WalletServiceServer) AppendToFreeze(ctx context.Context, in *trade.WalletTransactionReq) (*trade.OKResp, error) {
l := walletservicelogic.NewAppendToFreezeLogic(ctx, s.svcCtx)
return l.AppendToFreeze(in)
}
// RollbackFreeze 凍結回滾 - 減少 [凍結餘額],加回 [可用餘額],不可指定金額,整筆訂單的凍結金額加回 [可用餘額]
func (s *WalletServiceServer) RollbackFreeze(ctx context.Context, in *trade.WalletTransactionReq) (*trade.OKResp, error) {
l := walletservicelogic.NewRollbackFreezeLogic(ctx, s.svcCtx)
return l.RollbackFreeze(in)
}
// CancelFreeze 取消凍結 - 減少 [凍結餘額],加回 [可用餘額],可指定金額
func (s *WalletServiceServer) CancelFreeze(ctx context.Context, in *trade.WalletTransactionReq) (*trade.OKResp, error) {
l := walletservicelogic.NewCancelFreezeLogic(ctx, s.svcCtx)
return l.CancelFreeze(in)
}
// TransferToRestrictedFunds 限制 - 減少 [凍結餘額],轉移到另一個使用者的 [限制餘額]
func (s *WalletServiceServer) TransferToRestrictedFunds(ctx context.Context, in *trade.WalletTransactionReq) (*trade.OKResp, error) {
l := walletservicelogic.NewTransferToRestrictedFundsLogic(ctx, s.svcCtx)
return l.TransferToRestrictedFunds(in)
}
// SettleRestrictedFunds 結算限制餘額 - 限制餘額在 T+N 天後自動失效,每日只能執行一次
func (s *WalletServiceServer) SettleRestrictedFunds(ctx context.Context, in *trade.NoneReq) (*trade.OKResp, error) {
l := walletservicelogic.NewSettleRestrictedFundsLogic(ctx, s.svcCtx)
return l.SettleRestrictedFunds(in)
}
// QueryBalance 餘額查詢 -> 依照日期查詢
func (s *WalletServiceServer) QueryBalance(ctx context.Context, in *trade.QueryBalanceByDateReq) (*trade.QueryBalanceByDateResp, error) {
l := walletservicelogic.NewQueryBalanceLogic(ctx, s.svcCtx)
return l.QueryBalance(in)
}