This commit is contained in:
yumoqing 2025-12-25 18:10:05 +08:00
parent 9b2e2e08df
commit 8a44bc2fb8

View File

@ -137,48 +137,50 @@ async def refund_payment(request, params_kw=None):
# 微信支付回调入口
async def wechat_notify(request):
debug("wechat notify called .......")
json_response = request._run_ns.json_reponse
provider = 'wechat'
if PROVIDERS[provider] is None:
e = Exception(f'{provider} cannot pay')
exception(f'{e}')
return
return json_response({"code":"SUCCESS", "message":"OK"})
data = None
try:
data = await PROVIDERS[provider].handle_notify(request)
except Exception as e:
e = Exception(f'{provider} cannot pay')
exception(f'{e}')
return
return json_response({"code":"SUCCESS", "message":"OK"})
if data is None:
return {"code":"SUCCESS", "message":"OK"}
return json_response({"code":"SUCCESS", "message":"OK"})
debug(f'{data=}')
try:
await unipay_accounting(request, data.data)
except Exception as e:
exception(f'{e}')
return {"code":"SUCCESS", "message":"OK"}
return json_response({"code":"SUCCESS", "message":"OK"})
# 支付宝回调入口
async def alipay_notify(request):
debug("alipay notify called .......")
Response = request._run_ns.Response
provider = 'alipay'
if PROVIDERS[provider] is None:
e = Exception(f'{provider} cannot pay')
exception(f'{e}')
return
return Response(text='success', status=200)
data = None
try:
data = await PROVIDERS[provider].handle_notify(request)
except Exception as e:
e = Exception(f'{provider} cannot pay')
exception(f'{e}')
return
return Response(text='success', status=200)
debug(f'{data=}')
try:
await unipay_accounting(request, data.data)
except Exception as e:
exception(f'{e}')
return {"code":"SUCCESS", "message":"OK"}
return Response(text='success', status=200)
async def setup_callback_path(app):
app.router.add_post('/unipay/notify/wechat', wechat_notify)