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