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):
|
||||
debug("wechat notify called .......")
|
||||
json_response = ServerEnv().json_reponse
|
||||
Response = ServerEnv().Response
|
||||
provider = 'wechat'
|
||||
if PROVIDERS[provider] is None:
|
||||
e = Exception(f'{provider} cannot pay')
|
||||
exception(f'{e}')
|
||||
return json_response({"code":"SUCCESS", "message":"OK"})
|
||||
return Response(text='{"code":"SUCCESS","message":"OK"}', content_type='application/json')
|
||||
data = None
|
||||
try:
|
||||
data = await PROVIDERS[provider].handle_notify(request)
|
||||
except Exception as e:
|
||||
e = Exception(f'{provider} cannot pay')
|
||||
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:
|
||||
return json_response({"code":"SUCCESS", "message":"OK"})
|
||||
return Response(text='{"code":"SUCCESS","message":"OK"}', content_type='application/json')
|
||||
debug(f'{data=}')
|
||||
try:
|
||||
await unipay_accounting(request, data.data)
|
||||
except Exception as 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):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user