Skip to content

Commit 22723f9

Browse files
committed
完善查询退款接口,并重构部分支付接口的实现,简化代码
1 parent a638189 commit 22723f9

10 files changed

Lines changed: 351 additions & 210 deletions

File tree

weixin-java-mp/pom.xml

Lines changed: 73 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,79 @@
11
<?xml version="1.0"?>
22
<project
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
4-
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5-
<modelVersion>4.0.0</modelVersion>
6-
<parent>
7-
<groupId>com.github.binarywang</groupId>
8-
<artifactId>weixin-java-parent</artifactId>
9-
<version>2.4.6.BETA</version>
10-
</parent>
11-
<artifactId>weixin-java-mp</artifactId>
12-
<name>WeiXin Java Tools - MP</name>
13-
<description>微信公众号Java SDK</description>
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>com.github.binarywang</groupId>
8+
<artifactId>weixin-java-parent</artifactId>
9+
<version>2.4.6.BETA</version>
10+
</parent>
11+
<artifactId>weixin-java-mp</artifactId>
12+
<name>WeiXin Java Tools - MP</name>
13+
<description>微信公众号Java SDK</description>
1414

15-
<dependencies>
16-
<dependency>
17-
<groupId>com.github.binarywang</groupId>
18-
<artifactId>weixin-java-common</artifactId>
19-
<version>${project.version}</version>
20-
</dependency>
21-
<dependency>
22-
<groupId>junit</groupId>
23-
<artifactId>junit</artifactId>
24-
<scope>test</scope>
25-
</dependency>
26-
<dependency>
27-
<groupId>org.testng</groupId>
28-
<artifactId>testng</artifactId>
29-
<scope>test</scope>
30-
</dependency>
31-
<dependency>
32-
<groupId>org.mockito</groupId>
33-
<artifactId>mockito-all</artifactId>
34-
<scope>test</scope>
35-
</dependency>
36-
<dependency>
37-
<groupId>com.google.inject</groupId>
38-
<artifactId>guice</artifactId>
39-
<scope>test</scope>
40-
</dependency>
41-
<dependency>
42-
<groupId>org.eclipse.jetty</groupId>
43-
<artifactId>jetty-server</artifactId>
44-
<scope>test</scope>
45-
</dependency>
46-
<dependency>
47-
<groupId>org.eclipse.jetty</groupId>
48-
<artifactId>jetty-servlet</artifactId>
49-
<scope>test</scope>
50-
</dependency>
51-
<dependency>
52-
<groupId>joda-time</groupId>
53-
<artifactId>joda-time</artifactId>
54-
<version>2.9.4</version>
55-
<scope>test</scope>
56-
</dependency>
57-
</dependencies>
15+
<dependencies>
16+
<dependency>
17+
<groupId>com.github.binarywang</groupId>
18+
<artifactId>weixin-java-common</artifactId>
19+
<version>${project.version}</version>
20+
</dependency>
21+
<dependency>
22+
<groupId>junit</groupId>
23+
<artifactId>junit</artifactId>
24+
<scope>test</scope>
25+
</dependency>
26+
<dependency>
27+
<groupId>org.testng</groupId>
28+
<artifactId>testng</artifactId>
29+
<scope>test</scope>
30+
</dependency>
31+
<dependency>
32+
<groupId>org.mockito</groupId>
33+
<artifactId>mockito-all</artifactId>
34+
<scope>test</scope>
35+
</dependency>
36+
<dependency>
37+
<groupId>com.google.inject</groupId>
38+
<artifactId>guice</artifactId>
39+
<scope>test</scope>
40+
</dependency>
41+
<dependency>
42+
<groupId>org.eclipse.jetty</groupId>
43+
<artifactId>jetty-server</artifactId>
44+
<scope>test</scope>
45+
</dependency>
46+
<dependency>
47+
<groupId>org.eclipse.jetty</groupId>
48+
<artifactId>jetty-servlet</artifactId>
49+
<scope>test</scope>
50+
</dependency>
51+
<dependency>
52+
<groupId>joda-time</groupId>
53+
<artifactId>joda-time</artifactId>
54+
<version>2.9.4</version>
55+
<scope>test</scope>
56+
</dependency>
57+
<dependency>
58+
<groupId>io.rest-assured</groupId>
59+
<artifactId>xml-path</artifactId>
60+
<version>3.0.1</version>
61+
</dependency>
5862

59-
<build>
60-
<plugins>
61-
<plugin>
62-
<groupId>org.apache.maven.plugins</groupId>
63-
<artifactId>maven-surefire-plugin</artifactId>
64-
<configuration>
65-
<suiteXmlFiles>
66-
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
67-
</suiteXmlFiles>
68-
</configuration>
69-
</plugin>
70-
</plugins>
71-
</build>
63+
</dependencies>
64+
65+
<build>
66+
<plugins>
67+
<plugin>
68+
<groupId>org.apache.maven.plugins</groupId>
69+
<artifactId>maven-surefire-plugin</artifactId>
70+
<configuration>
71+
<suiteXmlFiles>
72+
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
73+
</suiteXmlFiles>
74+
</configuration>
75+
</plugin>
76+
</plugins>
77+
</build>
7278

7379
</project>

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpInMemoryConfigStorage.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -310,20 +310,25 @@ public void setSslContext(SSLContext context) {
310310
}
311311

312312
@Override
313-
public void setSslContextFilePath(String filePath) throws Exception {
313+
public void setSslContextFilePath(String filePath) {
314314
if (null == partnerId) {
315-
throw new Exception("请先将partnerId进行赋值");
315+
throw new IllegalArgumentException("请设置partnerId的值");
316316
}
317317

318318
File file = new File(filePath);
319319
if (!file.exists()) {
320-
throw new RuntimeException(file.getPath() + ":文件不存在!在设置SSLContext的时候");
320+
throw new RuntimeException("证书文件:【" + file.getPath() + "】不存在!");
321+
}
322+
323+
try {
324+
FileInputStream inputStream = new FileInputStream(file);
325+
KeyStore keystore = KeyStore.getInstance("PKCS12");
326+
char[] partnerId2charArray = partnerId.toCharArray();
327+
keystore.load(inputStream, partnerId2charArray);
328+
this.sslContext = SSLContexts.custom().loadKeyMaterial(keystore, partnerId2charArray).build();
329+
} catch (Exception e) {
330+
throw new RuntimeException("证书文件有问题,请核实!", e);
321331
}
322-
FileInputStream inputStream = new FileInputStream(file);
323-
KeyStore keystore = KeyStore.getInstance("PKCS12");
324-
char[] partnerId2charArray = partnerId.toCharArray();
325-
keystore.load(inputStream, partnerId2charArray);
326-
this.sslContext = SSLContexts.custom().loadKeyMaterial(keystore, partnerId2charArray).build();
327332
}
328333

329334
@Override

0 commit comments

Comments
 (0)