feat(wechat): Native payment → generate QR via env.data2qrpath → show Image for scan
This commit is contained in:
parent
24337faa55
commit
6d4dace412
@ -131,6 +131,9 @@ async def create_payment(request, params_kw=None):
|
||||
data.client_ip = client_ip
|
||||
res = await PROVIDERS[provider].create_payment(data)
|
||||
debug(f'{provider=} instance return {res}')
|
||||
if provider == 'wechat':
|
||||
qrpath = await env.data2qrpath(res)
|
||||
res = env.entire_url('/idfile') + '?path=' + env.quote(qrpath)
|
||||
return res
|
||||
raise Exception('write payment_log error')
|
||||
except Exception as e:
|
||||
|
||||
@ -2,6 +2,31 @@ params_kw.amount = float(params_kw.amount)
|
||||
debug(f'recharge.dspy: {params_kw=}')
|
||||
try:
|
||||
url = await create_payment(request, params_kw)
|
||||
if params_kw.provider == 'wechat':
|
||||
return {
|
||||
"widgettype": "VBox",
|
||||
"options": {
|
||||
"css": "card",
|
||||
"padding": "20px",
|
||||
"width": "320"
|
||||
},
|
||||
"subwidgets": [
|
||||
{
|
||||
"widgettype": "Image",
|
||||
"options": {
|
||||
"url": url,
|
||||
"width": "280"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype": "Text",
|
||||
"options": {
|
||||
"text": "请使用微信扫描二维码完成支付",
|
||||
"halign": "center"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
return {
|
||||
"widgettype":"NewWindow",
|
||||
"options":{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user