修复了订单状态更新 BUG
This commit is contained in:
@@ -169,6 +169,11 @@ def verify_notify_params(params, club_id=None):
|
||||
"""
|
||||
验证支付宝异步回调签名。
|
||||
params 为已解析的字典(来自 POST form 数据)。
|
||||
|
||||
注意:回调验签与请求签名规则不同!
|
||||
- 请求签名:sign_type 参与签名(只排除 sign)
|
||||
- 回调验签:sign_type 不参与签名(排除 sign 和 sign_type)
|
||||
支付宝官方文档:通知返回参数中除去 sign、sign_type 两个参数外,皆是待验签参数。
|
||||
"""
|
||||
cfg = get_alipay_config(club_id)
|
||||
sign = params.get('sign', '')
|
||||
@@ -177,7 +182,9 @@ def verify_notify_params(params, club_id=None):
|
||||
sign_type = params.get('sign_type', '')
|
||||
if sign_type and sign_type.upper() != 'RSA2':
|
||||
return False
|
||||
sign_content = _build_sign_content(params)
|
||||
# 回调验签:排除 sign 和 sign_type(支付宝官方规则)
|
||||
sorted_keys = sorted(k for k in params if k not in ('sign', 'sign_type'))
|
||||
sign_content = '&'.join(f'{k}={params[k]}' for k in sorted_keys if params[k] != '')
|
||||
return verify_rsa2(sign_content, sign, cfg['ALIPAY_PUBLIC_KEY'])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user