优化乐刷通知与钱包充值流程
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user