fix(wechat): use Response instead of missing json_response in callback
ServerEnv().json_reponse does not exist, causing 'NoneType' object is not callable. Align with alipay_notify pattern: use aiohttp Response directly with JSON string body.
This commit is contained in:
parent
7e37b00672
commit
97524da74d
@ -184,27 +184,26 @@ 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 = ServerEnv().json_reponse
|
Response = ServerEnv().Response
|
||||||
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 json_response({"code":"SUCCESS", "message":"OK"})
|
return Response(text='{"code":"SUCCESS","message":"OK"}', content_type='application/json')
|
||||||
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')
|
|
||||||
exception(f'{e}')
|
exception(f'{e}')
|
||||||
return json_response({"code":"SUCCESS", "message":"OK"})
|
return Response(text='{"code":"SUCCESS","message":"OK"}', content_type='application/json')
|
||||||
if data is None:
|
if data is None:
|
||||||
return json_response({"code":"SUCCESS", "message":"OK"})
|
return Response(text='{"code":"SUCCESS","message":"OK"}', content_type='application/json')
|
||||||
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 json_response({"code":"SUCCESS", "message":"OK"})
|
return Response(text='{"code":"SUCCESS","message":"OK"}', content_type='application/json')
|
||||||
|
|
||||||
# 支付宝回调入口
|
# 支付宝回调入口
|
||||||
async def alipay_notify(request):
|
async def alipay_notify(request):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user