fix: 微信支付问题修复,代码提交。
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -48,4 +48,14 @@ public class WxPayProperties {
|
||||
* 私钥内容
|
||||
*/
|
||||
private String privateContent;
|
||||
|
||||
/**
|
||||
* 商户证书路径(apiclient_cert.pem)
|
||||
*/
|
||||
private String privateCertPath;
|
||||
|
||||
/**
|
||||
* 商户证书内容(与privateCertPath二选一)
|
||||
*/
|
||||
private String privateCertContent;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user