Skip to content

Commit bd379e8

Browse files
author
SynchPj
committed
🎨 【微信支付】针对公钥模式:未配置平台证书路径时,不执行加载
1 parent dfc685e commit bd379e8

File tree

1 file changed

+2
-2
lines changed
  • weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config

1 file changed

+2
-2
lines changed

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,13 @@ public CloseableHttpClient initApiV3HttpClient() throws WxPayException {
295295
this.certSerialNo = certificate.getSerialNumber().toString(16).toUpperCase();
296296
}
297297
try {
298-
if (merchantPrivateKey == null) {
298+
if (merchantPrivateKey == null && StringUtils.isNotBlank(this.getPrivateKeyPath())) {
299299
try (InputStream keyInputStream = this.loadConfigInputStream(this.getPrivateKeyString(), this.getPrivateKeyPath(),
300300
this.privateKeyContent, "privateKeyPath")) {
301301
merchantPrivateKey = PemUtils.loadPrivateKey(keyInputStream);
302302
}
303303
}
304-
if (certificate == null && StringUtils.isBlank(this.getCertSerialNo())) {
304+
if (certificate == null && StringUtils.isBlank(this.getCertSerialNo()) && StringUtils.isNotBlank(this.getPrivateCertPath())) {
305305
try (InputStream certInputStream = this.loadConfigInputStream(this.getPrivateCertString(), this.getPrivateCertPath(),
306306
this.privateCertContent, "privateCertPath")) {
307307
certificate = PemUtils.loadCertificate(certInputStream);

0 commit comments

Comments
 (0)