fix: 微信支付问题修复,代码提交。

This commit is contained in:
tianyongbao
2026-03-09 07:43:39 +08:00
parent aa213e4d8d
commit 0f968d5e9f
3 changed files with 21 additions and 0 deletions

View File

@@ -59,6 +59,15 @@ public class WxPayConfiguration {
log.info("使用私钥路径配置: {}", wxPayProperties.getPrivateKeyPath());
}
// 商户证书配置V3 API必须apiclient_cert.pem
if (wxPayProperties.getPrivateCertContent() != null && !wxPayProperties.getPrivateCertContent().isEmpty()) {
payConfig.setPrivateCertContent(wxPayProperties.getPrivateCertContent().getBytes(java.nio.charset.StandardCharsets.UTF_8));
log.info("使用商户证书内容配置");
} else if (wxPayProperties.getPrivateCertPath() != null) {
payConfig.setPrivateCertPath(wxPayProperties.getPrivateCertPath());
log.info("使用商户证书路径配置: {}", wxPayProperties.getPrivateCertPath());
}
WxPayService wxPayService = new WxPayServiceImpl();
wxPayService.setConfig(payConfig);

View File

@@ -48,4 +48,14 @@ public class WxPayProperties {
* 私钥内容
*/
private String privateContent;
/**
* 商户证书路径apiclient_cert.pem
*/
private String privateCertPath;
/**
* 商户证书内容与privateCertPath二选一
*/
private String privateCertContent;
}