fix(payment): 修复支付宝通知签名验证问题

- 在支付通知日志中添加接收到的支付宝数据记录
- 移除签名验证参数中的 sign_type,避免验证错误
- 优化支付宝服务签名验证逻辑,提高兼容性和准确度
This commit is contained in:
公司git 2026-01-23 15:10:16 +08:00
parent ecccdbc84d
commit 30105c685a
2 changed files with 2 additions and 0 deletions

View File

@ -169,6 +169,7 @@ def payment_notify():
"""支付宝异步通知"""
try:
data = request.form.to_dict()
system_logger.info(f"Received Alipay Notify: {data}")
signature = data.get("sign")
if not signature:

View File

@ -52,6 +52,7 @@ class AlipayService:
# python-alipay-sdk 的 verify 方法会自动处理 sign 的移除
# 但为了保险,我们手动移除它,保留其他所有字段
verify_data.pop('sign', None)
verify_data.pop('sign_type', None)
alipay = self.get_alipay_client()
# 对于同步回调sign_type 实际上是参与签名的(某些版本/接口)