优化乐刷通知与钱包充值流程

This commit is contained in:
yml
2026-06-03 18:51:56 +08:00
parent a1942c8453
commit 783999f396
9 changed files with 1938 additions and 73 deletions
+5 -3
View File
@@ -10,6 +10,8 @@ var (
ErrPaymentNotFound = errors.New("payment not found")
)
const MinWalletRechargeAmount = 0.01
type Service struct {
repo *Repository
}
@@ -42,7 +44,7 @@ func (s *Service) StartWalletRecharge(userID uint64, req WalletRechargePaymentRe
if s.repo == nil {
return nil, ErrDependencyUnavailable
}
if userID == 0 || req.Amount <= 0 {
if userID == 0 || req.Amount < MinWalletRechargeAmount {
return nil, ErrPaymentCannotStart
}
return s.repo.StartWalletRecharge(userID, req, clientIP)
@@ -58,9 +60,9 @@ func (s *Service) QueryWalletRecharge(userID uint64, paymentID uint64) (*Payment
return s.repo.QueryWalletRecharge(userID, paymentID)
}
func (s *Service) HandleLeshuaNotify(params map[string]string) (*NotifyResult, error) {
func (s *Service) HandleLeshuaNotify(params map[string]string, rawPayload string, contentType string) (*NotifyResult, error) {
if s.repo == nil {
return nil, ErrDependencyUnavailable
}
return s.repo.HandleLeshuaNotify(params)
return s.repo.HandleLeshuaNotify(params, rawPayload, contentType)
}