| @@ -6,7 +6,7 @@ | |||
| <modelVersion>4.0.0</modelVersion> | |||
| <groupId>com.github.binarywang</groupId> | |||
| <artifactId>weixin-java-parent</artifactId> | |||
| <version>2.8.8.BETA</version> | |||
| <version>2.9.0</version> | |||
| <packaging>pom</packaging> | |||
| <name>WeiXin Java Tools - Parent</name> | |||
| <description>微信公众号、企业号上级POM</description> | |||
| @@ -1,4 +1,4 @@ | |||
| 微信支付/公众号/企业号/小程序的Java开发工具包(SDK) | |||
| 微信支付/开放平台/公众号/企业微信/小程序的Java开发工具包(SDK) | |||
| --------------------------------- | |||
| [](https://maven-badges.herokuapp.com/maven-central/com.github.binarywang/weixin-java-parent) | |||
| [](https://travis-ci.org/Wechat-Group/weixin-java-tools) | |||
| @@ -16,14 +16,15 @@ | |||
| * https://github.com/binarywang/weixin-java-mp-demo (公众号Demo,使用Spring MVC实现) | |||
| * https://github.com/binarywang/weixin-java-mp-demo-springboot (公众号Demo,使用Spring Boot实现) | |||
| * https://github.com/binarywang/weixin-java-mp-multi-demo (支持多公众号) | |||
| * https://github.com/wechat-group/weixin-java-tools-springmvc (公众号Demo,内含部分微信支付代码) | |||
| * https://github.com/Wechat-Group/weixin-java-open-demo (开放平台Demo) | |||
| * https://github.com/Wechat-Group/weixin-java-tools-springmvc (公众号Demo,内含部分微信支付代码) | |||
| --------------------------------- | |||
| ### 重要提示信息(部分为新手必读): | |||
| 1. 最新更新:**2017-9-3 发布[【2.8.0正式版】](https://github.com/Wechat-Group/weixin-java-tools/releases)**! | |||
| 1. 开源中国本项目的首页地址:https://www.oschina.net/p/weixin-java-tools-new (欢迎大家积极留言评分 🙂) | |||
| 1. SDK详细开发文档请查阅 [【Wiki】](https://github.com/wechat-group/weixin-java-tools/wiki),部分文档可能未能及时更新,如有发现,可以及时上报或者自行修改。 | |||
| 1. 各个模块的Javadoc可以在线查看(有可能是最新的测试版本的,请注意观察版本号):[weixin-java-miniapp](https://binarywang.github.io/weixin-java-miniapp-javadoc/)、[weixin-java-pay](https://binarywang.github.io/weixin-java-pay-javadoc/)、[weixin-java-mp](https://binarywang.github.io/weixin-java-mp-javadoc/)、[weixin-java-common](https://binarywang.github.io/weixin-java-common-javadoc/)、[weixin-java-cp](https://binarywang.github.io/weixin-java-cp-javadoc/) | |||
| 1. 各个模块的Javadoc可以在线查看(有可能是最新的测试版本的,请注意观察版本号):[weixin-java-miniapp](https://binarywang.github.io/weixin-java-miniapp-javadoc/)、[weixin-java-pay](https://binarywang.github.io/weixin-java-pay-javadoc/)、[weixin-java-mp](https://binarywang.github.io/weixin-java-mp-javadoc/)、[weixin-java-common](https://binarywang.github.io/weixin-java-common-javadoc/)、[weixin-java-cp](https://binarywang.github.io/weixin-java-cp-javadoc/)、[weixin-java-open](https://binarywang.github.io/weixin-java-open-javadoc/) | |||
| 1. 本SDK要求的最低JDK版本是7,还在使用JDK6的用户请参考[【此项目】]( https://github.com/binarywang/weixin-java-tools-for-jdk6) ,而其他更早的JDK版本则需要自己改造实现。 | |||
| 1. 如有新功能需求,发现BUG,或者由于微信官方接口调整导致的代码问题,可以直接在[【Issues】](https://github.com/Wechat-Group/weixin-java-tools/issues)页提出issue,便于讨论追踪问题; | |||
| 1. 如果想贡献代码,请阅读[【代码贡献指南】](contribution.md); | |||
| @@ -41,7 +42,7 @@ | |||
| ## 版本说明 | |||
| 1. 本项目定为大约每两个月发布一次正式版,版本号格式为X.X.0(如2.1.0,2.2.0等),遇到重大问题需修复会及时提交新版本,欢迎大家随时提交Pull Request; | |||
| 1. BUG修复和新特性一般会先发布成小版本作为临时测试版本(如2.4.5.BETA,2.4.6.BETA等,即尾号不为0,并添加BETA字样,以区别于正式版); | |||
| 1. 目前最新版本号为 [](https://maven-badges.herokuapp.com/maven-central/com.github.binarywang/weixin-java-parent) ,也可以通过访问链接 [【微信支付】](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.binarywang%22%20AND%20a%3A%22weixin-java-pay%22) 、[【微信小程序】](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.binarywang%22%20AND%20a%3A%22weixin-java-miniapp%22) 、[【公众号】](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.binarywang%22%20AND%20a%3A%22weixin-java-mp%22) 、[【企业号】](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.binarywang%22%20AND%20a%3A%22weixin-java-cp%22) | |||
| 1. 目前最新版本号为 [](https://maven-badges.herokuapp.com/maven-central/com.github.binarywang/weixin-java-parent) ,也可以通过访问链接 [【微信支付】](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.binarywang%22%20AND%20a%3A%22weixin-java-pay%22) 、[【微信小程序】](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.binarywang%22%20AND%20a%3A%22weixin-java-miniapp%22) 、[【公众号】](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.binarywang%22%20AND%20a%3A%22weixin-java-mp%22) 、[【企业微信】](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.binarywang%22%20AND%20a%3A%22weixin-java-cp%22)、[【开放平台】](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.binarywang%22%20AND%20a%3A%22weixin-java-open%22) | |||
| 分别查看所有最新的版本。 | |||
| --------------------------------- | |||
| @@ -52,44 +53,16 @@ | |||
| * Coding: https://git.coding.net/binarywang/weixin-java-tools.git | |||
| --------------------------------- | |||
| ## Maven 最新正式版本 | |||
| * 微信小程序: | |||
| ## Maven 引用 | |||
| ```xml | |||
| <dependency> | |||
| <groupId>com.github.binarywang</groupId> | |||
| <artifactId>weixin-java-miniapp</artifactId> | |||
| <artifactId>(按模块不同)</artifactId> | |||
| <version>2.8.0</version> | |||
| </dependency> | |||
| ``` | |||
| * 微信支付: | |||
| ```xml | |||
| <dependency> | |||
| <groupId>com.github.binarywang</groupId> | |||
| <artifactId>weixin-java-pay</artifactId> | |||
| <version>2.8.0</version> | |||
| </dependency> | |||
| ``` | |||
| * 公众号(订阅号及服务号): | |||
| ```xml | |||
| <dependency> | |||
| <groupId>com.github.binarywang</groupId> | |||
| <artifactId>weixin-java-mp</artifactId> | |||
| <version>2.8.0</version> | |||
| </dependency> | |||
| ``` | |||
| * 企业号: | |||
| ```xml | |||
| <dependency> | |||
| <groupId>com.github.binarywang</groupId> | |||
| <artifactId>weixin-java-cp</artifactId> | |||
| <version>2.8.0</version> | |||
| </dependency> | |||
| ``` | |||
| * 各模块的artifactId: | |||
| - 微信小程序:`weixin-java-miniapp` | |||
| - 微信支付:`weixin-java-pay` | |||
| - 公众号(订阅号及服务号):`weixin-java-mp` | |||
| - 企业号:`weixin-java-cp` | |||
| @@ -7,7 +7,7 @@ | |||
| <parent> | |||
| <groupId>com.github.binarywang</groupId> | |||
| <artifactId>weixin-java-parent</artifactId> | |||
| <version>2.8.8.BETA</version> | |||
| <version>2.9.0</version> | |||
| </parent> | |||
| <artifactId>weixin-java-common</artifactId> | |||
| @@ -7,7 +7,7 @@ | |||
| <parent> | |||
| <groupId>com.github.binarywang</groupId> | |||
| <artifactId>weixin-java-parent</artifactId> | |||
| <version>2.8.8.BETA</version> | |||
| <version>2.9.0</version> | |||
| </parent> | |||
| <artifactId>weixin-java-cp</artifactId> | |||
| @@ -381,7 +381,7 @@ public abstract class WxCpServiceAbstractImpl<H, P> implements WxCpService, Requ | |||
| throw new RuntimeException("微信服务端异常,超出重试次数"); | |||
| } | |||
| protected synchronized <T, E> T executeInternal(RequestExecutor<T, E> executor, String uri, E data) throws WxErrorException { | |||
| protected <T, E> T executeInternal(RequestExecutor<T, E> executor, String uri, E data) throws WxErrorException { | |||
| if (uri.contains("access_token=")) { | |||
| throw new IllegalArgumentException("uri参数中不允许有access_token: " + uri); | |||
| } | |||
| @@ -9,7 +9,11 @@ import redis.clients.jedis.JedisPoolConfig; | |||
| import java.io.File; | |||
| /** | |||
| * Jedis client implementor for wechat config storage | |||
| * Jedis client implementor for wechat config storage. | |||
| * <pre> | |||
| * 使用说明:本实现仅供参考,并不完整, | |||
| * 比如为减少项目依赖,未加入redis分布式锁的实现,如有需要请自行实现。 | |||
| * </pre> | |||
| * | |||
| * @author gaigeshen | |||
| */ | |||
| @@ -7,7 +7,7 @@ | |||
| <parent> | |||
| <groupId>com.github.binarywang</groupId> | |||
| <artifactId>weixin-java-parent</artifactId> | |||
| <version>2.8.8.BETA</version> | |||
| <version>2.9.0</version> | |||
| </parent> | |||
| <artifactId>weixin-java-miniapp</artifactId> | |||
| <name>WeiXin Java Tools - MiniApp</name> | |||
| @@ -181,7 +181,7 @@ public class WxMaServiceImpl implements WxMaService, RequestHttp<CloseableHttpCl | |||
| throw new RuntimeException("微信服务端异常,超出重试次数"); | |||
| } | |||
| public synchronized <T, E> T executeInternal(RequestExecutor<T, E> executor, String uri, E data) throws WxErrorException { | |||
| public <T, E> T executeInternal(RequestExecutor<T, E> executor, String uri, E data) throws WxErrorException { | |||
| if (uri.contains("access_token=")) { | |||
| throw new IllegalArgumentException("uri参数中不允许有access_token: " + uri); | |||
| } | |||
| @@ -7,7 +7,7 @@ | |||
| <parent> | |||
| <groupId>com.github.binarywang</groupId> | |||
| <artifactId>weixin-java-parent</artifactId> | |||
| <version>2.8.8.BETA</version> | |||
| <version>2.9.0</version> | |||
| </parent> | |||
| <artifactId>weixin-java-mp</artifactId> | |||
| <name>WeiXin Java Tools - MP</name> | |||
| @@ -5,7 +5,10 @@ import redis.clients.jedis.JedisPool; | |||
| /** | |||
| * 基于Redis的微信配置provider | |||
| * | |||
| * <pre> | |||
| * 使用说明:本实现仅供参考,并不完整, | |||
| * 比如为减少项目依赖,未加入redis分布式锁的实现,如有需要请自行实现。 | |||
| * </pre> | |||
| * @author nickwong | |||
| */ | |||
| @SuppressWarnings("hiding") | |||
| @@ -5,8 +5,11 @@ import me.chanjar.weixin.common.exception.WxErrorException; | |||
| import me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor; | |||
| import me.chanjar.weixin.common.util.http.RequestExecutor; | |||
| import me.chanjar.weixin.common.util.http.RequestHttp; | |||
| 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; | |||
| /** | |||
| * 微信API的Service | |||
| @@ -62,6 +65,11 @@ public interface WxMpService { | |||
| */ | |||
| String GET_CURRENT_AUTOREPLY_INFO_URL = "https://api.weixin.qq.com/cgi-bin/get_current_autoreply_info"; | |||
| /** | |||
| * 公众号调用或第三方平台帮公众号调用对公众号的所有api调用(包括第三方帮其调用)次数进行清零 | |||
| */ | |||
| String CLEAR_QUOTA_URL = "https://api.weixin.qq.com/cgi-bin/clear_quota"; | |||
| /** | |||
| * <pre> | |||
| * 验证消息的确来自微信服务器 | |||
| @@ -219,6 +227,18 @@ public interface WxMpService { | |||
| */ | |||
| WxMpCurrentAutoReplyInfo getCurrentAutoReplyInfo() throws WxErrorException; | |||
| /** | |||
| * <pre> | |||
| * 公众号调用或第三方平台帮公众号调用对公众号的所有api调用(包括第三方帮其调用)次数进行清零: | |||
| * HTTP调用:https://api.weixin.qq.com/cgi-bin/clear_quota?access_token=ACCESS_TOKEN | |||
| * 接口文档地址:https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433744592 | |||
| * | |||
| * </pre> | |||
| * | |||
| * @param appid 公众号的APPID | |||
| */ | |||
| void clearQuota(String appid) throws WxErrorException; | |||
| /** | |||
| * 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求 | |||
| */ | |||
| @@ -376,6 +396,7 @@ public interface WxMpService { | |||
| /** | |||
| * 返回群发消息相关接口方法的实现类对象,以方便调用其各个接口 | |||
| * | |||
| * @return WxMpMassMessageService | |||
| */ | |||
| WxMpMassMessageService getMassMessageService(); | |||
| @@ -207,6 +207,13 @@ public abstract class WxMpServiceAbstractImpl<H, P> implements WxMpService, Requ | |||
| return WxMpCurrentAutoReplyInfo.fromJson(this.get(GET_CURRENT_AUTOREPLY_INFO_URL, null)); | |||
| } | |||
| @Override | |||
| public void clearQuota(String appid) throws WxErrorException { | |||
| JsonObject o = new JsonObject(); | |||
| o.addProperty("appid", appid); | |||
| this.post(CLEAR_QUOTA_URL, o.toString()); | |||
| } | |||
| @Override | |||
| public String get(String url, String queryParam) throws WxErrorException { | |||
| return execute(SimpleGetRequestExecutor.create(this), url, queryParam); | |||
| @@ -252,7 +259,7 @@ public abstract class WxMpServiceAbstractImpl<H, P> implements WxMpService, Requ | |||
| throw new RuntimeException("微信服务端异常,超出重试次数"); | |||
| } | |||
| public synchronized <T, E> T executeInternal(RequestExecutor<T, E> executor, String uri, E data) throws WxErrorException { | |||
| public <T, E> T executeInternal(RequestExecutor<T, E> executor, String uri, E data) throws WxErrorException { | |||
| if (uri.contains("access_token=")) { | |||
| throw new IllegalArgumentException("uri参数中不允许有access_token: " + uri); | |||
| } | |||
| @@ -1,5 +1,6 @@ | |||
| package me.chanjar.weixin.mp.util.http.apache; | |||
| import com.google.common.collect.ImmutableMap; | |||
| import me.chanjar.weixin.common.bean.result.WxError; | |||
| import me.chanjar.weixin.common.exception.WxErrorException; | |||
| import me.chanjar.weixin.common.util.http.RequestHttp; | |||
| @@ -43,9 +44,7 @@ public class ApacheMaterialNewsInfoRequestExecutor | |||
| httpPost.setConfig(config); | |||
| } | |||
| Map<String, String> params = new HashMap<>(); | |||
| params.put("media_id", materialId); | |||
| httpPost.setEntity(new StringEntity(WxGsonBuilder.create().toJson(params))); | |||
| httpPost.setEntity(new StringEntity(WxGsonBuilder.create().toJson(ImmutableMap.of("media_id", materialId)))); | |||
| try (CloseableHttpResponse response = requestHttp.getRequestHttpClient().execute(httpPost)) { | |||
| String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response); | |||
| this.logger.debug("响应原始数据:{}", responseContent); | |||
| @@ -1,5 +1,6 @@ | |||
| package me.chanjar.weixin.mp.util.http.jodd; | |||
| import com.google.common.collect.ImmutableMap; | |||
| import jodd.http.HttpConnectionProvider; | |||
| import jodd.http.HttpRequest; | |||
| import jodd.http.HttpResponse; | |||
| @@ -9,6 +10,7 @@ import jodd.util.StringPool; | |||
| import me.chanjar.weixin.common.bean.result.WxError; | |||
| import me.chanjar.weixin.common.exception.WxErrorException; | |||
| import me.chanjar.weixin.common.util.http.RequestHttp; | |||
| import me.chanjar.weixin.common.util.json.WxGsonBuilder; | |||
| import me.chanjar.weixin.mp.bean.material.WxMpMaterialNews; | |||
| import me.chanjar.weixin.mp.util.http.MaterialNewsInfoRequestExecutor; | |||
| import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
| @@ -28,13 +30,13 @@ public class JoddMaterialNewsInfoRequestExecutor extends MaterialNewsInfoRequest | |||
| @Override | |||
| public WxMpMaterialNews execute(String uri, String materialId) throws WxErrorException, IOException { | |||
| HttpRequest request = HttpRequest.post(uri); | |||
| if (requestHttp.getRequestHttpProxy() != null) { | |||
| requestHttp.getRequestHttpClient().useProxy(requestHttp.getRequestHttpProxy()); | |||
| } | |||
| request.withConnectionProvider(requestHttp.getRequestHttpClient()); | |||
| request.query("media_id", materialId); | |||
| HttpRequest request = HttpRequest.post(uri) | |||
| .withConnectionProvider(requestHttp.getRequestHttpClient()) | |||
| .body(WxGsonBuilder.create().toJson(ImmutableMap.of("media_id", materialId))); | |||
| HttpResponse response = request.send(); | |||
| response.charset(StringPool.UTF_8); | |||
| @@ -1,9 +1,11 @@ | |||
| package me.chanjar.weixin.mp.util.http.okhttp; | |||
| import com.google.common.collect.ImmutableMap; | |||
| import me.chanjar.weixin.common.bean.result.WxError; | |||
| import me.chanjar.weixin.common.exception.WxErrorException; | |||
| import me.chanjar.weixin.common.util.http.RequestHttp; | |||
| import me.chanjar.weixin.common.util.http.okhttp.OkHttpProxyInfo; | |||
| import me.chanjar.weixin.common.util.json.WxGsonBuilder; | |||
| import me.chanjar.weixin.mp.bean.material.WxMpMaterialNews; | |||
| import me.chanjar.weixin.mp.util.http.MaterialNewsInfoRequestExecutor; | |||
| import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
| @@ -28,7 +30,8 @@ public class OkhttpMaterialNewsInfoRequestExecutor extends MaterialNewsInfoReque | |||
| //得到httpClient | |||
| OkHttpClient client = requestHttp.getRequestHttpClient(); | |||
| RequestBody requestBody = new FormBody.Builder().add("media_id", materialId).build(); | |||
| RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), | |||
| WxGsonBuilder.create().toJson(ImmutableMap.of("media_id", materialId))); | |||
| Request request = new Request.Builder().url(uri).post(requestBody).build(); | |||
| Response response = client.newCall(request).execute(); | |||
| @@ -15,7 +15,6 @@ import static org.testng.Assert.*; | |||
| @Test | |||
| @Guice(modules = ApiTestModule.class) | |||
| public class WxMpServiceImplTest { | |||
| @Inject | |||
| private WxMpService wxService; | |||
| @@ -28,88 +27,8 @@ public class WxMpServiceImplTest { | |||
| } | |||
| @Test | |||
| public void testCheckSignature() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testGetAccessToken() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testGetAccessTokenBoolean() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testGetJsapiTicket() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testGetJsapiTicketBoolean() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testCreateJsapiSignature() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testCustomMessageSend() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testMassNewsUpload() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testMassVideoUpload() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testMassGroupMessageSend() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testMassOpenIdsMessageSend() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testMassMessagePreview() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testShortUrl() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testSetIndustry() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testGetIndustry() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testSemanticQuery() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testOauth2buildAuthorizationUrl() { | |||
| Assert.fail("Not yet implemented"); | |||
| public void testClearQuota() throws WxErrorException { | |||
| this.wxService.clearQuota(wxService.getWxMpConfigStorage().getAppId()); | |||
| } | |||
| @Test | |||
| @@ -121,44 +40,4 @@ public class WxMpServiceImplTest { | |||
| System.out.println(qrConnectUrl); | |||
| } | |||
| @Test | |||
| public void testOauth2getAccessToken() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testOauth2refreshAccessToken() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testOauth2getUserInfo() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testOauth2validateAccessToken() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testGetCallbackIP() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testGet() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testPost() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| @Test | |||
| public void testExecute() { | |||
| Assert.fail("Not yet implemented"); | |||
| } | |||
| } | |||
| @@ -8,7 +8,7 @@ | |||
| <parent> | |||
| <groupId>com.github.binarywang</groupId> | |||
| <artifactId>weixin-java-parent</artifactId> | |||
| <version>2.8.8.BETA</version> | |||
| <version>2.9.0</version> | |||
| </parent> | |||
| <artifactId>weixin-java-open</artifactId> | |||
| <name>WeiXin Java Tools - Open</name> | |||
| @@ -5,7 +5,7 @@ | |||
| <parent> | |||
| <artifactId>weixin-java-parent</artifactId> | |||
| <groupId>com.github.binarywang</groupId> | |||
| <version>2.8.8.BETA</version> | |||
| <version>2.9.0</version> | |||
| </parent> | |||
| <modelVersion>4.0.0</modelVersion> | |||
| @@ -21,7 +21,7 @@ import lombok.NoArgsConstructor; | |||
| public class WxPayCouponInfoQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 字段名:设备号 | |||
| * 字段名:设备号. | |||
| * 变量名:device_info | |||
| * 是否必填:否 | |||
| * 示例值:123456sb | |||
| @@ -34,7 +34,7 @@ public class WxPayCouponInfoQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 字段名:批次ID | |||
| * 字段名:批次ID. | |||
| * 变量名:coupon_stock_id | |||
| * 是否必填:是 | |||
| * 示例值:1567 | |||
| @@ -47,7 +47,7 @@ public class WxPayCouponInfoQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 字段名:代金券id | |||
| * 字段名:代金券id. | |||
| * 变量名:coupon_id | |||
| * 是否必填:是 | |||
| * 示例值:4242 | |||
| @@ -60,7 +60,7 @@ public class WxPayCouponInfoQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 字段名:代金券面额 | |||
| * 字段名:代金券面额. | |||
| * 变量名:coupon_value | |||
| * 是否必填:是 | |||
| * 示例值:4 | |||
| @@ -73,7 +73,7 @@ public class WxPayCouponInfoQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 字段名:代金券使用门槛 | |||
| * 字段名:代金券使用门槛. | |||
| * 变量名:coupon_mininum | |||
| * 是否必填:是 | |||
| * 示例值:10 | |||
| @@ -86,7 +86,7 @@ public class WxPayCouponInfoQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 字段名:代金券名称 | |||
| * 字段名:代金券名称. | |||
| * 变量名:coupon_name | |||
| * 是否必填:是 | |||
| * 示例值:测试代金券 | |||
| @@ -99,20 +99,20 @@ public class WxPayCouponInfoQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 字段名:代金券状态 | |||
| * 字段名:代金券状态. | |||
| * 变量名:coupon_state | |||
| * 是否必填:是 | |||
| * 示例值:SENDED | |||
| * 类型:int | |||
| * 类型:String | |||
| * 说明:代金券状态:SENDED-可用,USED-已实扣,EXPIRED-已过期 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("coupon_state") | |||
| private Integer couponState; | |||
| private String couponState; | |||
| /** | |||
| * <pre> | |||
| * 字段名:代金券描述 | |||
| * 字段名:代金券描述. | |||
| * 变量名:coupon_desc | |||
| * 是否必填:是 | |||
| * 示例值:微信支付-代金券 | |||
| @@ -125,7 +125,7 @@ public class WxPayCouponInfoQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 字段名:实际优惠金额 | |||
| * 字段名:实际优惠金额. | |||
| * 变量名:coupon_use_value | |||
| * 是否必填:是 | |||
| * 示例值:0 | |||
| @@ -138,7 +138,7 @@ public class WxPayCouponInfoQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 字段名:优惠剩余可用额 | |||
| * 字段名:优惠剩余可用额. | |||
| * 变量名:coupon_remain_value | |||
| * 是否必填:是 | |||
| * 示例值:4 | |||
| @@ -151,7 +151,7 @@ public class WxPayCouponInfoQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 字段名:生效开始时间 | |||
| * 字段名:生效开始时间. | |||
| * 变量名:begin_time | |||
| * 是否必填:是 | |||
| * 示例值:1943787483 | |||
| @@ -164,7 +164,7 @@ public class WxPayCouponInfoQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 字段名:生效结束时间 | |||
| * 字段名:生效结束时间. | |||
| * 变量名:end_time | |||
| * 是否必填:是 | |||
| * 示例值:1943787484 | |||
| @@ -177,7 +177,7 @@ public class WxPayCouponInfoQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 字段名:发放时间 | |||
| * 字段名:发放时间. | |||
| * 变量名:send_time | |||
| * 是否必填:是 | |||
| * 示例值:1943787420 | |||
| @@ -190,7 +190,7 @@ public class WxPayCouponInfoQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 字段名:消耗方商户id | |||
| * 字段名:消耗方商户id. | |||
| * 变量名:consumer_mch_id | |||
| * 是否必填:否 | |||
| * 示例值:10000098 | |||
| @@ -203,7 +203,7 @@ public class WxPayCouponInfoQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 字段名:发放来源 | |||
| * 字段名:发放来源. | |||
| * 变量名:send_source | |||
| * 是否必填:是 | |||
| * 示例值:FULL_SEND | |||
| @@ -216,7 +216,7 @@ public class WxPayCouponInfoQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 字段名:是否允许部分使用 | |||
| * 字段名:是否允许部分使用. | |||
| * 变量名:is_partial_use | |||
| * 是否必填:否 | |||
| * 示例值:1 | |||
| @@ -14,13 +14,6 @@ import java.util.Arrays; | |||
| /** | |||
| * <pre> | |||
| * 微信支付-申请退款请求参数 | |||
| * 注释中各行每个字段描述对应如下: | |||
| * <li>字段名 | |||
| * <li>变量名 | |||
| * <li>是否必填 | |||
| * <li>类型 | |||
| * <li>示例值 | |||
| * <li>描述 | |||
| * Created by Binary Wang on 2016-10-08. | |||
| * </pre> | |||
| * | |||
| @@ -34,53 +27,52 @@ import java.util.Arrays; | |||
| @XStreamAlias("xml") | |||
| public class WxPayRefundRequest extends WxPayBaseRequest { | |||
| private static final String[] REFUND_ACCOUNT = new String[]{ | |||
| RefundAccountSource.RECHARGE_FUNDS, | |||
| RefundAccountSource.UNSETTLED_FUNDS | |||
| }; | |||
| RefundAccountSource.RECHARGE_FUNDS, RefundAccountSource.UNSETTLED_FUNDS}; | |||
| /** | |||
| * <pre> | |||
| * 设备号 | |||
| * device_info | |||
| * 否 | |||
| * String(32) | |||
| * 13467007045764 | |||
| * 终端设备号 | |||
| * 字段名:设备号. | |||
| * 变量名:device_info | |||
| * 是否必填:否 | |||
| * 类型:String(32) | |||
| * 示例值:13467007045764 | |||
| * 描述:终端设备号 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("device_info") | |||
| private String deviceInfo; | |||
| /** | |||
| * <pre> | |||
| * 微信订单号 | |||
| * transaction_id | |||
| * 跟out_trade_no二选一 | |||
| * String(28) | |||
| * 1217752501201400000000000000 | |||
| * 微信生成的订单号,在支付通知中有返回 | |||
| * 字段名:微信订单号. | |||
| * 变量名:transaction_id | |||
| * 是否必填:跟out_trade_no二选一 | |||
| * 类型:String(28) | |||
| * 示例值:1217752501201400000000000000 | |||
| * 描述:微信生成的订单号,在支付通知中有返回 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("transaction_id") | |||
| private String transactionId; | |||
| /** | |||
| * <pre> | |||
| * 商户订单号 | |||
| * out_trade_no | |||
| * 跟transaction_id二选一 | |||
| * String(32) | |||
| * 1217752501201400000000000000 | |||
| * 商户侧传给微信的订单号 | |||
| * 字段名:商户订单号. | |||
| * 变量名:out_trade_no | |||
| * 是否必填:跟transaction_id二选一 | |||
| * 类型:String(32) | |||
| * 示例值:1217752501201400000000000000 | |||
| * 描述:商户侧传给微信的订单号 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("out_trade_no") | |||
| private String outTradeNo; | |||
| /** | |||
| * <pre> | |||
| * 商户退款单号 | |||
| * out_refund_no | |||
| * 是 | |||
| * String(32) | |||
| * 1217752501201400000000000000 | |||
| * 商户系统内部的退款单号,商户系统内部唯一,同一退款单号多次请求只退一笔 | |||
| * 字段名:商户退款单号. | |||
| * 变量名:out_refund_no | |||
| * 是否必填:是 | |||
| * 类型:String(32) | |||
| * 示例值:1217752501201400000000000000 | |||
| * 描述:商户系统内部的退款单号,商户系统内部唯一,同一退款单号多次请求只退一笔 | |||
| * </pre> | |||
| */ | |||
| @Required | |||
| @@ -88,12 +80,12 @@ public class WxPayRefundRequest extends WxPayBaseRequest { | |||
| private String outRefundNo; | |||
| /** | |||
| * <pre> | |||
| * 订单金额 | |||
| * total_fee | |||
| * 是 | |||
| * Int | |||
| * 100 | |||
| * 订单总金额,单位为分,只能为整数,详见支付金额 | |||
| * 字段名:订单金额. | |||
| * 变量名:total_fee | |||
| * 是否必填:是 | |||
| * 类型:Int | |||
| * 示例值:100 | |||
| * 描述:订单总金额,单位为分,只能为整数,详见支付金额 | |||
| * </pre> | |||
| */ | |||
| @Required | |||
| @@ -101,12 +93,12 @@ public class WxPayRefundRequest extends WxPayBaseRequest { | |||
| private Integer totalFee; | |||
| /** | |||
| * <pre> | |||
| * 退款金额 | |||
| * refund_fee | |||
| * 是 | |||
| * Int | |||
| * 100 | |||
| * 退款总金额,订单总金额,单位为分,只能为整数,详见支付金额 | |||
| * 字段名:退款金额. | |||
| * 变量名:refund_fee | |||
| * 是否必填:是 | |||
| * 类型:Int | |||
| * 示例值:100 | |||
| * 描述:退款总金额,订单总金额,单位为分,只能为整数,详见支付金额 | |||
| * </pre> | |||
| */ | |||
| @Required | |||
| @@ -114,24 +106,24 @@ public class WxPayRefundRequest extends WxPayBaseRequest { | |||
| private Integer refundFee; | |||
| /** | |||
| * <pre> | |||
| * 货币种类 | |||
| * refund_fee_type | |||
| * 否 | |||
| * String(8) | |||
| * CNY | |||
| * 货币类型,符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型 | |||
| * 字段名:货币种类. | |||
| * 变量名:refund_fee_type | |||
| * 是否必填:否 | |||
| * 类型:String(8) | |||
| * 示例值:CNY | |||
| * 描述:货币类型,符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("refund_fee_type") | |||
| private String refundFeeType; | |||
| /** | |||
| * <pre> | |||
| * 操作员 | |||
| * op_user_id | |||
| * 是 | |||
| * String(32) | |||
| * 1900000109 | |||
| * 操作员帐号, 默认为商户号 | |||
| * 字段名:操作员. | |||
| * 变量名:op_user_id | |||
| * 是否必填:是 | |||
| * 类型:String(32) | |||
| * 示例值:1900000109 | |||
| * 描述:操作员帐号, 默认为商户号 | |||
| * </pre> | |||
| */ | |||
| //@Required | |||
| @@ -139,12 +131,12 @@ public class WxPayRefundRequest extends WxPayBaseRequest { | |||
| private String opUserId; | |||
| /** | |||
| * <pre> | |||
| * 退款资金来源 | |||
| * refund_account | |||
| * 否 | |||
| * String(30) | |||
| * REFUND_SOURCE_RECHARGE_FUNDS | |||
| * 仅针对老资金流商户使用, | |||
| * 字段名:退款资金来源. | |||
| * 变量名:refund_account | |||
| * 是否必填:否 | |||
| * 类型:String(30) | |||
| * 示例值:REFUND_SOURCE_RECHARGE_FUNDS | |||
| * 描述:仅针对老资金流商户使用, | |||
| * <li>REFUND_SOURCE_UNSETTLED_FUNDS---未结算资金退款(默认使用未结算资金退款), | |||
| * <li>REFUND_SOURCE_RECHARGE_FUNDS---可用余额退款 | |||
| * </pre> | |||
| @@ -153,12 +145,12 @@ public class WxPayRefundRequest extends WxPayBaseRequest { | |||
| private String refundAccount; | |||
| /** | |||
| * <pre> | |||
| * 退款原因 | |||
| * refund_account | |||
| * 否 | |||
| * String(80) | |||
| * 商品已售完 | |||
| * 若商户传入,会在下发给用户的退款消息中体现退款原因 | |||
| * 字段名:退款原因. | |||
| * 变量名:refund_account | |||
| * 是否必填:否 | |||
| * 类型:String(80) | |||
| * 示例值:商品已售完 | |||
| * 描述:若商户传入,会在下发给用户的退款消息中体现退款原因 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("refund_desc") | |||
| @@ -177,8 +169,8 @@ public class WxPayRefundRequest extends WxPayBaseRequest { | |||
| protected void checkConstraints() throws WxPayException { | |||
| if (StringUtils.isNotBlank(this.getRefundAccount())) { | |||
| if (!ArrayUtils.contains(REFUND_ACCOUNT, this.getRefundAccount())) { | |||
| throw new WxPayException(String.format("refund_account目前必须为%s其中之一,实际值:%s", | |||
| Arrays.toString(REFUND_ACCOUNT), this.getRefundAccount())); | |||
| throw new WxPayException( | |||
| String.format("refund_account目前必须为%s其中之一,实际值:%s", Arrays.toString(REFUND_ACCOUNT), this.getRefundAccount())); | |||
| } | |||
| } | |||
| @@ -8,6 +8,7 @@ import java.util.List; | |||
| /** | |||
| * <pre> | |||
| * 微信支付-退款查询返回结果 | |||
| * Created by Binary Wang on 2016-11-24. | |||
| * </pre> | |||
| * | |||
| @@ -20,96 +21,104 @@ import java.util.List; | |||
| public class WxPayRefundQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 设备号 | |||
| * device_info | |||
| * 否 | |||
| * String(32) | |||
| * 013467007045764 | |||
| * 终端设备号 | |||
| * 字段名:设备号. | |||
| * 变量名:device_info | |||
| * 是否必填:否 | |||
| * 类型:String(32) | |||
| * 示例值:013467007045764 | |||
| * 描述:终端设备号 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("device_info") | |||
| private String deviceInfo; | |||
| /** | |||
| * <pre> | |||
| * 微信订单号 | |||
| * transaction_id | |||
| * 是 | |||
| * String(32) | |||
| * 1217752501201407033233368018 | |||
| * 微信订单号 | |||
| * 字段名:微信订单号. | |||
| * 变量名:transaction_id | |||
| * 是否必填:是 | |||
| * 类型:String(32) | |||
| * 示例值:1217752501201407033233368018 | |||
| * 描述:微信订单号 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("transaction_id") | |||
| private String transactionId; | |||
| /** | |||
| * <pre> | |||
| * 商户订单号 | |||
| * out_trade_no | |||
| * 是 | |||
| * String(32) | |||
| * 1217752501201407033233368018 | |||
| * 商户系统内部的订单号 | |||
| * 字段名:商户订单号. | |||
| * 变量名:out_trade_no | |||
| * 是否必填:是 | |||
| * 类型:String(32) | |||
| * 示例值:1217752501201407033233368018 | |||
| * 描述:商户系统内部的订单号 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("out_trade_no") | |||
| private String outTradeNo; | |||
| /** | |||
| * <pre> | |||
| * 订单金额 | |||
| * total_fee | |||
| * 是 | |||
| * Int | |||
| * 100 | |||
| * 订单总金额,单位为分,只能为整数,详见支付金额 | |||
| * 字段名:订单金额. | |||
| * 变量名:total_fee | |||
| * 是否必填:是 | |||
| * 类型:Int | |||
| * 示例值:100 | |||
| * 描述:订单总金额,单位为分,只能为整数,详见支付金额 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("total_fee") | |||
| private Integer totalFee; | |||
| /** | |||
| * <pre> | |||
| * 应结订单金额 | |||
| * settlement_total_fee | |||
| * 否 | |||
| * Int | |||
| * 100 | |||
| * 应结订单金额=订单金额-非充值代金券金额,应结订单金额<=订单金额。 | |||
| * 字段名:应结订单金额. | |||
| * 变量名:settlement_total_fee | |||
| * 是否必填:否 | |||
| * 类型:Int | |||
| * 示例值:100 | |||
| * 描述:应结订单金额=订单金额-非充值代金券金额,应结订单金额<=订单金额。 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("settlement_total_fee") | |||
| private Integer settlementTotalFee; | |||
| /** | |||
| * <pre> | |||
| * 货币种类 | |||
| * fee_type | |||
| * 否 | |||
| * String(8) | |||
| * CNY | |||
| * 订单金额货币类型,符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型 | |||
| * 字段名:货币种类. | |||
| * 变量名:fee_type | |||
| * 是否必填:否 | |||
| * 类型:String(8) | |||
| * 示例值:CNY | |||
| * 描述:订单金额货币类型,符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("fee_type") | |||
| private String feeType; | |||
| /** | |||
| * <pre> | |||
| * 现金支付金额 | |||
| * cash_fee | |||
| * 是 | |||
| * Int | |||
| * 100 | |||
| * 现金支付金额,单位为分,只能为整数,详见支付金额 | |||
| * 字段名:现金支付金额. | |||
| * 变量名:cash_fee | |||
| * 是否必填:是 | |||
| * 类型:Int | |||
| * 示例值:100 | |||
| * 描述:现金支付金额,单位为分,只能为整数,详见支付金额 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("cash_fee") | |||
| private Integer cashFee; | |||
| /** | |||
| * <pre> | |||
| * 退款笔数 | |||
| * refund_count | |||
| * 是 | |||
| * Int | |||
| * 1 | |||
| * 退款记录数 | |||
| * 字段名:退款笔数. | |||
| * 变量名:refund_count | |||
| * 是否必填:是 | |||
| * 类型:Int | |||
| * 示例值:1 | |||
| * 描述:退款记录数 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("refund_count") | |||
| private Integer refundCount; | |||
| @@ -117,7 +126,7 @@ public class WxPayRefundQueryResult extends WxPayBaseResult { | |||
| private List<RefundRecord> refundRecords; | |||
| /** | |||
| * 组装生成退款记录属性的内容 | |||
| * 组装生成退款记录属性的内容. | |||
| */ | |||
| public void composeRefundRecords() { | |||
| if (this.refundCount != null && this.refundCount > 0) { | |||
| @@ -137,6 +146,7 @@ public class WxPayRefundQueryResult extends WxPayBaseResult { | |||
| refundRecord.setCouponRefundCount(this.getXmlValueAsInt("xml/coupon_refund_count_" + i)); | |||
| refundRecord.setRefundStatus(this.getXmlValue("xml/refund_status_" + i)); | |||
| refundRecord.setRefundRecvAccount(this.getXmlValue("xml/refund_recv_accout_" + i)); | |||
| refundRecord.setRefundSuccessTime(this.getXmlValue("xml/refund_success_time_" + i)); | |||
| if (refundRecord.getCouponRefundCount() == null || refundRecord.getCouponRefundCount() == 0) { | |||
| continue; | |||
| @@ -151,6 +161,8 @@ public class WxPayRefundQueryResult extends WxPayBaseResult { | |||
| ) | |||
| ); | |||
| } | |||
| refundRecord.setRefundCoupons(coupons); | |||
| } | |||
| } | |||
| @@ -163,12 +175,12 @@ public class WxPayRefundQueryResult extends WxPayBaseResult { | |||
| public static class RefundRecord { | |||
| /** | |||
| * <pre> | |||
| * 商户退款单号 | |||
| * out_refund_no_$n | |||
| * 是 | |||
| * String(32) | |||
| * 1217752501201407033233368018 | |||
| * 商户退款单号 | |||
| * 字段名:商户退款单号. | |||
| * 变量名:out_refund_no_$n | |||
| * 是否必填:是 | |||
| * 类型:String(32) | |||
| * 示例值:1217752501201407033233368018 | |||
| * 描述:商户退款单号 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("out_refund_no") | |||
| @@ -176,12 +188,12 @@ public class WxPayRefundQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 微信退款单号 | |||
| * refund_id_$n | |||
| * 是 | |||
| * String(28) | |||
| * 1217752501201407033233368018 | |||
| * 微信退款单号 | |||
| * 字段名:微信退款单号. | |||
| * 变量名:refund_id_$n | |||
| * 是否必填:是 | |||
| * 类型:String(28) | |||
| * 示例值:1217752501201407033233368018 | |||
| * 描述:微信退款单号 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("refund_id") | |||
| @@ -189,12 +201,12 @@ public class WxPayRefundQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 退款渠道 | |||
| * refund_channel_$n | |||
| * 否 | |||
| * String(16) | |||
| * ORIGINAL | |||
| * ORIGINAL—原路退款 BALANCE—退回到余额 | |||
| * 字段名:退款渠道. | |||
| * 变量名:refund_channel_$n | |||
| * 是否必填:否 | |||
| * 类型:String(16) | |||
| * 示例值:ORIGINAL | |||
| * 描述:ORIGINAL—原路退款 BALANCE—退回到余额 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("refund_channel") | |||
| @@ -202,12 +214,12 @@ public class WxPayRefundQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 申请退款金额 | |||
| * refund_fee_$n | |||
| * 是 | |||
| * Int | |||
| * 100 | |||
| * 退款总金额,单位为分,可以做部分退款 | |||
| * 字段名:申请退款金额. | |||
| * 变量名:refund_fee_$n | |||
| * 是否必填:是 | |||
| * 类型:Int | |||
| * 示例值:100 | |||
| * 描述:退款总金额,单位为分,可以做部分退款 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("refund_fee") | |||
| @@ -215,12 +227,12 @@ public class WxPayRefundQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 退款金额 | |||
| * settlement_refund_fee_$n | |||
| * 否 | |||
| * Int | |||
| * 100 | |||
| * 退款金额=申请退款金额-非充值代金券退款金额,退款金额<=申请退款金额 | |||
| * 字段名:退款金额. | |||
| * 变量名:settlement_refund_fee_$n | |||
| * 是否必填:否 | |||
| * 类型:Int | |||
| * 示例值:100 | |||
| * 描述:退款金额=申请退款金额-非充值代金券退款金额,退款金额<=申请退款金额 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("settlement_refund_fee") | |||
| @@ -228,12 +240,12 @@ public class WxPayRefundQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 退款资金来源 | |||
| * refund_account | |||
| * 否 | |||
| * String(30) | |||
| * REFUND_SOURCE_RECHARGE_FUNDS | |||
| * REFUND_SOURCE_RECHARGE_FUNDS---可用余额退款/基本账户, REFUND_SOURCE_UNSETTLED_FUNDS---未结算资金退款 | |||
| * 字段名:退款资金来源. | |||
| * 变量名:refund_account | |||
| * 是否必填:否 | |||
| * 类型:String(30) | |||
| * 示例值:REFUND_SOURCE_RECHARGE_FUNDS | |||
| * 描述:REFUND_SOURCE_RECHARGE_FUNDS---可用余额退款/基本账户, REFUND_SOURCE_UNSETTLED_FUNDS---未结算资金退款 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("refund_account") | |||
| @@ -241,12 +253,12 @@ public class WxPayRefundQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 代金券类型 | |||
| * coupon_type_$n | |||
| * 否 | |||
| * Int | |||
| * CASH | |||
| * CASH--充值代金券 , NO_CASH---非充值代金券。订单使用代金券时有返回(取值:CASH、NO_CASH)。$n为下标,从0开始编号,举例:coupon_type_$0 | |||
| * 字段名:代金券类型. | |||
| * 变量名:coupon_type_$n | |||
| * 是否必填:否 | |||
| * 类型:Int | |||
| * 示例值:CASH | |||
| * 描述:CASH--充值代金券 , NO_CASH---非充值代金券。订单使用代金券时有返回(取值:CASH、NO_CASH)。$n为下标,从0开始编号,举例:coupon_type_$0 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("coupon_type") | |||
| @@ -254,12 +266,12 @@ public class WxPayRefundQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 代金券退款金额 | |||
| * coupon_refund_fee_$n | |||
| * 否 | |||
| * Int | |||
| * 100 | |||
| * 代金券退款金额<=退款金额,退款金额-代金券或立减优惠退款金额为现金,说明详见代金券或立减优惠 | |||
| * 字段名:代金券退款金额. | |||
| * 变量名:coupon_refund_fee_$n | |||
| * 是否必填:否 | |||
| * 类型:Int | |||
| * 示例值:100 | |||
| * 描述:代金券退款金额<=退款金额,退款金额-代金券或立减优惠退款金额为现金,说明详见代金券或立减优惠 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("coupon_refund_fee") | |||
| @@ -267,12 +279,12 @@ public class WxPayRefundQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 退款代金券使用数量 | |||
| * coupon_refund_count_$n | |||
| * 否 | |||
| * Int | |||
| * 1 | |||
| * 退款代金券使用数量 ,$n为下标,从0开始编号 | |||
| * 字段名:退款代金券使用数量. | |||
| * 变量名:coupon_refund_count_$n | |||
| * 是否必填:否 | |||
| * 类型:Int | |||
| * 示例值:1 | |||
| * 描述:退款代金券使用数量 ,$n为下标,从0开始编号 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("coupon_refund_count") | |||
| @@ -282,12 +294,12 @@ public class WxPayRefundQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 退款状态 | |||
| * refund_status_$n | |||
| * 是 | |||
| * String(16) | |||
| * SUCCESS | |||
| * 退款状态: | |||
| * 字段名:退款状态. | |||
| * 变量名:refund_status_$n | |||
| * 是否必填:是 | |||
| * 类型:String(16) | |||
| * 示例值:SUCCESS | |||
| * 描述:退款状态: | |||
| * SUCCESS—退款成功, | |||
| * FAIL—退款失败, | |||
| * PROCESSING—退款处理中, | |||
| @@ -297,30 +309,44 @@ public class WxPayRefundQueryResult extends WxPayBaseResult { | |||
| */ | |||
| @XStreamAlias("refund_status") | |||
| private String refundStatus; | |||
| /** | |||
| * <pre> | |||
| * 退款入账账户 | |||
| * refund_recv_accout_$n | |||
| * 是 | |||
| * String(64) | |||
| * 招商银行信用卡0403 | |||
| * 取当前退款单的退款入账方,1)退回银行卡:{银行名称}{卡类型}{卡尾号},2)退回支付用户零钱:支付用户零钱 | |||
| * 字段名:退款入账账户. | |||
| * 变量名:refund_recv_accout_$n | |||
| * 是否必填:是 | |||
| * 类型:String(64) | |||
| * 示例值:招商银行信用卡0403 | |||
| * 描述:取当前退款单的退款入账方,1)退回银行卡:{银行名称}{卡类型}{卡尾号},2)退回支付用户零钱:支付用户零钱 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("refund_recv_accout") | |||
| private String refundRecvAccount; | |||
| /** | |||
| * <pre> | |||
| * 字段名:退款成功时间. | |||
| * 变量名:refund_success_time_$n | |||
| * 是否必填:否 | |||
| * 类型:String(20) | |||
| * 示例值:2016-07-25 15:26:26 | |||
| * 描述:退款成功时间,当退款状态为退款成功时有返回。$n为下标,从0开始编号。 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("refund_success_time") | |||
| private String refundSuccessTime; | |||
| @Data | |||
| @NoArgsConstructor | |||
| public static class RefundCoupon { | |||
| /** | |||
| * <pre> | |||
| * 退款代金券批次ID | |||
| * coupon_refund_batch_id_$n_$m | |||
| * 否 | |||
| * String(20) | |||
| * 100 | |||
| * 退款代金券批次ID ,$n为下标,$m为下标,从0开始编号 | |||
| * 字段名:退款代金券批次ID. | |||
| * 变量名:coupon_refund_batch_id_$n_$m | |||
| * 是否必填:否 | |||
| * 类型:String(20) | |||
| * 示例值:100 | |||
| * 描述:退款代金券批次ID ,$n为下标,$m为下标,从0开始编号 | |||
| * </pre> | |||
| * | |||
| * @deprecated 貌似是被去掉了,但不知是何时! | |||
| @@ -330,12 +356,12 @@ public class WxPayRefundQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 退款代金券ID | |||
| * coupon_refund_id_$n_$m | |||
| * 否 | |||
| * String(20) | |||
| * 10000 | |||
| * 退款代金券ID, $n为下标,$m为下标,从0开始编号 | |||
| * 字段名:退款代金券ID. | |||
| * 变量名:coupon_refund_id_$n_$m | |||
| * 是否必填:否 | |||
| * 类型:String(20) | |||
| * 示例值:10000 | |||
| * 描述:退款代金券ID, $n为下标,$m为下标,从0开始编号 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("coupon_refund_id") | |||
| @@ -343,12 +369,12 @@ public class WxPayRefundQueryResult extends WxPayBaseResult { | |||
| /** | |||
| * <pre> | |||
| * 单个退款代金券支付金额 | |||
| * coupon_refund_fee_$n_$m | |||
| * 否 | |||
| * Int | |||
| * 100 | |||
| * 单个退款代金券支付金额, $n为下标,$m为下标,从0开始编号 | |||
| * 字段名:单个退款代金券支付金额. | |||
| * 变量名:coupon_refund_fee_$n_$m | |||
| * 是否必填:否 | |||
| * 类型:Int | |||
| * 示例值:100 | |||
| * 描述:单个退款代金券支付金额, $n为下标,$m为下标,从0开始编号 | |||
| * </pre> | |||
| */ | |||
| @XStreamAlias("coupon_refund_fee") | |||
| @@ -422,9 +422,9 @@ public abstract class WxPayServiceAbstractImpl implements WxPayService { | |||
| String responseContent = this.post(url, request.toXML(), false); | |||
| if (responseContent.startsWith("<")) { | |||
| throw WxPayException.from(WxPayBaseResult.fromXML(responseContent, WxPayCommonResult.class)); | |||
| } else { | |||
| return this.handleBillInformation(responseContent); | |||
| } | |||
| return this.handleBillInformation(responseContent); | |||
| } | |||
| private WxPayBillResult handleBillInformation(String responseContent) { | |||