From 48d3163b33a1d6dde5fa1ac730798b857ae63fae Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Sat, 27 Jan 2018 18:39:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=83=A8=E5=88=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ractImpl.java => WxMpServiceBaseImpl.java} | 32 ++-- ...pl.java => WxMpServiceHttpClientImpl.java} | 4 +- .../weixin/mp/api/impl/WxMpServiceImpl.java | 2 +- .../mp/api/impl/WxMpServiceJoddHttpImpl.java | 2 +- .../mp/api/impl/WxMpServiceOkHttpImpl.java | 5 +- .../weixin/mp/api/WxMpBusyRetryTest.java | 4 +- .../weixin/mp/demo/WxMpDemoServer.java | 4 +- .../wxpay/bean/entpay/EntPayRequest.java | 24 +-- .../bean/request/WxEntPayQueryRequest.java | 15 -- .../wxpay/bean/request/WxEntPayRequest.java | 149 ------------------ .../wxpay/service/WxPayService.java | 13 -- .../service/impl/BaseWxPayServiceImpl.java | 12 -- .../service/impl/EntPayServiceImplTest.java | 31 +--- 13 files changed, 50 insertions(+), 247 deletions(-) rename weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/{WxMpServiceAbstractImpl.java => WxMpServiceBaseImpl.java} (94%) rename weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/{WxMpServiceApacheHttpClientImpl.java => WxMpServiceHttpClientImpl.java} (96%) delete mode 100644 weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxEntPayQueryRequest.java delete mode 100644 weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxEntPayRequest.java diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceAbstractImpl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceBaseImpl.java similarity index 94% rename from weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceAbstractImpl.java rename to weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceBaseImpl.java index a09d8cc4..0800f0a9 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceAbstractImpl.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceBaseImpl.java @@ -13,8 +13,11 @@ import me.chanjar.weixin.common.util.RandomUtils; import me.chanjar.weixin.common.util.crypto.SHA1; import me.chanjar.weixin.common.util.http.*; import me.chanjar.weixin.mp.api.*; -import me.chanjar.weixin.mp.bean.*; -import me.chanjar.weixin.mp.bean.result.*; +import me.chanjar.weixin.mp.bean.WxMpSemanticQuery; +import me.chanjar.weixin.mp.bean.result.WxMpCurrentAutoReplyInfo; +import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken; +import me.chanjar.weixin.mp.bean.result.WxMpSemanticQueryResult; +import me.chanjar.weixin.mp.bean.result.WxMpUser; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -22,7 +25,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.concurrent.locks.Lock; -public abstract class WxMpServiceAbstractImpl implements WxMpService, RequestHttp { +public abstract class WxMpServiceBaseImpl implements WxMpService, RequestHttp { private static final JsonParser JSON_PARSER = new JsonParser(); @@ -92,14 +95,14 @@ public abstract class WxMpServiceAbstractImpl implements WxMpService, Requ @Override public WxJsapiSignature createJsapiSignature(String url) throws WxErrorException { long timestamp = System.currentTimeMillis() / 1000; - String noncestr = RandomUtils.getRandomStr(); + String randomStr = RandomUtils.getRandomStr(); String jsapiTicket = getJsapiTicket(false); String signature = SHA1.genWithAmple("jsapi_ticket=" + jsapiTicket, - "noncestr=" + noncestr, "timestamp=" + timestamp, "url=" + url); + "noncestr=" + randomStr, "timestamp=" + timestamp, "url=" + url); WxJsapiSignature jsapiSignature = new WxJsapiSignature(); jsapiSignature.setAppId(this.getWxMpConfigStorage().getAppId()); jsapiSignature.setTimestamp(timestamp); - jsapiSignature.setNonceStr(noncestr); + jsapiSignature.setNonceStr(randomStr); jsapiSignature.setUrl(url); jsapiSignature.setSignature(signature); return jsapiSignature; @@ -111,10 +114,10 @@ public abstract class WxMpServiceAbstractImpl implements WxMpService, Requ } @Override - public String shortUrl(String long_url) throws WxErrorException { + public String shortUrl(String longUrl) throws WxErrorException { JsonObject o = new JsonObject(); o.addProperty("action", "long2short"); - o.addProperty("long_url", long_url); + o.addProperty("long_url", longUrl); String responseContent = this.post(WxMpService.SHORTURL_API_URL, o.toString()); JsonElement tmpJsonElement = JSON_PARSER.parse(responseContent); return tmpJsonElement.getAsJsonObject().get("short_url").getAsString(); @@ -161,12 +164,12 @@ public abstract class WxMpServiceAbstractImpl implements WxMpService, Requ } @Override - public WxMpUser oauth2getUserInfo(WxMpOAuth2AccessToken oAuth2AccessToken, String lang) throws WxErrorException { + public WxMpUser oauth2getUserInfo(WxMpOAuth2AccessToken token, String lang) throws WxErrorException { if (lang == null) { lang = "zh_CN"; } - String url = String.format(WxMpService.OAUTH2_USERINFO_URL, oAuth2AccessToken.getAccessToken(), oAuth2AccessToken.getOpenId(), lang); + String url = String.format(WxMpService.OAUTH2_USERINFO_URL, token.getAccessToken(), token.getOpenId(), lang); try { RequestExecutor executor = SimpleGetRequestExecutor.create(this); @@ -178,8 +181,8 @@ public abstract class WxMpServiceAbstractImpl implements WxMpService, Requ } @Override - public boolean oauth2validateAccessToken(WxMpOAuth2AccessToken oAuth2AccessToken) { - String url = String.format(WxMpService.OAUTH2_VALIDATE_TOKEN_URL, oAuth2AccessToken.getAccessToken(), oAuth2AccessToken.getOpenId()); + public boolean oauth2validateAccessToken(WxMpOAuth2AccessToken token) { + String url = String.format(WxMpService.OAUTH2_VALIDATE_TOKEN_URL, token.getAccessToken(), token.getOpenId()); try { SimpleGetRequestExecutor.create(this).execute(url, null); @@ -226,7 +229,7 @@ public abstract class WxMpServiceAbstractImpl implements WxMpService, Requ } /** - * 向微信端发送请求,在这里执行的策略是当发生access_token过期时才去刷新,然后重新执行请求,而不是全局定时请求 + * 向微信端发送请求,在这里执行的策略是当发生access_token过期时才去刷新,然后重新执行请求,而不是全局定时请求. */ @Override public T execute(RequestExecutor executor, String uri, E data) throws WxErrorException { @@ -265,6 +268,7 @@ public abstract class WxMpServiceAbstractImpl implements WxMpService, Requ if (uri.contains("access_token=")) { throw new IllegalArgumentException("uri参数中不允许有access_token: " + uri); } + String accessToken = getAccessToken(false); String uriWithAccessToken = uri + (uri.contains("?") ? "&" : "?") + "access_token=" + accessToken; @@ -296,7 +300,7 @@ public abstract class WxMpServiceAbstractImpl implements WxMpService, Requ return null; } catch (IOException e) { this.log.error("\n【请求地址】: {}\n【请求参数】:{}\n【异常信息】:{}", uriWithAccessToken, data, e.getMessage()); - throw new RuntimeException(e); + throw new WxErrorException(WxError.builder().errorMsg(e.getMessage()).build(), e); } } diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceApacheHttpClientImpl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceHttpClientImpl.java similarity index 96% rename from weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceApacheHttpClientImpl.java rename to weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceHttpClientImpl.java index dd8aaf61..9a357ba5 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceApacheHttpClientImpl.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceHttpClientImpl.java @@ -19,9 +19,9 @@ import java.io.IOException; import java.util.concurrent.locks.Lock; /** - * apache-http方式实现 + * apache http client方式实现. */ -public class WxMpServiceApacheHttpClientImpl extends WxMpServiceAbstractImpl { +public class WxMpServiceHttpClientImpl extends WxMpServiceBaseImpl { private CloseableHttpClient httpClient; private HttpHost httpProxy; diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceImpl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceImpl.java index 79317f99..79c3fad2 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceImpl.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceImpl.java @@ -8,5 +8,5 @@ package me.chanjar.weixin.mp.api.impl; * * @author Binary Wang */ -public class WxMpServiceImpl extends WxMpServiceApacheHttpClientImpl { +public class WxMpServiceImpl extends WxMpServiceHttpClientImpl { } diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceJoddHttpImpl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceJoddHttpImpl.java index f146c365..fc4976be 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceJoddHttpImpl.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceJoddHttpImpl.java @@ -14,7 +14,7 @@ import java.util.concurrent.locks.Lock; /** * jodd-http方式实现 */ -public class WxMpServiceJoddHttpImpl extends WxMpServiceAbstractImpl { +public class WxMpServiceJoddHttpImpl extends WxMpServiceBaseImpl { private HttpConnectionProvider httpClient; private ProxyInfo httpProxy; diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceOkHttpImpl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceOkHttpImpl.java index b5135ceb..e0999241 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceOkHttpImpl.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpServiceOkHttpImpl.java @@ -11,7 +11,10 @@ import okhttp3.*; import java.io.IOException; import java.util.concurrent.locks.Lock; -public class WxMpServiceOkHttpImpl extends WxMpServiceAbstractImpl { +/** + * okhttp实现 + */ +public class WxMpServiceOkHttpImpl extends WxMpServiceBaseImpl { private OkHttpClient httpClient; private OkHttpProxyInfo httpProxy; diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpBusyRetryTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpBusyRetryTest.java index e8630dbc..2a07e3b9 100644 --- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpBusyRetryTest.java +++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpBusyRetryTest.java @@ -3,7 +3,7 @@ package me.chanjar.weixin.mp.api; import me.chanjar.weixin.common.bean.result.WxError; import me.chanjar.weixin.common.exception.WxErrorException; import me.chanjar.weixin.common.util.http.RequestExecutor; -import me.chanjar.weixin.mp.api.impl.WxMpServiceApacheHttpClientImpl; +import me.chanjar.weixin.mp.api.impl.WxMpServiceHttpClientImpl; import org.testng.annotations.*; import java.util.concurrent.ExecutionException; @@ -16,7 +16,7 @@ public class WxMpBusyRetryTest { @DataProvider(name = "getService") public Object[][] getService() { - WxMpService service = new WxMpServiceApacheHttpClientImpl() { + WxMpService service = new WxMpServiceHttpClientImpl() { @Override public synchronized T executeInternal( diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/WxMpDemoServer.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/WxMpDemoServer.java index 2f5f25ee..d2f4fde8 100644 --- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/WxMpDemoServer.java +++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/WxMpDemoServer.java @@ -5,7 +5,7 @@ import me.chanjar.weixin.mp.api.WxMpConfigStorage; import me.chanjar.weixin.mp.api.WxMpMessageHandler; import me.chanjar.weixin.mp.api.WxMpMessageRouter; import me.chanjar.weixin.mp.api.WxMpService; -import me.chanjar.weixin.mp.api.impl.WxMpServiceApacheHttpClientImpl; +import me.chanjar.weixin.mp.api.impl.WxMpServiceHttpClientImpl; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; @@ -47,7 +47,7 @@ public class WxMpDemoServer { .fromXml(is1); wxMpConfigStorage = config; - wxMpService = new WxMpServiceApacheHttpClientImpl(); + wxMpService = new WxMpServiceHttpClientImpl(); wxMpService.setWxMpConfigStorage(config); WxMpMessageHandler logHandler = new DemoLogHandler(); diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/entpay/EntPayRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/entpay/EntPayRequest.java index d9b76892..1ff25e78 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/entpay/EntPayRequest.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/entpay/EntPayRequest.java @@ -24,7 +24,7 @@ import me.chanjar.weixin.common.util.ToStringUtils; public class EntPayRequest extends BaseWxPayRequest { /** *
-   * 字段名:公众账号appid
+   * 字段名:公众账号appid.
    * 变量名:mch_appid
    * 是否必填:是
    * 示例值:wx8888888888888888
@@ -37,7 +37,7 @@ public class EntPayRequest extends BaseWxPayRequest {
 
   /**
    * 
-   * 字段名:商户号
+   * 字段名:商户号.
    * 变量名:mchid
    * 是否必填:是
    * 示例值:1900000109
@@ -50,7 +50,7 @@ public class EntPayRequest extends BaseWxPayRequest {
 
   /**
    * 
-   * 字段名:设备号
+   * 字段名:设备号.
    * 变量名:device_info
    * 是否必填:否
    * 示例值:13467007045764
@@ -63,7 +63,7 @@ public class EntPayRequest extends BaseWxPayRequest {
 
   /**
    * 
-   * 字段名:商户订单号
+   * 字段名:商户订单号.
    * 变量名:partner_trade_no
    * 是否必填:是
    * 示例值:10000098201411111234567890
@@ -77,7 +77,7 @@ public class EntPayRequest extends BaseWxPayRequest {
 
   /**
    * 
-   * 字段名:需保持唯一性 用户openid
+   * 字段名:需保持唯一性 用户openid.
    * 变量名:openid
    * 是否必填:是
    * 示例值:oxTWIuGaIt6gTKsQRLau2M0yL16E
@@ -91,7 +91,7 @@ public class EntPayRequest extends BaseWxPayRequest {
 
   /**
    * 
-   * 字段名:校验用户姓名选项
+   * 字段名:校验用户姓名选项.
    * 变量名:check_name
    * 是否必填:是
    * 示例值:OPTION_CHECK
@@ -107,7 +107,7 @@ public class EntPayRequest extends BaseWxPayRequest {
 
   /**
    * 
-   * 字段名:收款用户姓名
+   * 字段名:收款用户姓名.
    * 变量名:re_user_name
    * 是否必填:可选
    * 示例值:马花花
@@ -121,7 +121,7 @@ public class EntPayRequest extends BaseWxPayRequest {
 
   /**
    * 
-   * 字段名:金额
+   * 字段名:金额.
    * 变量名:amount
    * 是否必填:是
    * 示例值:10099
@@ -135,7 +135,7 @@ public class EntPayRequest extends BaseWxPayRequest {
 
   /**
    * 
-   * 字段名:企业付款描述信息
+   * 字段名:企业付款描述信息.
    * 变量名:desc
    * 是否必填:是
    * 示例值:理赔
@@ -149,7 +149,7 @@ public class EntPayRequest extends BaseWxPayRequest {
 
   /**
    * 
-   * 字段名:Ip地址
+   * 字段名:Ip地址.
    * 变量名:spbill_create_ip
    * 是否必填:是
    * 示例值:192.168.0.1
@@ -191,4 +191,8 @@ public class EntPayRequest extends BaseWxPayRequest {
     return ToStringUtils.toSimpleString(this);
   }
 
+  @Override
+  protected boolean ignoreSignType() {
+    return true;
+  }
 }
diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxEntPayQueryRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxEntPayQueryRequest.java
deleted file mode 100644
index 9e5d62f6..00000000
--- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxEntPayQueryRequest.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.github.binarywang.wxpay.bean.request;
-
-import com.github.binarywang.wxpay.bean.entpay.EntPayQueryRequest;
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-import lombok.*;
-import me.chanjar.weixin.common.annotation.Required;
-import me.chanjar.weixin.common.util.ToStringUtils;
-
-/**
- * 请使用 {@link EntPayQueryRequest}
- */
-@XStreamAlias("xml")
-@Deprecated
-public class WxEntPayQueryRequest extends EntPayQueryRequest {
-}
diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxEntPayRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxEntPayRequest.java
deleted file mode 100644
index a9e0d65d..00000000
--- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxEntPayRequest.java
+++ /dev/null
@@ -1,149 +0,0 @@
-package com.github.binarywang.wxpay.bean.request;
-
-import com.github.binarywang.wxpay.bean.entpay.EntPayQueryRequest;
-import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-import lombok.*;
-import me.chanjar.weixin.common.annotation.Required;
-import me.chanjar.weixin.common.util.ToStringUtils;
-
-/**
- * 
- * 企业付款请求对象
- * 请使用 {@link EntPayRequest}
- * 
- */ -@XStreamAlias("xml") -@Deprecated -public class WxEntPayRequest extends EntPayRequest { - - private WxEntPayRequest(Builder builder) { - setAppid(builder.appid); - setMchId(builder.mchId); - setSubAppId(builder.subAppId); - setSubMchId(builder.subMchId); - setNonceStr(builder.nonceStr); - setSign(builder.sign); - setSignType(builder.signType); - setMchAppid(builder.mchAppid); - setMchId(builder.mchId); - setDeviceInfo(builder.deviceInfo); - setPartnerTradeNo(builder.partnerTradeNo); - setOpenid(builder.openid); - setCheckName(builder.checkName); - setReUserName(builder.reUserName); - setAmount(builder.amount); - setDescription(builder.description); - setSpbillCreateIp(builder.spbillCreateIp); - } - - public static Builder builder() { - return new Builder(); - } - - public static final class Builder { - private String appid; - private String mchId; - private String deviceInfo; - private String partnerTradeNo; - private String openid; - private String checkName; - private String reUserName; - private Integer amount; - private String description; - private String spbillCreateIp; - private String subAppId; - private String subMchId; - private String nonceStr; - private String sign; - private String signType; - private String mchAppid; - - private Builder() { - } - - public Builder appid(String appid) { - this.appid = appid; - return this; - } - - public Builder mchId(String mchId) { - this.mchId = mchId; - return this; - } - - public Builder deviceInfo(String deviceInfo) { - this.deviceInfo = deviceInfo; - return this; - } - - public Builder partnerTradeNo(String partnerTradeNo) { - this.partnerTradeNo = partnerTradeNo; - return this; - } - - public Builder openid(String openid) { - this.openid = openid; - return this; - } - - public Builder checkName(String checkName) { - this.checkName = checkName; - return this; - } - - public Builder reUserName(String reUserName) { - this.reUserName = reUserName; - return this; - } - - public Builder amount(Integer amount) { - this.amount = amount; - return this; - } - - public Builder description(String description) { - this.description = description; - return this; - } - - public Builder spbillCreateIp(String spbillCreateIp) { - this.spbillCreateIp = spbillCreateIp; - return this; - } - - public WxEntPayRequest build() { - return new WxEntPayRequest(this); - } - - public Builder subAppId(String subAppId) { - this.subAppId = subAppId; - return this; - } - - public Builder subMchId(String subMchId) { - this.subMchId = subMchId; - return this; - } - - public Builder nonceStr(String nonceStr) { - this.nonceStr = nonceStr; - return this; - } - - public Builder sign(String sign) { - this.sign = sign; - return this; - } - - public Builder signType(String signType) { - this.signType = signType; - return this; - } - - public Builder mchAppid(String mchAppid) { - this.mchAppid = mchAppid; - return this; - } - } -} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java index a653612e..6fefed73 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java @@ -2,7 +2,6 @@ package com.github.binarywang.wxpay.service; import com.github.binarywang.wxpay.bean.WxPayApiData; import com.github.binarywang.wxpay.bean.coupon.*; -import com.github.binarywang.wxpay.bean.entpay.EntPayRequest; import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult; import com.github.binarywang.wxpay.bean.request.*; @@ -208,18 +207,6 @@ public interface WxPayService { */ WxPayRedpackQueryResult queryRedpack(String mchBillNo) throws WxPayException; - /** - * 请使用this.getEntPayService().entPay()方法{@link EntPayService#entPay(EntPayRequest)} - */ - @Deprecated - WxEntPayResult entPay(WxEntPayRequest request) throws WxPayException; - - /** - * 请使用this.getEntPayService().queryEntPay()方法 {@link EntPayService#queryEntPay(String)} - */ - @Deprecated - WxEntPayQueryResult queryEntPay(String partnerTradeNo) throws WxPayException; - /** *
    * 扫码支付模式一生成二维码的方法
diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java
index c4343f5a..6c36f957 100644
--- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java
+++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java
@@ -345,18 +345,6 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
     return payInfo;
   }
 
-  @Override
-  @Deprecated
-  public WxEntPayResult entPay(WxEntPayRequest request) throws WxPayException {
-    return WxEntPayResult.createFrom(this.getEntPayService().entPay(request));
-  }
-
-  @Override
-  @Deprecated
-  public WxEntPayQueryResult queryEntPay(String partnerTradeNo) throws WxPayException {
-    return WxEntPayQueryResult.createFrom(this.getEntPayService().queryEntPay(partnerTradeNo));
-  }
-
   @Override
   public byte[] createScanPayQrcodeMode1(String productId, File logoFile, Integer sideLength) {
     String content = this.createScanPayQrcodeMode1(productId);
diff --git a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/EntPayServiceImplTest.java b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/EntPayServiceImplTest.java
index 417bf276..b0d34a60 100644
--- a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/EntPayServiceImplTest.java
+++ b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/EntPayServiceImplTest.java
@@ -1,18 +1,16 @@
 package com.github.binarywang.wxpay.service.impl;
 
-import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
 import com.github.binarywang.wxpay.bean.entpay.EntPayBankRequest;
 import com.github.binarywang.wxpay.bean.entpay.EntPayBankResult;
-import com.github.binarywang.wxpay.bean.request.WxEntPayRequest;
-import com.github.binarywang.wxpay.constant.WxPayConstants;
+import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
+import com.github.binarywang.wxpay.constant.WxPayConstants.CheckNameOption;
 import com.github.binarywang.wxpay.exception.WxPayException;
 import com.github.binarywang.wxpay.service.WxPayService;
 import com.github.binarywang.wxpay.testbase.ApiTestModule;
 import com.google.inject.Inject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.testng.annotations.Guice;
-import org.testng.annotations.Test;
+import org.testng.annotations.*;
 
 /**
  * 
@@ -30,37 +28,20 @@ public class EntPayServiceImplTest {
   @Inject
   private WxPayService payService;
 
-  @Test
-  public void testEntPay_old() throws WxPayException {
-    this.logger.info(this.payService.entPay(WxEntPayRequest.builder()
-      .partnerTradeNo("Eb6Aep7uVTdbkJqrP4")
-      .openid("ojOQA0y9o-Eb6Aep7uVTdbkJqrP4")
-      .amount(1)
-      .spbillCreateIp("10.10.10.10")
-      .checkName(WxPayConstants.CheckNameOption.NO_CHECK)
-      .description("描述信息")
-      .build()).toString());
-  }
-
   @Test
   public void testEntPay() throws WxPayException {
     EntPayRequest request = EntPayRequest.newBuilder()
       .partnerTradeNo("Eb6Aep7uVTdbkJqrP4")
-      .openid("ojOQA0y9o-Eb6Aep7uVTdbkJqrP4")
-      .amount(1)
+      .openid("ojOQA0y9o-Eb6Aep7uVTdbkJqrP5")
+      .amount(100)
       .spbillCreateIp("10.10.10.10")
-      .checkName(WxPayConstants.CheckNameOption.NO_CHECK)
+      .checkName(CheckNameOption.NO_CHECK)
       .description("描述信息")
       .build();
 
     this.logger.info(this.payService.getEntPayService().entPay(request).toString());
   }
 
-  @Test
-  public void testQueryEntPay_old() throws WxPayException {
-    this.logger.info(this.payService.queryEntPay("11212121").toString());
-  }
-
   @Test
   public void testQueryEntPay() throws WxPayException {
     this.logger.info(this.payService.getEntPayService().queryEntPay("11212121").toString());