diff --git a/pkg/service/bundle/bundleOrder.go b/pkg/service/bundle/bundleOrder.go index 6699329..028e0b6 100644 --- a/pkg/service/bundle/bundleOrder.go +++ b/pkg/service/bundle/bundleOrder.go @@ -140,7 +140,10 @@ func UpdateBundleOrderStatusPaid(c *gin.Context) { return } + totalStripe := 0 + if stripeInfosRes != nil && len(stripeInfosRes.StripeInfos) > 0 { + totalStripe = len(stripeInfosRes.StripeInfos) for _, stripeInfo := range stripeInfosRes.StripeInfos { if stripeInfo.OutTradeNo == detail.OrderRecord.OrderNo && stripeInfo.PaymentIntentStatus == "paid" { _, updateOrderRecordErr := service.BundleProvider.UpdateOrderRecord(context.Background(), &bundle.OrderRecord{ @@ -152,9 +155,22 @@ func UpdateBundleOrderStatusPaid(c *gin.Context) { service.Error(c, detailErr) return } + totalStripe-- } } } + + if totalStripe != 0 && totalStripe == len(stripeInfosRes.StripeInfos) { + _, updateOrderRecordErr := service.BundleProvider.UpdateOrderRecord(context.Background(), &bundle.OrderRecord{ + Uuid: detail.OrderRecord.Uuid, + CheckoutSessionId: "", + CheckoutSessionUrl: "", + }) + if updateOrderRecordErr != nil { + service.Error(c, detailErr) + return + } + } } service.Success(c, nil) diff --git a/pkg/service/bundle/pay.go b/pkg/service/bundle/pay.go index e798920..4b80a7d 100644 --- a/pkg/service/bundle/pay.go +++ b/pkg/service/bundle/pay.go @@ -65,6 +65,7 @@ func CreateStripeCheckoutSession(c *gin.Context) { Status: bundleModel.OrderPaid, PayTime: common.GetBeijingTime(), }) + fmt.Println("detail.OrderRecord.Uuid :", detail.OrderRecord.Uuid) if updateOrderRecordErr != nil { service.Error(c, detailErr) return