修改
This commit is contained in:
parent
1c0c21d7fd
commit
7b3d59a562
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fonchain-fiee/api/bundle"
|
||||
"fonchain-fiee/api/order"
|
||||
"fonchain-fiee/pkg/model/login"
|
||||
"fonchain-fiee/pkg/service"
|
||||
"fonchain-fiee/pkg/service/bundle/common"
|
||||
@ -127,17 +128,36 @@ func UpdateBundleOrderStatusPaid(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
req.Status = bundleModel.OrderPaid
|
||||
// 如果 当前订单 是 已签未支付 且 存在 checkoutSessionId 需要 查询 支付结果
|
||||
if detail.OrderRecord.Status == bundleModel.OrderSigned && detail.OrderRecord.CheckoutSessionId != "" && detail.OrderRecord.PayTime == "" {
|
||||
// 查询支付结果
|
||||
stripeInfosRes, stripeInfosErr := service.OrderProvider.QueryStripeInfoByCheckSessionIds(context.Background(), &order.QueryStripeInfoRequest{
|
||||
CheckoutSessionIds: []string{detail.OrderRecord.CheckoutSessionId},
|
||||
})
|
||||
|
||||
req.PayTime = common.GetBeijingTime()
|
||||
if stripeInfosErr != nil {
|
||||
service.Error(c, errors.New(common.ErrorQueryStripeInfo))
|
||||
return
|
||||
}
|
||||
|
||||
res, err := service.BundleProvider.UpdateOrderRecord(context.Background(), &req)
|
||||
if err != nil {
|
||||
service.Retry(c, detailErr)
|
||||
return
|
||||
if stripeInfosRes != nil && len(stripeInfosRes.StripeInfos) > 0 {
|
||||
for _, stripeInfo := range stripeInfosRes.StripeInfos {
|
||||
if stripeInfo.OutTradeNo == detail.OrderRecord.OrderNo && stripeInfo.PaymentIntentStatus == "paid" {
|
||||
_, updateOrderRecordErr := service.BundleProvider.UpdateOrderRecord(context.Background(), &bundle.OrderRecord{
|
||||
Uuid: detail.OrderRecord.Uuid,
|
||||
Status: bundleModel.OrderPaid,
|
||||
PayTime: common.GetBeijingTime(),
|
||||
})
|
||||
if updateOrderRecordErr != nil {
|
||||
service.Error(c, detailErr)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
service.Success(c, res)
|
||||
service.Success(c, nil)
|
||||
}
|
||||
|
||||
func OrderRecordsList(c *gin.Context) {
|
||||
|
Loading…
Reference in New Issue
Block a user