mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-23 22:11:40 +08:00
微信支付相关代码独立成一个子模块
This commit is contained in:
parent
eee954b736
commit
710b0f6480
@ -5,7 +5,7 @@ import com.github.binarywang.wxpay.bean.request.*;
|
|||||||
import com.github.binarywang.wxpay.bean.result.*;
|
import com.github.binarywang.wxpay.bean.result.*;
|
||||||
import com.github.binarywang.wxpay.service.WxPayService;
|
import com.github.binarywang.wxpay.service.WxPayService;
|
||||||
import com.github.binarywang.wxpay.testbase.ApiTestModule;
|
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 com.google.inject.Inject;
|
||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -105,7 +105,7 @@ public class WxMpPayServiceImplTest {
|
|||||||
request.setActName("abc");
|
request.setActName("abc");
|
||||||
request.setClientIp("aaa");
|
request.setClientIp("aaa");
|
||||||
request.setMchBillNo("aaaa");
|
request.setMchBillNo("aaaa");
|
||||||
request.setReOpenid(((TestPayConfig) this.wxService.getConfig()).getOpenid());
|
request.setReOpenid(((XmlWxPayConfig) this.wxService.getConfig()).getOpenid());
|
||||||
WxPaySendRedpackResult redpackResult = this.wxService.sendRedpack(request);
|
WxPaySendRedpackResult redpackResult = this.wxService.sendRedpack(request);
|
||||||
this.logger.info(redpackResult.toString());
|
this.logger.info(redpackResult.toString());
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ public class WxMpPayServiceImplTest {
|
|||||||
.spbillCreateIp("111111")
|
.spbillCreateIp("111111")
|
||||||
.notifyURL("111111")
|
.notifyURL("111111")
|
||||||
.tradeType("JSAPI")
|
.tradeType("JSAPI")
|
||||||
.openid("122")
|
.openid(((XmlWxPayConfig) this.wxService.getConfig()).getOpenid())
|
||||||
.outTradeNo("111111")
|
.outTradeNo("111111")
|
||||||
.build());
|
.build());
|
||||||
this.logger.info(result.toString());
|
this.logger.info(result.toString());
|
||||||
|
@ -16,7 +16,7 @@ public class ApiTestModule implements Module {
|
|||||||
@Override
|
@Override
|
||||||
public void configure(Binder binder) {
|
public void configure(Binder binder) {
|
||||||
try (InputStream is1 = ClassLoader.getSystemResourceAsStream("test-config.xml")) {
|
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();
|
WxPayService wxService = new WxPayServiceImpl();
|
||||||
wxService.setConfig(config);
|
wxService.setConfig(config);
|
||||||
|
|
||||||
|
@ -1,31 +1,31 @@
|
|||||||
package com.github.binarywang.wxpay.testbase;
|
package com.github.binarywang.wxpay.testbase;
|
||||||
|
|
||||||
import com.github.binarywang.wxpay.config.WxPayConfig;
|
import com.github.binarywang.wxpay.config.WxPayConfig;
|
||||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.http.ssl.SSLContexts;
|
import org.apache.http.ssl.SSLContexts;
|
||||||
|
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.security.KeyStore;
|
import java.security.KeyStore;
|
||||||
|
|
||||||
@XStreamAlias("xml")
|
@XStreamAlias("xml")
|
||||||
public class TestPayConfig extends WxPayConfig {
|
public class XmlWxPayConfig extends WxPayConfig {
|
||||||
private String openid;
|
private String openid;
|
||||||
|
|
||||||
public String getOpenid() {
|
public String getOpenid() {
|
||||||
return openid;
|
return openid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOpenid(String openid) {
|
public void setOpenid(String openid) {
|
||||||
this.openid = openid;
|
this.openid = openid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean useSandboxForWxPay() {
|
public boolean useSandboxForWxPay() {
|
||||||
//沙箱环境不成熟,有问题无法使用,暂时屏蔽掉
|
//沙箱环境不成熟,有问题无法使用,暂时屏蔽掉
|
||||||
// return true;
|
// return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user