修改
This commit is contained in:
parent
93cda03195
commit
da4a97b37f
@ -30,6 +30,8 @@ func CreateStripeCheckoutSession(c *gin.Context) {
|
|||||||
// 获取 用户信息
|
// 获取 用户信息
|
||||||
userInfo := login.GetUserInfoFromC(c)
|
userInfo := login.GetUserInfoFromC(c)
|
||||||
|
|
||||||
|
fmt.Println("userInfo.ID:", userInfo.ID)
|
||||||
|
|
||||||
// 检查 订单信息
|
// 检查 订单信息
|
||||||
detail, detailErr := service.BundleProvider.OrderRecordsDetail(context.Background(), &bundle.OrderRecordsDetailRequest{
|
detail, detailErr := service.BundleProvider.OrderRecordsDetail(context.Background(), &bundle.OrderRecordsDetailRequest{
|
||||||
OrderNo: req.OutTradeNo,
|
OrderNo: req.OutTradeNo,
|
||||||
@ -40,17 +42,24 @@ func CreateStripeCheckoutSession(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Printf("detail: %+v\n", detail)
|
||||||
|
|
||||||
// 判断 是否是 本人操作
|
// 判断 是否是 本人操作
|
||||||
if strconv.FormatUint(userInfo.ID, 10) != detail.OrderRecord.CustomerID {
|
if strconv.FormatUint(userInfo.ID, 10) != detail.OrderRecord.CustomerID {
|
||||||
service.Error(c, errors.New(common.NotMatchOrderInfo))
|
service.Error(c, errors.New(common.NotMatchOrderInfo))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Println("1111111111111111111111")
|
||||||
|
|
||||||
//金额校验
|
//金额校验
|
||||||
if detail.OrderRecord.TotalAmount != float32(req.ProductAllPrice) {
|
if detail.OrderRecord.TotalAmount != float32(req.ProductAllPrice) {
|
||||||
service.Error(c, errors.New(common.InvalidOrderAmount))
|
service.Error(c, errors.New(common.InvalidOrderAmount))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Println("22222222222222222222222")
|
||||||
|
|
||||||
// 如果 当前订单 是 已签未支付 且 存在 checkoutSessionId 需要 查询 支付结果
|
// 如果 当前订单 是 已签未支付 且 存在 checkoutSessionId 需要 查询 支付结果
|
||||||
if detail.OrderRecord.Status == bundleModel.OrderSigned && detail.OrderRecord.CheckoutSessionId != "" && detail.OrderRecord.PayTime == "" {
|
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)
|
result, err := service.OrderProvider.CreateStripeCheckoutSession(context.Background(), &req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -93,6 +104,8 @@ func CreateStripeCheckoutSession(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Println("444444444444444444444")
|
||||||
|
|
||||||
//更新订单状态
|
//更新订单状态
|
||||||
_, updateOrderRecordErr := service.BundleProvider.UpdateOrderRecord(context.Background(), &bundle.OrderRecord{
|
_, updateOrderRecordErr := service.BundleProvider.UpdateOrderRecord(context.Background(), &bundle.OrderRecord{
|
||||||
Uuid: detail.OrderRecord.Uuid,
|
Uuid: detail.OrderRecord.Uuid,
|
||||||
|
Loading…
Reference in New Issue
Block a user