fix(payment): 修复支付宝通知签名验证问题
- 在支付通知日志中添加接收到的支付宝数据记录 - 移除签名验证参数中的 sign_type,避免验证错误 - 优化支付宝服务签名验证逻辑,提高兼容性和准确度
This commit is contained in:
parent
ecccdbc84d
commit
30105c685a
@ -169,6 +169,7 @@ def payment_notify():
|
|||||||
"""支付宝异步通知"""
|
"""支付宝异步通知"""
|
||||||
try:
|
try:
|
||||||
data = request.form.to_dict()
|
data = request.form.to_dict()
|
||||||
|
system_logger.info(f"Received Alipay Notify: {data}")
|
||||||
signature = data.get("sign")
|
signature = data.get("sign")
|
||||||
|
|
||||||
if not signature:
|
if not signature:
|
||||||
|
|||||||
@ -52,6 +52,7 @@ class AlipayService:
|
|||||||
# python-alipay-sdk 的 verify 方法会自动处理 sign 的移除
|
# python-alipay-sdk 的 verify 方法会自动处理 sign 的移除
|
||||||
# 但为了保险,我们手动移除它,保留其他所有字段
|
# 但为了保险,我们手动移除它,保留其他所有字段
|
||||||
verify_data.pop('sign', None)
|
verify_data.pop('sign', None)
|
||||||
|
verify_data.pop('sign_type', None)
|
||||||
|
|
||||||
alipay = self.get_alipay_client()
|
alipay = self.get_alipay_client()
|
||||||
# 对于同步回调,sign_type 实际上是参与签名的(某些版本/接口)
|
# 对于同步回调,sign_type 实际上是参与签名的(某些版本/接口)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user