- Change API endpoint from /v3/pay/transactions/h5 to /v3/pay/transactions/native - Remove scene_info (not needed for native mode) - Return code_url instead of h5_url - recharge.dspy: display QR code image via api.qrserver.com - user_recharge.dspy: return both code_url and qr_url
23 lines
509 B
Plaintext
23 lines
509 B
Plaintext
import urllib.parse
|
|
params_kw.amount = float(params_kw.amount)
|
|
debug(f'recharge.dspy: {params_kw=}')
|
|
try:
|
|
code_url = await create_payment(request, params_kw)
|
|
qr_img_url = 'https://api.qrserver.com/v1/create-qr-code/?size=280x280&data=' + urllib.parse.quote(code_url, safe='')
|
|
return {
|
|
"widgettype":"NewWindow",
|
|
"options":{
|
|
"url": qr_img_url,
|
|
"height": "340",
|
|
"width":"340"
|
|
}
|
|
}
|
|
except Exception as e:
|
|
return {
|
|
"widgettype":"Text",
|
|
"options":{
|
|
"width":"100%",
|
|
"text":f"{e}"
|
|
}
|
|
}
|