bugfix
This commit is contained in:
parent
faac5c4113
commit
56bf87dfda
@ -192,12 +192,13 @@ class AlipayGateway(Gateway):
|
||||
# 回调 / 异步通知(验签)
|
||||
# ==============================================================================
|
||||
|
||||
async def handle_notify(self, request, params) -> Dict[str, Any]:
|
||||
async def handle_notify(self, request) -> Dict[str, Any]:
|
||||
"""
|
||||
支付宝异步通知验签
|
||||
"""
|
||||
|
||||
form = await request.post()
|
||||
params = dict(form)
|
||||
"""
|
||||
|
||||
sign = params.pop("sign", None)
|
||||
sign_type = params.pop("sign_type", None)
|
||||
|
||||
@ -3,6 +3,7 @@ import base64
|
||||
import json
|
||||
import time
|
||||
import aiohttp
|
||||
from appPublic.dictObject import DictObject
|
||||
from typing import Dict, Any
|
||||
from cryptography.hazmat.primitives import hashes, serialization
|
||||
from cryptography.hazmat.primitives.asymmetric import padding
|
||||
@ -234,7 +235,7 @@ class WechatGateway(Gateway):
|
||||
}
|
||||
|
||||
# -----------------------------------------------------
|
||||
async def handle_notify(self, headers: Dict[str, str], body: str) -> Dict[str, Any]:
|
||||
async def handle_notify(self, request) -> Dict[str, Any]:
|
||||
"""
|
||||
解密/验证回调,返回标准 dict:
|
||||
out_trade_no
|
||||
@ -242,6 +243,8 @@ class WechatGateway(Gateway):
|
||||
trade_state
|
||||
payer info
|
||||
"""
|
||||
headers = request.headers
|
||||
body = await request.read().decode('utf-8')
|
||||
await self._verify_callback(headers, body)
|
||||
|
||||
payload = json.loads(body)
|
||||
@ -249,11 +252,9 @@ class WechatGateway(Gateway):
|
||||
decrypted = self._decrypt_resource(resource)
|
||||
|
||||
# 返回标准结构
|
||||
return {
|
||||
ret = {
|
||||
"provider": "wechat",
|
||||
"data": decrypted,
|
||||
"out_trade_no": decrypted.get("out_trade_no"),
|
||||
"trans_no": decrypted.get("transaction_id"),
|
||||
"status": decrypted.get("trade_state")
|
||||
"params": decrypted
|
||||
}
|
||||
return DictObject(**ret)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user