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()
|
form = await request.post()
|
||||||
params = dict(form)
|
params = dict(form)
|
||||||
"""
|
|
||||||
|
|
||||||
sign = params.pop("sign", None)
|
sign = params.pop("sign", None)
|
||||||
sign_type = params.pop("sign_type", None)
|
sign_type = params.pop("sign_type", None)
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import base64
|
|||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
from appPublic.dictObject import DictObject
|
||||||
from typing import Dict, Any
|
from typing import Dict, Any
|
||||||
from cryptography.hazmat.primitives import hashes, serialization
|
from cryptography.hazmat.primitives import hashes, serialization
|
||||||
from cryptography.hazmat.primitives.asymmetric import padding
|
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:
|
解密/验证回调,返回标准 dict:
|
||||||
out_trade_no
|
out_trade_no
|
||||||
@ -242,6 +243,8 @@ class WechatGateway(Gateway):
|
|||||||
trade_state
|
trade_state
|
||||||
payer info
|
payer info
|
||||||
"""
|
"""
|
||||||
|
headers = request.headers
|
||||||
|
body = await request.read().decode('utf-8')
|
||||||
await self._verify_callback(headers, body)
|
await self._verify_callback(headers, body)
|
||||||
|
|
||||||
payload = json.loads(body)
|
payload = json.loads(body)
|
||||||
@ -249,11 +252,9 @@ class WechatGateway(Gateway):
|
|||||||
decrypted = self._decrypt_resource(resource)
|
decrypted = self._decrypt_resource(resource)
|
||||||
|
|
||||||
# 返回标准结构
|
# 返回标准结构
|
||||||
return {
|
ret = {
|
||||||
"provider": "wechat",
|
"provider": "wechat",
|
||||||
"data": decrypted,
|
"params": decrypted
|
||||||
"out_trade_no": decrypted.get("out_trade_no"),
|
|
||||||
"trans_no": decrypted.get("transaction_id"),
|
|
||||||
"status": decrypted.get("trade_state")
|
|
||||||
}
|
}
|
||||||
|
return DictObject(**ret)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user