fix: V3签名从私钥配对证书自动取序列号,xq忽略club错误私钥路径

SIGN_ERROR根因是私钥与序列号不是同一套证书;扫描匹配 apiclient_cert.pem。
新增 manage.py wx_v3_pay_diag 探针验签。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-10 22:31:14 +08:00
parent 2e419b5b6e
commit b5021ee07d
3 changed files with 182 additions and 19 deletions

View File

@@ -1,3 +1,4 @@
import logging
import re
import time
import hashlib
@@ -13,6 +14,8 @@ from Crypto.Cipher import AES
from django.conf import settings
logger = logging.getLogger(__name__)
def _get_v3_config(club_id=None):
from jituan.services.wechat_pay import get_wechat_v3_config
@@ -39,6 +42,10 @@ def build_authorization(method, url, body, club_id=None):
private_key = load_private_key(club_id)
mchid = cfg['MCHID']
serial_no = (cfg.get('CERT_SERIAL_NO') or '').strip().upper()
logger.warning(
'[WX_V3_SIGN] club=%s mchid=%s serial=%s key_path=%s',
club_id, mchid, serial_no, cfg.get('PRIVATE_KEY_PATH'),
)
parsed = urlparse(url)
path = parsed.path