统一金额分制重构
This commit is contained in:
@@ -229,8 +229,8 @@ func (r *Repository) Start(userID uint64, orderID uint64, req StartPaymentReques
|
||||
}
|
||||
|
||||
func (r *Repository) StartWalletRecharge(userID uint64, req WalletRechargePaymentRequest, clientIP string) (*PaymentDTO, error) {
|
||||
amountCent := moneyCent(req.Amount)
|
||||
if userID == 0 || req.Amount < MinWalletRechargeAmount || amountCent <= 0 {
|
||||
amountCent := req.AmountCent
|
||||
if userID == 0 || amountCent < moneyCent(MinWalletRechargeAmount) {
|
||||
return nil, ErrPaymentCannotStart
|
||||
}
|
||||
runtimeConfig, err := r.defaultRuntimeConfig()
|
||||
@@ -764,7 +764,7 @@ func (r *Repository) preparePayment(userID uint64, orderID uint64, req StartPaym
|
||||
if row.Status != "pending_payment" {
|
||||
return ErrPaymentCannotStart
|
||||
}
|
||||
amountCent := moneyCent(row.RentAmount + row.DepositAmount)
|
||||
amountCent := row.RentAmountCent + row.DepositAmountCent
|
||||
if amountCent <= 0 {
|
||||
return ErrPaymentCannotStart
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user