Skip to content
Prev Previous commit
Next Next commit
🎨 【微信支付】针对公钥模式:未配置平台证书路径时,不执行加载
  • Loading branch information
SynchPj committed Apr 21, 2025
commit 94d3bffe04099810361d27a60b3bf3c1ff4fb88d
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,13 @@ public CloseableHttpClient initApiV3HttpClient() throws WxPayException {
this.certSerialNo = certificate.getSerialNumber().toString(16).toUpperCase();
}
try {
if (merchantPrivateKey == null) {
if (merchantPrivateKey == null && StringUtils.isNotBlank(this.getPrivateKeyPath())) {
try (InputStream keyInputStream = this.loadConfigInputStream(this.getPrivateKeyString(), this.getPrivateKeyPath(),
this.privateKeyContent, "privateKeyPath")) {
merchantPrivateKey = PemUtils.loadPrivateKey(keyInputStream);
}
}
if (certificate == null && StringUtils.isBlank(this.getCertSerialNo())) {
if (certificate == null && StringUtils.isBlank(this.getCertSerialNo()) && StringUtils.isNotBlank(this.getPrivateCertPath())) {
try (InputStream certInputStream = this.loadConfigInputStream(this.getPrivateCertString(), this.getPrivateCertPath(),
this.privateCertContent, "privateCertPath")) {
certificate = PemUtils.loadCertificate(certInputStream);
Expand Down