修改支付相关

This commit is contained in:
Yvan
2026-09-23 18:16:56 +08:00
parent 38d071b137
commit 5c1da5bf55
2 changed files with 117 additions and 5 deletions
+12 -5
View File
@@ -39,15 +39,22 @@ func (a *wechatV3Adapter) Create(ctx context.Context, req *bizpayment.PaymentReq
bm.SetBodyMap("amount", func(amount gopay.BodyMap) {
amount.Set("total", req.Amount).Set("currency", strings.ToUpper(req.Currency))
})
mergeGoPayExtras(bm, req.Extra,
"appid", "mchid", "description", "out_trade_no", "notify_url", "amount", "payer",
"trade_type", "pay_type", "method", "openid", "open_id", "auth_code", "authcode", "barcode",
)
tradeType := normalizeWechatV3TradeType(firstAny(req.Extra, "trade_type", "pay_type", "method"))
if tradeType == "" {
tradeType = normalizeWechatV3TradeType(firstAny(c, "trade_type", "pay_type", "method"))
}
if tradeType == "native" || tradeType == "qr" || tradeType == "qrcode" {
for _, key := range []string{"time_expire", "attach", "goods_tag", "support_fapiao", "detail", "scene_info", "settle_info"} {
if value, ok := req.Extra[key]; ok {
bm[key] = value
}
}
} else {
mergeGoPayExtras(bm, req.Extra,
"appid", "mchid", "description", "out_trade_no", "notify_url", "amount", "payer",
"trade_type", "pay_type", "method", "openid", "open_id", "auth_code", "authcode", "barcode",
)
}
switch tradeType {
case "", "jsapi", "js_api", "mini", "miniapp", "mini_app", "miniprogram", "mini_program", "applet":
if openID := firstAny(req.Extra, "openid", "open_id"); openID != "" {