From da4a97b37fa0724de5c225f3d223c2c83d074ea5 Mon Sep 17 00:00:00 2001 From: jhc Date: Fri, 28 Mar 2025 22:02:29 +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 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/service/bundle/pay.go b/pkg/service/bundle/pay.go index 08d3d0d..4987043 100644 --- a/pkg/service/bundle/pay.go +++ b/pkg/service/bundle/pay.go @@ -30,6 +30,8 @@ func CreateStripeCheckoutSession(c *gin.Context) { // 获取 用户信息 userInfo := login.GetUserInfoFromC(c) + fmt.Println("userInfo.ID:", userInfo.ID) + // 检查 订单信息 detail, detailErr := service.BundleProvider.OrderRecordsDetail(context.Background(), &bundle.OrderRecordsDetailRequest{ OrderNo: req.OutTradeNo, @@ -40,17 +42,24 @@ func CreateStripeCheckoutSession(c *gin.Context) { return } + fmt.Printf("detail: %+v\n", detail) + // 判断 是否是 本人操作 if strconv.FormatUint(userInfo.ID, 10) != detail.OrderRecord.CustomerID { service.Error(c, errors.New(common.NotMatchOrderInfo)) return } + + fmt.Println("1111111111111111111111") + //金额校验 if detail.OrderRecord.TotalAmount != float32(req.ProductAllPrice) { service.Error(c, errors.New(common.InvalidOrderAmount)) return } + fmt.Println("22222222222222222222222") + // 如果 当前订单 是 已签未支付 且 存在 checkoutSessionId 需要 查询 支付结果 if detail.OrderRecord.Status == bundleModel.OrderSigned && detail.OrderRecord.CheckoutSessionId != "" && detail.OrderRecord.PayTime == "" { // 查询支付结果 @@ -86,6 +95,8 @@ func CreateStripeCheckoutSession(c *gin.Context) { } } + fmt.Println("333333333333333333333") + //调用微服务获取支付地址 result, err := service.OrderProvider.CreateStripeCheckoutSession(context.Background(), &req) if err != nil { @@ -93,6 +104,8 @@ func CreateStripeCheckoutSession(c *gin.Context) { return } + fmt.Println("444444444444444444444") + //更新订单状态 _, updateOrderRecordErr := service.BundleProvider.UpdateOrderRecord(context.Background(), &bundle.OrderRecord{ Uuid: detail.OrderRecord.Uuid,