1
This commit is contained in:
@@ -376,16 +376,14 @@ def _get_wechat_client(
|
||||
return None
|
||||
|
||||
try:
|
||||
# 处理私钥格式,确保是正确的 PEM 格式
|
||||
private_key_str = private_key.strip()
|
||||
if not private_key_str.startswith("-----BEGIN"):
|
||||
private_key_str = "-----BEGIN PRIVATE KEY-----\n" + private_key_str + "\n-----END PRIVATE KEY-----"
|
||||
# 直接传入原始私钥,让 SDK 自己处理格式化
|
||||
# SDK 内部已有 format_private_key 函数处理各种格式
|
||||
|
||||
# 初始化微信支付客户端
|
||||
_wechat_client = WeChatPay(
|
||||
wechatpay_type=WeChatPayType.NATIVE,
|
||||
mchid=mch_id,
|
||||
private_key=private_key_str,
|
||||
private_key=private_key.strip(),
|
||||
cert_serial_no=cert_serial_no,
|
||||
appid=appid,
|
||||
apiv3_key=api_v3_key,
|
||||
|
||||
Reference in New Issue
Block a user