fix(支付): 修复金额计算精度问题
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 6m45s

在epayPayment和CryptoSaaSPayment方法中,对转换后的金额进行四舍五入保留两位小数处理,确保支付金额精度准确
This commit is contained in:
shanshanzhong 2025-12-02 02:35:05 -08:00
parent 9987bd43fa
commit 6fba1d683a

View File

@ -271,10 +271,11 @@ func (l *PurchaseCheckoutLogic) epayPayment(config *payment.Payment, info *order
client := epay.NewClient(epayConfig.Pid, epayConfig.Url, epayConfig.Key, epayConfig.Type)
// Convert order amount to CNY using current exchange rate
amount, err := l.queryExchangeRate("CNY", info.Amount)
if err != nil {
return "", err
}
amount, err := l.queryExchangeRate("CNY", info.Amount)
if err != nil {
return "", err
}
amount = math.Round(amount*100) / 100
// Build notification URL for payment status callbacks
notifyUrl := ""
@ -313,10 +314,11 @@ func (l *PurchaseCheckoutLogic) CryptoSaaSPayment(config *payment.Payment, info
client := epay.NewClient(epayConfig.AccountID, epayConfig.Endpoint, epayConfig.SecretKey, epayConfig.Type)
// Convert order amount to CNY using current exchange rate
amount, err := l.queryExchangeRate("CNY", info.Amount)
if err != nil {
return "", err
}
amount, err := l.queryExchangeRate("CNY", info.Amount)
if err != nil {
return "", err
}
amount = math.Round(amount*100) / 100
// Build notification URL for payment status callbacks
notifyUrl := ""