fix: 修复微信支付 Native/H5 判断逻辑,改为前端设备检测驱动

- 修复 clientIp 始终存在导致永远走 H5 的 bug,改用 isMobile 判断
- 前端通过 detectDeviceIsMobile() 传 is_mobile 给后端
- ENABLED_PAYMENT_TYPES 默认改为空,必须显式配置才启用
- 补充 .env.example 配置说明
This commit is contained in:
erio
2026-03-06 14:04:51 +08:00
parent 937f54dec2
commit b0f1daf469
7 changed files with 24 additions and 7 deletions

View File

@@ -35,7 +35,10 @@ export class WxpayProvider implements PaymentProvider {
throw new Error('WXPAY_NOTIFY_URL is required');
}
if (request.clientIp) {
if (request.isMobile) {
if (!request.clientIp) {
throw new Error('clientIp is required for H5 payment');
}
const h5Url = await createH5Order({
out_trade_no: request.orderId,
description: request.subject,