diff --git a/unipay/init.py b/unipay/init.py index a1c104c..4dd936c 100644 --- a/unipay/init.py +++ b/unipay/init.py @@ -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):