This commit is contained in:
蒋海成 2025-03-29 10:53:46 +08:00
parent e795a6ab4f
commit 016fa3ee72

View File

@ -12,6 +12,7 @@ import (
"fonchain-fiee/pkg/service/bundle/common" "fonchain-fiee/pkg/service/bundle/common"
bundleModel "fonchain-fiee/pkg/service/bundle/model" bundleModel "fonchain-fiee/pkg/service/bundle/model"
"io" "io"
"math"
"net/http" "net/http"
"strconv" "strconv"
@ -52,7 +53,9 @@ func CreateStripeCheckoutSession(c *gin.Context) {
fmt.Println("req.ProductAllPrice :", req.ProductAllPrice) fmt.Println("req.ProductAllPrice :", req.ProductAllPrice)
//金额校验 //金额校验
if detail.OrderRecord.TotalAmount*100 != float32(req.ProductAllPrice) { orderAmountInCents := int64(math.Round(float64(detail.OrderRecord.TotalAmount * 100)))
reqAmountInCents := int64(math.Round(float64(req.ProductAllPrice)))
if orderAmountInCents != reqAmountInCents {
service.Error(c, errors.New(common.InvalidOrderAmount)) service.Error(c, errors.New(common.InvalidOrderAmount))
return return
} }