合并 Develop,发布3.1.0正式版 (#640)

* #519 修复小程序客服消息 URL 被转义的问题

* 优化单元测试提示信息

* 网页授权url增加&connect_redirect=1参数解决两次重定向跳转问题: https://blog.csdn.net/jiangguilong2000/article/details/79416615

* 修复错误的feeToYuan方法名为fenToYuan

* #529 EntPayBankRequest增加默认构造函数

* #529 EntPayBankResult中cmmsAmount的数据类型改为Integer

* #528 WxMpUser类增加三个属性:subscribe_scene、 qr_scene 和qr_scene_str

* 修复代码

* 发布3.0.1.BETA测试版本

* #533 微信刷卡支付请求类增加缺少的三个参数

* #536 企业号模块增加获取企业号应用相关接口

* 定义《企业号应用》的bean

* 增加《获取企业号应用》接口实现

* 增加获取测试企业号应用信息测试类

* #535 修复Tomcat 不能正常关闭的问题,增加线程池shutdown相关的操作

* #541 企业号增加实现管理标签的(获取标签成员)接口 

* 定义《企业号应用》的bean

* 增加《获取企业号应用》接口实现

* 增加获取测试企业号应用信息测试类

* tag service增加获取标签成员方法
http://qydev.weixin.qq.com/wiki/index.php?title=管理标签

* #534 公众号发送模版消息中的小程序path改回pagepath

* 发布3.0.2.BETA测试版本

* #547 开放平台模块 componentAccessToken 增加过期自动刷新

* createOrder方法增加H5支付的支持

* #551 文本卡片消息增加btntext字段

* #550 企业微信删除标签成员接口增加部门列表参数

* 清理无用代码

* #530 微信支付申请退款接口结果类增加单个代金券相关参数 ,并根据官方文档整理其他参数

* #531 小程序WxMaMessage类增加小程序卡片消息相关的几个属性

* #520 企业微信网页授权增加使用user_ticket获取成员详情的接口

* 发布3.0.3.BETA测试版本

* 优化代码

* 完善测试

* #559 微信开放平台:1. WxOpenInRedisConfigStorage 支持 JedisPool/JedisSentinelPool 等 Pool<Jedis> 的子类;2. WxOpenInRedisConfigStorage 增加 keyPrefix 以支持可配置的前缀;

* #560 微信开放平台:增加小程序代码模板库管理 

* 微信开放平台:1. WxOpenInRedisConfigStorage 支持 JedisPool/JedisSentinelPool 等 Pool<Jedis> 的子类;2. WxOpenInRedisConfigStorage 增加 keyPrefix 以支持可配置的前缀;

* 微信开放平台:增加小程序代码模板库管理

* #562 小程序增加代码管理相关 API

* 微信开放平台:1. WxOpenInRedisConfigStorage 支持 JedisPool/JedisSentinelPool 等 Pool<Jedis> 的子类;2. WxOpenInRedisConfigStorage 增加 keyPrefix 以支持可配置的前缀;

* 微信开放平台:增加小程序代码模板库管理

* 小程序:增加代码管理相关 API

* #563 小程序增加修改服务器地址、成员管理 API 

* 微信开放平台:1. WxOpenInRedisConfigStorage 支持 JedisPool/JedisSentinelPool 等 Pool<Jedis> 的子类;2. WxOpenInRedisConfigStorage 增加 keyPrefix 以支持可配置的前缀;

* 微信开放平台:增加小程序代码模板库管理

* 小程序:增加代码管理相关 API

* 小程序:增加修改服务器地址、成员管理 API

* #565 小程序增加数据分析相关 API 

* 微信开放平台:1. WxOpenInRedisConfigStorage 支持 JedisPool/JedisSentinelPool 等 Pool<Jedis> 的子类;2. WxOpenInRedisConfigStorage 增加 keyPrefix 以支持可配置的前缀;

* 微信开放平台:增加小程序代码模板库管理

* 小程序:增加代码管理相关 API

* 小程序:增加修改服务器地址、成员管理 API

* 小程序:增加数据分析相关 API

* #567 微信开放平台增加 HTTP proxy 机制

* 微信开放平台:1. WxOpenInRedisConfigStorage 支持 JedisPool/JedisSentinelPool 等 Pool<Jedis> 的子类;2. WxOpenInRedisConfigStorage 增加 keyPrefix 以支持可配置的前缀;

* 微信开放平台:增加小程序代码模板库管理

* 小程序:增加代码管理相关 API

* 小程序:增加修改服务器地址、成员管理 API

* 小程序:增加数据分析相关 API

* 微信开放平台:增加 HTTP proxy 机制

* #568 修复三方平台多次授权时,RefreshToken 没有刷新的问题

* fix 多次授权时,RefreshToken 没有刷新

* null 判断

* 发布3.0.4.BETA测试版本

* fix code

* #569 微信支付几个查询关闭对账下载相关接口增加重载方法,以方便客户端指定更多参数

* #578 微信开放平台增加 WxMaUserService 的实现

* 微信开放平台:1. WxOpenInRedisConfigStorage 支持 JedisPool/JedisSentinelPool 等 Pool<Jedis> 的子类;2. WxOpenInRedisConfigStorage 增加 keyPrefix 以支持可配置的前缀;

* 微信开放平台:增加小程序代码模板库管理

* 小程序:增加代码管理相关 API

* 小程序:增加修改服务器地址、成员管理 API

* 小程序:增加数据分析相关 API

* 微信开放平台:增加 HTTP proxy 机制

* 微信开放平台:增加 WxMaUserService 的实现

* 修复小程序码的相关方法命名:WxCode->WxaCode, WxCodeLimit -> WxaCodeUnlimit

* #556 日志信息中如果含有secret值的,将其值隐藏掉

* #585 小程序二维码支持is_hyaline参数生成透明背景二维码

* 发布3.0.5.BETA测试版本

* #584 修复企业付款到银行卡接口签名失败的问题

* 简化代码

* #586 微信支付 WxPayConfig增加支持byte数组方式设置证书

* #581 增加微信公众号错误信息枚举类WxMpErrorMsg,并提供方法,方便根据错误代码查询错误信息内容

* #555 修复微信支付服务商模式支付验证签名失败的问题

* #521 微信支付回调通知类WxPayOrderNotifyResult增加version参数

* #583 企业微信新增人员接口新增字段to_invite

* #583 企业微信通讯录管理增加邀请成员接口

* #587 企业微信几个接口增加个人二维码字段

* 修复字符

* 修复单元测试

* 发布3.0.6.BETA测试版本

* 重构WxError相关代码,自动根据代码补充错误中文说明

* 优化微信支付代码

* #584 修复企业付款queryEntPay签名失败问题

* #591 文件上传接口不自动关闭inputStream,由调用方自己控制

* #595 优化WxPayException

* 发布3.0.7.BETA测试版本

* 更新pom

* 优化代码

* #615 公众号客服消息添加 "发送小程序卡片" 类型

* 优化XStreamTransformer

* 微信支付模块jodd-http修改scope

* 发布3.0.8.BETA测试版本

* #623 群发接口增加clientmsgid

* add author for some files

* clean code

* 重构规范RequestExecuter代码

* #532 实现微信AI开放接口的三个接口:语音上传、查询识别结果和微信翻译功能

* 发布3.0.9.BETA测试版本

* #516 增加获取Wi-Fi门店列表接口

* #629 修复WxPayOrderNotifyResult解析xml报错问题

* #639 修复小程序代码模版库管理 access_token key 错误

* 发布3.1.0正式版本
This commit is contained in:
Binary Wang
2018-06-22 23:29:17 +08:00
committed by GitHub
parent 2d84939be0
commit 9d66d582db
304 changed files with 6960 additions and 1452 deletions

View File

@@ -12,7 +12,7 @@ import org.testng.annotations.*;
*/
public class WxPayOrderNotifyResultTest {
@Test
public void testFromXML() throws Exception {
public void testFromXML() {
String xmlString = "<xml>\n" +
" <appid><![CDATA[wx2421b1c4370ec43b]]></appid>\n" +
" <attach><![CDATA[支付测试]]></attach>\n" +
@@ -32,12 +32,12 @@ public class WxPayOrderNotifyResultTest {
" <trade_type><![CDATA[JSAPI]]></trade_type>\n" +
" <transaction_id><![CDATA[1004400740201409030005092168]]></transaction_id>\n" +
" <coupon_count>2</coupon_count>\n" +
" <coupon_type_0><![CDATA[CASH]]></coupon_type_0>\n" +
" <coupon_id_0>10000</coupon_id_0>\n" +
" <coupon_fee_0>100</coupon_fee_0>\n" +
" <coupon_type_1><![CDATA[NO_CASH]]></coupon_type_1>\n" +
" <coupon_id_1>10001</coupon_id_1>\n" +
" <coupon_fee_1>200</coupon_fee_1>\n" +
" <coupon_type_0><![CDATA[CASH]]></coupon_type_0>\n" +
" <coupon_id_0>10000</coupon_id_0>\n" +
" <coupon_fee_0>100</coupon_fee_0>\n" +
"</xml>";
WxPayOrderNotifyResult result = WxPayOrderNotifyResult.fromXML(xmlString);

View File

@@ -0,0 +1,51 @@
package com.github.binarywang.wxpay.bean.result;
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
* <pre>
* Created by BinaryWang on 2018/4/22.
* </pre>
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
public class WxPayRefundResultTest {
@Test
public void testComposeRefundCoupons() {
/*
该xml字符串来自于官方文档示例稍加改造加上代金卷
refund_channel 是个什么鬼,官方文档只字不提
*/
String xmlString = "<xml>\n" +
" <return_code><![CDATA[SUCCESS]]></return_code>\n" +
" <return_msg><![CDATA[OK]]></return_msg>\n" +
" <appid><![CDATA[wx2421b1c4370ec43b]]></appid>\n" +
" <mch_id><![CDATA[10000100]]></mch_id>\n" +
" <nonce_str><![CDATA[NfsMFbUFpdbEhPXP]]></nonce_str>\n" +
" <sign><![CDATA[B7274EB9F8925EB93100DD2085FA56C0]]></sign>\n" +
" <result_code><![CDATA[SUCCESS]]></result_code>\n" +
" <transaction_id><![CDATA[1008450740201411110005820873]]></transaction_id>\n" +
" <out_trade_no><![CDATA[1415757673]]></out_trade_no>\n" +
" <out_refund_no><![CDATA[1415701182]]></out_refund_no>\n" +
" <refund_id><![CDATA[2008450740201411110000174436]]></refund_id>\n" +
" <refund_channel><![CDATA[]]></refund_channel>\n" +
" <coupon_refund_fee>1</coupon_refund_fee>\n" +
" <coupon_refund_count>1</coupon_refund_count>\n" +
" <coupon_refund_id_0>123</coupon_refund_id_0>\n" +
" <coupon_refund_fee_0>1</coupon_refund_fee_0>\n" +
" <coupon_type_0><![CDATA[CASH]]></coupon_type_0>\n" +
" <refund_fee>2</refund_fee> \n" +
"</xml>";
WxPayRefundResult result = WxPayRefundResult.fromXML(xmlString, WxPayRefundResult.class);
result.composeRefundCoupons();
assertThat(result.getRefundCoupons()).isNotEmpty();
assertThat(result.getRefundCoupons().get(0).getCouponRefundId()).isEqualTo("123");
assertThat(result.getRefundCoupons().get(0).getCouponType()).isEqualTo("CASH");
assertThat(result.getRefundCoupons().get(0).getCouponRefundFee()).isEqualTo(1);
}
}

View File

@@ -230,6 +230,10 @@ public class BaseWxPayServiceImplTest {
request.setActName("abc");
request.setClientIp("aaa");
request.setMchBillNo("aaaa");
request.setWishing("what");
request.setSendName("111");
request.setTotalAmount(1);
request.setTotalNum(1);
request.setReOpenid(((XmlWxPayConfig) this.payService.getConfig()).getOpenid());
WxPaySendRedpackResult redpackResult = this.payService.sendRedpack(request);
this.logger.info(redpackResult.toString());

View File

@@ -1,5 +1,11 @@
package com.github.binarywang.wxpay.testbase;
import java.io.IOException;
import java.io.InputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.github.binarywang.wxpay.config.WxPayConfig;
import com.github.binarywang.wxpay.service.WxPayService;
import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
@@ -8,17 +14,15 @@ import com.google.inject.Module;
import com.thoughtworks.xstream.XStream;
import me.chanjar.weixin.common.util.xml.XStreamInitializer;
import java.io.IOException;
import java.io.InputStream;
public class ApiTestModule implements Module {
private final Logger log = LoggerFactory.getLogger(this.getClass());
private static final String TEST_CONFIG_XML = "test-config.xml";
@Override
public void configure(Binder binder) {
try (InputStream inputStream = ClassLoader.getSystemResourceAsStream(TEST_CONFIG_XML)) {
if (inputStream == null) {
throw new RuntimeException("测试配置文件【" + TEST_CONFIG_XML + "】未找到");
throw new RuntimeException("测试配置文件【" + TEST_CONFIG_XML + "】未找到请参照test-config-sample.xml文件生成");
}
XmlWxPayConfig config = this.fromXml(XmlWxPayConfig.class, inputStream);
@@ -28,8 +32,9 @@ public class ApiTestModule implements Module {
binder.bind(WxPayService.class).toInstance(wxService);
binder.bind(WxPayConfig.class).toInstance(config);
} catch (IOException e) {
e.printStackTrace();
this.log.error(e.getMessage(), e);
}
}
@SuppressWarnings("unchecked")

View File

@@ -16,9 +16,9 @@ public class XmlWxPayConfig extends WxPayConfig {
}
@Override
public boolean useSandbox() {
public boolean isUseSandboxEnv() {
//沙箱环境不成熟,有问题无法使用,暂时屏蔽掉
// return true;
//return true;
return false;
}
}