fix: EasyPay支付回调缺少access_token导致结果页显示"凭证缺失"

EasyPay provider未将动态returnUrl传递给底层client,
导致return_url使用静态环境变量,不含order_id和access_token参数。
This commit is contained in:
erio
2026-03-14 01:07:33 +08:00
parent ce223f09d8
commit 10e3e445ed
2 changed files with 3 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ export interface CreatePaymentOptions {
paymentType: string; paymentType: string;
clientIp: string; clientIp: string;
productName: string; productName: string;
returnUrl?: string;
} }
function normalizeCidList(cid?: string): string | undefined { function normalizeCidList(cid?: string): string | undefined {
@@ -56,7 +57,7 @@ export async function createPayment(opts: CreatePaymentOptions): Promise<EasyPay
type: opts.paymentType, type: opts.paymentType,
out_trade_no: opts.outTradeNo, out_trade_no: opts.outTradeNo,
notify_url: env.EASY_PAY_NOTIFY_URL, notify_url: env.EASY_PAY_NOTIFY_URL,
return_url: env.EASY_PAY_RETURN_URL, return_url: opts.returnUrl || env.EASY_PAY_RETURN_URL,
name: opts.productName, name: opts.productName,
money: opts.amount, money: opts.amount,
clientip: opts.clientIp, clientip: opts.clientIp,

View File

@@ -28,6 +28,7 @@ export class EasyPayProvider implements PaymentProvider {
paymentType: request.paymentType as 'alipay' | 'wxpay', paymentType: request.paymentType as 'alipay' | 'wxpay',
clientIp: request.clientIp || '127.0.0.1', clientIp: request.clientIp || '127.0.0.1',
productName: request.subject, productName: request.subject,
returnUrl: request.returnUrl,
}); });
return { return {