From 710b0f64802417e60d4e7d1c88c601c935414b41 Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Sun, 5 Mar 2017 22:50:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=94=AF=E4=BB=98=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BB=A3=E7=A0=81=E7=8B=AC=E7=AB=8B=E6=88=90=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E5=AD=90=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WxMpPayServiceImplTest.java | 6 +- .../wxpay/testbase/ApiTestModule.java | 2 +- .../wxpay/testbase/XmlWxPayConfig.java | 62 +++++++++---------- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/WxMpPayServiceImplTest.java b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/WxMpPayServiceImplTest.java index 820101c5..c658d124 100644 --- a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/WxMpPayServiceImplTest.java +++ b/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()); diff --git a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/testbase/ApiTestModule.java b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/testbase/ApiTestModule.java index 0ca02bb6..d5a028d1 100644 --- a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/testbase/ApiTestModule.java +++ b/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); diff --git a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/testbase/XmlWxPayConfig.java b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/testbase/XmlWxPayConfig.java index 227c365d..a10f36f3 100644 --- a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/testbase/XmlWxPayConfig.java +++ b/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; + } +}