让代理充值复用现有网页支付能力
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m7s

微信按当前 v2/v3 配置分别生成 MWEB/H5 链接,支付宝复用 C 端 WAP 链接,并让可用支付方式基于生效配置判断。

Constraint: 支付链接统一通过 qr_content 返回,由前端渲染二维码;按要求不运行测试

Rejected: 微信 Native 与支付宝当面付 | 会引入非当前商户配置所需的额外产品开通

Confidence: high

Scope-risk: moderate

Directive: 微信 H5/MWEB 二维码仅承诺系统相机或外部浏览器扫码链路

Tested: 相关 Go 包编译通过;gofmt 与 git diff --check 通过

Not-tested: 按用户要求未运行自动化测试及真实支付联调
This commit is contained in:
2026-07-30 11:41:50 +08:00
parent 0f4f0d1176
commit 8fc667daee
24 changed files with 692 additions and 352 deletions

View File

@@ -115,7 +115,7 @@ func (l *paymentConfigLoader) buildPaymentService(config *model.WechatConfig) (w
// v2PaymentAdapter 微信支付 v2 适配器
// 将 PaymentV2Service 适配为完整的 PaymentServiceInterface
// v2 支持 JSAPI 支付,其余方法返回不支持错误
// v2 支持 JSAPI、H5/MWEB 与查单,其余方法返回不支持错误
type v2PaymentAdapter struct {
svc *wechat.PaymentV2Service
}
@@ -124,12 +124,12 @@ func (a *v2PaymentAdapter) CreateJSAPIOrder(ctx context.Context, orderNo, descri
return a.svc.CreateJSAPIOrder(ctx, orderNo, description, openID, amount)
}
func (a *v2PaymentAdapter) CreateH5Order(_ context.Context, _ string, _ string, _ int, _ *wechat.H5SceneInfo) (*wechat.H5PayResult, error) {
return nil, errors.New(errors.CodeWechatPayFailed, "微信支付 v2 不支持 H5 支付")
func (a *v2PaymentAdapter) CreateH5Order(ctx context.Context, orderNo, description string, amount int, sceneInfo *wechat.H5SceneInfo) (*wechat.H5PayResult, error) {
return a.svc.CreateH5Order(ctx, orderNo, description, amount, sceneInfo)
}
func (a *v2PaymentAdapter) QueryOrder(_ context.Context, _ string) (*wechat.OrderInfo, error) {
return nil, errors.New(errors.CodeWechatPayFailed, "微信支付 v2 暂不支持查单接口")
func (a *v2PaymentAdapter) QueryOrder(ctx context.Context, orderNo string) (*wechat.OrderInfo, error) {
return a.svc.QueryOrder(ctx, orderNo)
}
func (a *v2PaymentAdapter) CloseOrder(_ context.Context, _ string) error {