From d5546933f9c7f532821dcc89f59986056564f00c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=80=E5=B0=BC=E9=BE=9F?= <365252428@qq.com> Date: Mon, 23 Jun 2025 15:40:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/service/bundle/pay.go | 44 +++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/pkg/service/bundle/pay.go b/pkg/service/bundle/pay.go index eba40bd..43c6a64 100644 --- a/pkg/service/bundle/pay.go +++ b/pkg/service/bundle/pay.go @@ -167,26 +167,26 @@ func CreateAntomPay(c *gin.Context) { // 检查 订单信息 type是1说明既有主套餐又有增值服务 detail, detailErr := service.BundleProvider.OrderRecordsDetail(context.Background(), &bundle.OrderRecordsDetailRequest{ OrderNo: req.OutTradeNo, - //金额校验 - orderAmountInCents := int64(math.Round(float64(detail.OrderRecord.TotalAmount * 100))) - reqAmountInCents := int64(math.Round(float64(req.ProductAllPrice))) - if orderAmountInCents != reqAmountInCents { - fmt.Println("orderAmountInCents :", orderAmountInCents) - fmt.Println("reqAmountInCents :", reqAmountInCents) - fmt.Println("111111111111111111111111111111111111") - service.Error(c, errors.New(common.InvalidOrderAmount)) - return - } - - fmt.Println("detail.OrderRecord.Status :", detail.OrderRecord.Status) - fmt.Println("detail.OrderRecord.CheckoutSessionId :", detail.OrderRecord.CheckoutSessionId) - fmt.Println("detail.OrderRecord.PayTime :", detail.OrderRecord.PayTime) - - // 如果 当前订单 是 已签未支付 且 存在 checkoutSessionId 需要 查询 支付结果 - if detail.OrderRecord.Status == bundleModel.OrderSigned && detail.OrderRecord.CheckoutSessionId != "" && detail.OrderRecord.PayTime == "" { - // 查询支付结果 - stripeInfosRes, stripeInfosErr := service.PaymentProvider.QueryAntomPayByCheckoutSessionId(context.Background(), &payment.AntomPayQueryRequest{ - CheckoutSessionIds: []string{detail.OrderRecord.CheckoutSessionId}, + ////金额校验 + //orderAmountInCents := int64(math.Round(float64(detail.OrderRecord.TotalAmount * 100))) + //reqAmountInCents := int64(math.Round(float64(req.ProductAllPrice))) + //if orderAmountInCents != reqAmountInCents { + // fmt.Println("orderAmountInCents :", orderAmountInCents) + // fmt.Println("reqAmountInCents :", reqAmountInCents) + // fmt.Println("111111111111111111111111111111111111") + // service.Error(c, errors.New(common.InvalidOrderAmount)) + // return + //} + // + //fmt.Println("detail.OrderRecord.Status :", detail.OrderRecord.Status) + //fmt.Println("detail.OrderRecord.CheckoutSessionId :", detail.OrderRecord.CheckoutSessionId) + //fmt.Println("detail.OrderRecord.PayTime :", detail.OrderRecord.PayTime) + // + //// 如果 当前订单 是 已签未支付 且 存在 checkoutSessionId 需要 查询 支付结果 + //if detail.OrderRecord.Status == bundleModel.OrderSigned && detail.OrderRecord.CheckoutSessionId != "" && detail.OrderRecord.PayTime == "" { + // // 查询支付结果 + // stripeInfosRes, stripeInfosErr := service.PaymentProvider.QueryAntomPayByCheckoutSessionId(context.Background(), &payment.AntomPayQueryRequest{ + // CheckoutSessionIds: []string{detail.OrderRecord.CheckoutSessionId}, }) if detailErr != nil { fmt.Println("=============== antom创建支付,查询主订单信息报错:", detailErr) @@ -257,6 +257,8 @@ func CreateAntomPay(c *gin.Context) { orderAmountInCents := int64(math.Round(float64(detail.OrderRecord.TotalAmount * 100))) reqAmountInCents := int64(math.Round(float64(req.ProductAllPrice))) if orderAmountInCents != reqAmountInCents { + fmt.Println("orderAmountInCents :", orderAmountInCents) + fmt.Println("reqAmountInCents :", reqAmountInCents) fmt.Println("111111111111111111111111111111111111") service.Error(c, errors.New(common.InvalidOrderAmount)) return @@ -334,6 +336,8 @@ func CreateAntomPay(c *gin.Context) { //金额校验 reqAmountInCents := int64(math.Round(float64(req.ProductAllPrice))) if orderAmountInCents != reqAmountInCents { + fmt.Println("orderAmountInCents :", orderAmountInCents) + fmt.Println("reqAmountInCents :", reqAmountInCents) fmt.Println("111111111111111111111111111111111111") service.Error(c, errors.New(common.InvalidOrderAmount)) return