优化支付退款钱包链路

This commit is contained in:
yml
2026-06-03 21:47:04 +08:00
parent 04193ae687
commit c80d3f960e
26 changed files with 1342 additions and 504 deletions
+9 -3
View File
@@ -6,6 +6,8 @@ var (
ErrDependencyUnavailable = errors.New("dependency unavailable")
ErrInvalidAmount = errors.New("invalid amount")
ErrInsufficientBalance = errors.New("insufficient balance")
ErrFeaturePending = errors.New("feature pending")
ErrRechargeDisabled = errors.New("wallet recharge disabled")
)
const MinRechargeAmount = 0.01
@@ -36,10 +38,14 @@ func (s *Service) Recharge(userID uint64, req RechargeRequest) (*AccountDTO, err
if s.repo == nil {
return nil, ErrDependencyUnavailable
}
if req.Amount < MinRechargeAmount {
return nil, ErrInvalidAmount
return nil, ErrRechargeDisabled
}
func (s *Service) Withdraw(userID uint64, req WithdrawRequest) (*AccountDTO, error) {
if s.repo == nil {
return nil, ErrDependencyUnavailable
}
return s.repo.Recharge(userID, req.Amount)
return nil, ErrFeaturePending
}
func (s *Service) AdminLedger(query AdminLedgerQuery) (*PaginatedResult, error) {