修复了订单状态的验签问题
This commit is contained in:
@@ -178,14 +178,20 @@ def verify_notify_params(params, club_id=None):
|
||||
cfg = get_alipay_config(club_id)
|
||||
sign = params.get('sign', '')
|
||||
if not sign:
|
||||
logger.warning('[ALIPAY_VERIFY_DEBUG] sign 为空')
|
||||
return False
|
||||
sign_type = params.get('sign_type', '')
|
||||
if sign_type and sign_type.upper() != 'RSA2':
|
||||
logger.warning(f'[ALIPAY_VERIFY_DEBUG] sign_type 非 RSA2: {sign_type}')
|
||||
return False
|
||||
# 回调验签:排除 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'])
|
||||
logger.warning(f'[ALIPAY_VERIFY_DEBUG] sign_content(前300)={sign_content[:300]}')
|
||||
logger.warning(f'[ALIPAY_VERIFY_DEBUG] sign(前50)={sign[:50]}')
|
||||
result = verify_rsa2(sign_content, sign, cfg['ALIPAY_PUBLIC_KEY'])
|
||||
logger.warning(f'[ALIPAY_VERIFY_DEBUG] verify_rsa2 result={result}')
|
||||
return result
|
||||
|
||||
|
||||
# ==================== wap.pay 跳转 URL ====================
|
||||
|
||||
Reference in New Issue
Block a user