Skip to content

Commit 710b0f6

Browse files
committed
微信支付相关代码独立成一个子模块
1 parent eee954b commit 710b0f6

File tree

3 files changed

+35
-35
lines changed

3 files changed

+35
-35
lines changed

weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/WxMpPayServiceImplTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.github.binarywang.wxpay.bean.result.*;
66
import com.github.binarywang.wxpay.service.WxPayService;
77
import com.github.binarywang.wxpay.testbase.ApiTestModule;
8-
import com.github.binarywang.wxpay.testbase.TestPayConfig;
8+
import com.github.binarywang.wxpay.testbase.XmlWxPayConfig;
99
import com.google.inject.Inject;
1010
import me.chanjar.weixin.common.exception.WxErrorException;
1111
import org.slf4j.Logger;
@@ -105,7 +105,7 @@ public void testSendRedpack() throws Exception {
105105
request.setActName("abc");
106106
request.setClientIp("aaa");
107107
request.setMchBillNo("aaaa");
108-
request.setReOpenid(((TestPayConfig) this.wxService.getConfig()).getOpenid());
108+
request.setReOpenid(((XmlWxPayConfig) this.wxService.getConfig()).getOpenid());
109109
WxPaySendRedpackResult redpackResult = this.wxService.sendRedpack(request);
110110
this.logger.info(redpackResult.toString());
111111
}
@@ -131,7 +131,7 @@ public void testUnifiedOrder() throws WxErrorException {
131131
.spbillCreateIp("111111")
132132
.notifyURL("111111")
133133
.tradeType("JSAPI")
134-
.openid("122")
134+
.openid(((XmlWxPayConfig) this.wxService.getConfig()).getOpenid())
135135
.outTradeNo("111111")
136136
.build());
137137
this.logger.info(result.toString());

weixin-java-pay/src/test/java/com/github/binarywang/wxpay/testbase/ApiTestModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class ApiTestModule implements Module {
1616
@Override
1717
public void configure(Binder binder) {
1818
try (InputStream is1 = ClassLoader.getSystemResourceAsStream("test-config.xml")) {
19-
TestPayConfig config = this.fromXml(TestPayConfig.class, is1);
19+
XmlWxPayConfig config = this.fromXml(XmlWxPayConfig.class, is1);
2020
WxPayService wxService = new WxPayServiceImpl();
2121
wxService.setConfig(config);
2222

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
package com.github.binarywang.wxpay.testbase;
2-
3-
import com.github.binarywang.wxpay.config.WxPayConfig;
4-
import com.thoughtworks.xstream.annotations.XStreamAlias;
5-
import org.apache.commons.lang3.builder.ToStringBuilder;
6-
import org.apache.http.ssl.SSLContexts;
7-
8-
import javax.net.ssl.SSLContext;
9-
import java.io.File;
10-
import java.io.FileInputStream;
11-
import java.security.KeyStore;
12-
13-
@XStreamAlias("xml")
14-
public class TestPayConfig extends WxPayConfig {
15-
private String openid;
16-
17-
public String getOpenid() {
18-
return openid;
19-
}
20-
21-
public void setOpenid(String openid) {
22-
this.openid = openid;
23-
}
24-
25-
@Override
26-
public boolean useSandboxForWxPay() {
27-
//沙箱环境不成熟,有问题无法使用,暂时屏蔽掉
28-
// return true;
29-
return false;
30-
}
31-
}
1+
package com.github.binarywang.wxpay.testbase;
2+
3+
import com.github.binarywang.wxpay.config.WxPayConfig;
4+
import com.thoughtworks.xstream.annotations.XStreamAlias;
5+
import org.apache.commons.lang3.builder.ToStringBuilder;
6+
import org.apache.http.ssl.SSLContexts;
7+
8+
import javax.net.ssl.SSLContext;
9+
import java.io.File;
10+
import java.io.FileInputStream;
11+
import java.security.KeyStore;
12+
13+
@XStreamAlias("xml")
14+
public class XmlWxPayConfig extends WxPayConfig {
15+
private String openid;
16+
17+
public String getOpenid() {
18+
return openid;
19+
}
20+
21+
public void setOpenid(String openid) {
22+
this.openid = openid;
23+
}
24+
25+
@Override
26+
public boolean useSandboxForWxPay() {
27+
//沙箱环境不成熟,有问题无法使用,暂时屏蔽掉
28+
// return true;
29+
return false;
30+
}
31+
}

0 commit comments

Comments
 (0)