瀏覽代碼

微信支付相关代码独立成一个子模块

master
Binary Wang 8 年之前
父節點
當前提交
710b0f6480
共有 3 個檔案被更改,包括 35 行新增35 行删除
  1. +3
    -3
      weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/WxMpPayServiceImplTest.java
  2. +1
    -1
      weixin-java-pay/src/test/java/com/github/binarywang/wxpay/testbase/ApiTestModule.java
  3. +31
    -31
      weixin-java-pay/src/test/java/com/github/binarywang/wxpay/testbase/XmlWxPayConfig.java

+ 3
- 3
weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/WxMpPayServiceImplTest.java 查看文件

@@ -5,7 +5,7 @@ import com.github.binarywang.wxpay.bean.request.*;
import com.github.binarywang.wxpay.bean.result.*;
import com.github.binarywang.wxpay.service.WxPayService;
import com.github.binarywang.wxpay.testbase.ApiTestModule;
import com.github.binarywang.wxpay.testbase.TestPayConfig;
import com.github.binarywang.wxpay.testbase.XmlWxPayConfig;
import com.google.inject.Inject;
import me.chanjar.weixin.common.exception.WxErrorException;
import org.slf4j.Logger;
@@ -105,7 +105,7 @@ public class WxMpPayServiceImplTest {
request.setActName("abc");
request.setClientIp("aaa");
request.setMchBillNo("aaaa");
request.setReOpenid(((TestPayConfig) this.wxService.getConfig()).getOpenid());
request.setReOpenid(((XmlWxPayConfig) this.wxService.getConfig()).getOpenid());
WxPaySendRedpackResult redpackResult = this.wxService.sendRedpack(request);
this.logger.info(redpackResult.toString());
}
@@ -131,7 +131,7 @@ public class WxMpPayServiceImplTest {
.spbillCreateIp("111111")
.notifyURL("111111")
.tradeType("JSAPI")
.openid("122")
.openid(((XmlWxPayConfig) this.wxService.getConfig()).getOpenid())
.outTradeNo("111111")
.build());
this.logger.info(result.toString());


+ 1
- 1
weixin-java-pay/src/test/java/com/github/binarywang/wxpay/testbase/ApiTestModule.java 查看文件

@@ -16,7 +16,7 @@ public class ApiTestModule implements Module {
@Override
public void configure(Binder binder) {
try (InputStream is1 = ClassLoader.getSystemResourceAsStream("test-config.xml")) {
TestPayConfig config = this.fromXml(TestPayConfig.class, is1);
XmlWxPayConfig config = this.fromXml(XmlWxPayConfig.class, is1);
WxPayService wxService = new WxPayServiceImpl();
wxService.setConfig(config);



+ 31
- 31
weixin-java-pay/src/test/java/com/github/binarywang/wxpay/testbase/XmlWxPayConfig.java 查看文件

@@ -1,31 +1,31 @@
package com.github.binarywang.wxpay.testbase;
import com.github.binarywang.wxpay.config.WxPayConfig;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.http.ssl.SSLContexts;
import javax.net.ssl.SSLContext;
import java.io.File;
import java.io.FileInputStream;
import java.security.KeyStore;
@XStreamAlias("xml")
public class TestPayConfig extends WxPayConfig {
private String openid;
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
@Override
public boolean useSandboxForWxPay() {
//沙箱环境不成熟,有问题无法使用,暂时屏蔽掉
// return true;
return false;
}
}
package com.github.binarywang.wxpay.testbase;
import com.github.binarywang.wxpay.config.WxPayConfig;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.http.ssl.SSLContexts;
import javax.net.ssl.SSLContext;
import java.io.File;
import java.io.FileInputStream;
import java.security.KeyStore;
@XStreamAlias("xml")
public class XmlWxPayConfig extends WxPayConfig {
private String openid;
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
@Override
public boolean useSandboxForWxPay() {
//沙箱环境不成熟,有问题无法使用,暂时屏蔽掉
// return true;
return false;
}
}

Loading…
取消
儲存