revert: QR code is required for Native payment, weixin:// is not a web URL
Native payment code_url uses weixin:// protocol which is a WeChat deep link, not openable in browsers. QR code is the standard approach - user scans with WeChat and completes payment within the app.
This commit is contained in:
parent
a95c548f84
commit
a0bd6fb24f
@ -1,15 +1,15 @@
|
|||||||
|
import urllib.parse
|
||||||
params_kw.amount = float(params_kw.amount)
|
params_kw.amount = float(params_kw.amount)
|
||||||
debug(f'recharge.dspy: {params_kw=}')
|
debug(f'recharge.dspy: {params_kw=}')
|
||||||
try:
|
try:
|
||||||
code_url = await create_payment(request, params_kw)
|
code_url = await create_payment(request, params_kw)
|
||||||
# weixin://wxpay/bizpayurl?pr=xxx → https://wx.tenpay.com/f2f?pr=xxx
|
qr_url = 'https://api.qrserver.com/v1/create-qr-code/?size=280x280&data=' + urllib.parse.quote(code_url, safe='')
|
||||||
pay_url = code_url.replace('weixin://wxpay/bizpayurl', 'https://wx.tenpay.com/f2f')
|
|
||||||
return {
|
return {
|
||||||
"widgettype":"NewWindow",
|
"widgettype":"NewWindow",
|
||||||
"options":{
|
"options":{
|
||||||
"url": pay_url,
|
"url": qr_url,
|
||||||
"height": "100%",
|
"height": "340",
|
||||||
"width":"100%"
|
"width":"340"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user