支付优化调整

This commit is contained in:
momo 2023-11-23 15:59:41 +08:00
parent cfc1468307
commit 24df252924
2 changed files with 8 additions and 8 deletions

View File

@ -639,13 +639,13 @@ func (d *defaultOrder) CloseList(ctx context.Context, in *CloseListReq) (res *Cl
var cptime = orderInfo.Ctime.Add(time.Minute * 30)
var dd = ntime.Unix() - cptime.Unix()
if in.Type == 1 {
fmt.Println("未支付超时时间: dd--", dd)
// fmt.Println("未支付超时时间: dd--", dd)
if dd >= 0 {
orderSn := *orderInfo.OrderSn
fmt.Println("即时任务: OrderSn--", orderSn)
// fmt.Println("即时任务: OrderSn--", orderSn)
ctx := context.Background()
logc.Infof(ctx, "order CloseList, orderSn: %s", orderSn)
// logc.Infof(ctx, "order CloseList, orderSn: %s", orderSn)
d.Close(ctx, &CloseReq{
OrderSn: orderSn,
Type: 1,
@ -655,10 +655,10 @@ func (d *defaultOrder) CloseList(ctx context.Context, in *CloseListReq) (res *Cl
// 延时任务
time.AfterFunc(time.Second*time.Duration(ddd), func() {
orderSn := *orderInfo.OrderSn
fmt.Println("延时任务: OrderSn--", orderSn)
// fmt.Println("延时任务: OrderSn--", orderSn)
ctx := context.Background()
logc.Infof(ctx, "order CloseList, orderSn: %s", orderSn)
// logc.Infof(ctx, "order CloseList, orderSn: %s", orderSn)
d.Close(ctx, &CloseReq{
OrderSn: orderSn,
Type: 1,

View File

@ -27,7 +27,6 @@ func (stripePay *Stripe) PayRefund(req *PayRefundReq) (res *PayRefundRes, err er
// 生成预付款
func (stripePay *Stripe) GeneratePrepayment(req *GeneratePrepaymentReq) (res *GeneratePrepaymentRes, err error) {
var productData stripe.CheckoutSessionLineItemPriceDataProductDataParams
// productData.Metadata = map[string]string{"order_id": "33333333333333"}
if req.ProductName != "" {
productData.Name = stripe.String(req.ProductName)
@ -50,8 +49,6 @@ func (stripePay *Stripe) GeneratePrepayment(req *GeneratePrepaymentReq) (res *Ge
case "session":
// session 方式
params := &stripe.CheckoutSessionParams{
PaymentIntentData: &stripe.CheckoutSessionPaymentIntentDataParams{Metadata: req.Metadata},
// Params: stripe.Params{Metadata: map[string]string{"order_id": "1111111111111"}},
PaymentMethodTypes: stripe.StringSlice([]string{
"card",
// "ideal",
@ -70,6 +67,9 @@ func (stripePay *Stripe) GeneratePrepayment(req *GeneratePrepaymentReq) (res *Ge
SuccessURL: stripe.String(req.SuccessURL),
CancelURL: stripe.String(req.CancelURL),
}
for key, item := range req.Metadata {
params.AddMetadata(key, item)
}
resCheckoutSession, err := session.New(params)
if err != nil {
return nil, err