Skip to content

Commit 69ca699

Browse files
committed
加强检查支付配置
1 parent 4cf3f5c commit 69ca699

File tree

1 file changed

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

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.github.binarywang.wxpay.config;
22

3+
import org.apache.commons.lang3.StringUtils;
34
import org.apache.http.ssl.SSLContexts;
45

56
import javax.net.ssl.SSLContext;
@@ -143,13 +144,17 @@ public void setUseSandboxEnv(boolean useSandboxEnv) {
143144
}
144145

145146
public SSLContext initSSLContext() {
146-
if (null == mchId) {
147-
throw new IllegalArgumentException("请确保商户号mch_id已设置");
147+
if (StringUtils.isBlank(mchId)) {
148+
throw new IllegalArgumentException("请确保商户号mchId已设置");
149+
}
150+
151+
if (StringUtils.isBlank(this.keyPath)) {
152+
throw new IllegalArgumentException("请确保证书文件地址keyPath已配置");
148153
}
149154

150155
File file = new File(this.keyPath);
151156
if (!file.exists()) {
152-
throw new RuntimeException("证书文件【" + file.getPath() + "】不存在!");
157+
throw new RuntimeException("证书文件【" + file.getPath() + "】不存在!");
153158
}
154159

155160
try {

0 commit comments

Comments
 (0)