bugfix
This commit is contained in:
parent
9b2e2e08df
commit
8a44bc2fb8
@ -137,48 +137,50 @@ async def refund_payment(request, params_kw=None):
|
|||||||
# 微信支付回调入口
|
# 微信支付回调入口
|
||||||
async def wechat_notify(request):
|
async def wechat_notify(request):
|
||||||
debug("wechat notify called .......")
|
debug("wechat notify called .......")
|
||||||
|
json_response = request._run_ns.json_reponse
|
||||||
provider = 'wechat'
|
provider = 'wechat'
|
||||||
if PROVIDERS[provider] is None:
|
if PROVIDERS[provider] is None:
|
||||||
e = Exception(f'{provider} cannot pay')
|
e = Exception(f'{provider} cannot pay')
|
||||||
exception(f'{e}')
|
exception(f'{e}')
|
||||||
return
|
return json_response({"code":"SUCCESS", "message":"OK"})
|
||||||
data = None
|
data = None
|
||||||
try:
|
try:
|
||||||
data = await PROVIDERS[provider].handle_notify(request)
|
data = await PROVIDERS[provider].handle_notify(request)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
e = Exception(f'{provider} cannot pay')
|
e = Exception(f'{provider} cannot pay')
|
||||||
exception(f'{e}')
|
exception(f'{e}')
|
||||||
return
|
return json_response({"code":"SUCCESS", "message":"OK"})
|
||||||
if data is None:
|
if data is None:
|
||||||
return {"code":"SUCCESS", "message":"OK"}
|
return json_response({"code":"SUCCESS", "message":"OK"})
|
||||||
debug(f'{data=}')
|
debug(f'{data=}')
|
||||||
try:
|
try:
|
||||||
await unipay_accounting(request, data.data)
|
await unipay_accounting(request, data.data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
exception(f'{e}')
|
exception(f'{e}')
|
||||||
return {"code":"SUCCESS", "message":"OK"}
|
return json_response({"code":"SUCCESS", "message":"OK"})
|
||||||
|
|
||||||
# 支付宝回调入口
|
# 支付宝回调入口
|
||||||
async def alipay_notify(request):
|
async def alipay_notify(request):
|
||||||
debug("alipay notify called .......")
|
debug("alipay notify called .......")
|
||||||
|
Response = request._run_ns.Response
|
||||||
provider = 'alipay'
|
provider = 'alipay'
|
||||||
if PROVIDERS[provider] is None:
|
if PROVIDERS[provider] is None:
|
||||||
e = Exception(f'{provider} cannot pay')
|
e = Exception(f'{provider} cannot pay')
|
||||||
exception(f'{e}')
|
exception(f'{e}')
|
||||||
return
|
return Response(text='success', status=200)
|
||||||
data = None
|
data = None
|
||||||
try:
|
try:
|
||||||
data = await PROVIDERS[provider].handle_notify(request)
|
data = await PROVIDERS[provider].handle_notify(request)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
e = Exception(f'{provider} cannot pay')
|
e = Exception(f'{provider} cannot pay')
|
||||||
exception(f'{e}')
|
exception(f'{e}')
|
||||||
return
|
return Response(text='success', status=200)
|
||||||
debug(f'{data=}')
|
debug(f'{data=}')
|
||||||
try:
|
try:
|
||||||
await unipay_accounting(request, data.data)
|
await unipay_accounting(request, data.data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
exception(f'{e}')
|
exception(f'{e}')
|
||||||
return {"code":"SUCCESS", "message":"OK"}
|
return Response(text='success', status=200)
|
||||||
|
|
||||||
async def setup_callback_path(app):
|
async def setup_callback_path(app):
|
||||||
app.router.add_post('/unipay/notify/wechat', wechat_notify)
|
app.router.add_post('/unipay/notify/wechat', wechat_notify)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user