diff --git a/pkg/service/bundle/pay.go b/pkg/service/bundle/pay.go index c697059..eba40bd 100644 --- a/pkg/service/bundle/pay.go +++ b/pkg/service/bundle/pay.go @@ -167,6 +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}, }) if detailErr != nil { fmt.Println("=============== antom创建支付,查询主订单信息报错:", detailErr)