Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
c7395e4a74
5
pom.xml
5
pom.xml
@ -260,6 +260,11 @@
|
||||
</profiles>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk16</artifactId>
|
||||
<version>1.46</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
||||
@ -74,7 +74,13 @@
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk16</artifactId>
|
||||
<version>1.46</version>
|
||||
</dependency>
|
||||
<!-- 兼容 JDK 9+ 后的maven环境编译 -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.2.11</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -68,6 +68,10 @@ public class XmlResult implements Serializable {
|
||||
return resultCode;
|
||||
}
|
||||
|
||||
public void setReturnCode(String returnCode) {
|
||||
this.returnCode = returnCode;
|
||||
}
|
||||
|
||||
public String getErrCode() {
|
||||
return errCode;
|
||||
}
|
||||
@ -84,6 +88,10 @@ public class XmlResult implements Serializable {
|
||||
return returnMsg;
|
||||
}
|
||||
|
||||
public void setReturnMsg(String returnMsg) {
|
||||
this.returnMsg = returnMsg;
|
||||
}
|
||||
|
||||
public void setResultCode(String resultCode) {
|
||||
this.resultCode = resultCode;
|
||||
}
|
||||
|
||||
@ -15,23 +15,41 @@ package com.foxinmy.weixin4j.jssdk;
|
||||
* 企业号JSSDK</a>
|
||||
*/
|
||||
public enum JSSDKAPI {
|
||||
/**
|
||||
* <a href=
|
||||
* "https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html#111">
|
||||
* 自定义“分享给朋友”及“分享到QQ”按钮的分享内容(1.4.0)</a>
|
||||
*/
|
||||
updateAppMessageShareData,
|
||||
/**
|
||||
* <a href=
|
||||
* "https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html#112">
|
||||
* 自定义“分享给朋友”及“分享到QQ”按钮的分享内容(1.4.0)</a>
|
||||
*/
|
||||
updateTimelineShareData,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.8E.B7.E5.8F.96.E2.80.9C.E5.88.86.E4.BA.AB.E5.88.B0.E6.9C.8B.E5.8F.8B.E5.9C.88.E2.80.9D.E6.8C.89.E9.92.AE.E7.82.B9.E5.87.BB.E7.8A.B6.E6.80.81.E5.8F.8A.E8.87.AA.E5.AE.9A.E4.B9.89.E5.88.86.E4.BA.AB.E5.86.85.E5.AE.B9.E6.8E.A5.E5.8F.A3"
|
||||
* >分享接口-获取“分享到朋友圈”按钮点击状态及自定义分享内容接口</a>
|
||||
* >分享接口-获取“分享到朋友圈”按钮点击状态及自定义分享内容接口(即将废弃)</a>
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
onMenuShareTimeline,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.8E.B7.E5.8F.96.E2.80.9C.E5.88.86.E4.BA.AB.E7.BB.99.E6.9C.8B.E5.8F.8B.E2.80.9D.E6.8C.89.E9.92.AE.E7.82.B9.E5.87.BB.E7.8A.B6.E6.80.81.E5.8F.8A.E8.87.AA.E5.AE.9A.E4.B9.89.E5.88.86.E4.BA.AB.E5.86.85.E5.AE.B9.E6.8E.A5.E5.8F.A3"
|
||||
* >分享接口-获取“分享给朋友”按钮点击状态及自定义分享内容接口</a>
|
||||
* >分享接口-获取“分享给朋友”按钮点击状态及自定义分享内容接口(即将废弃)</a>
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
onMenuShareAppMessage,
|
||||
/***
|
||||
* <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E8.8E.B7.E5.8F.96.E2.80.9C.E5.88.86.E4.BA.AB.E5.88.B0QQ.E2.80.9D.E6.8C.89.E9.92.AE.E7.82.B9.E5.87.BB.E7.8A.B6.E6.80.81.E5.8F.8A.E8.87.AA.E5.AE.9A.E4.B9.89.E5.88.86.E4.BA.AB.E5.86.85.E5.AE.B9.E6.8E.A5.E5.8F.A3"
|
||||
* >分享接口-获取“分享到QQ”按钮点击状态及自定义分享内容接口</a>
|
||||
* >分享接口-获取“分享到QQ”按钮点击状态及自定义分享内容接口(即将废弃)</a>
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
onMenuShareQQ,
|
||||
/***
|
||||
* <a href=
|
||||
@ -270,8 +288,12 @@ public enum JSSDKAPI {
|
||||
/**
|
||||
* 分享接口集合
|
||||
*/
|
||||
@Deprecated
|
||||
public final static JSSDKAPI[] SHARE_APIS = { onMenuShareTimeline, onMenuShareAppMessage, onMenuShareQQ,
|
||||
onMenuShareWeibo, onMenuShareQZone };
|
||||
|
||||
public final static JSSDKAPI[] ALL_SHARE_APIS = { updateAppMessageShareData, updateTimelineShareData,
|
||||
onMenuShareWeibo, onMenuShareQZone };
|
||||
/**
|
||||
* 图像接口集合
|
||||
*/
|
||||
|
||||
@ -8,7 +8,6 @@ package com.foxinmy.weixin4j.type.mch;
|
||||
* @date 2015年4月1日
|
||||
* @since JDK 1.6
|
||||
* @see
|
||||
* @deprecated 迁移到子模块weixin4j-pay
|
||||
*/
|
||||
@Deprecated
|
||||
public enum CorpPaymentCheckNameType {
|
||||
|
||||
@ -49,6 +49,12 @@
|
||||
<artifactId>weixin4j-mp</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<!-- 微信支付商户平台 -->
|
||||
<dependency>
|
||||
<groupId>com.foxinmy</groupId>
|
||||
<artifactId>weixin4j-pay</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- 微信企业号 -->
|
||||
<dependency>
|
||||
<groupId>com.foxinmy</groupId>
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
<!-- 微信接口代理~end -->
|
||||
|
||||
<!-- 微信支付接口代理~start -->
|
||||
<bean id="weixinPayProxy" class="com.foxinmy.weixin4j.payment.WeixinPayProxy">
|
||||
<bean id="weixinPayProxy" class="com.foxinmy.weixin4j.pay.WeixinPayProxy">
|
||||
<constructor-arg>
|
||||
<!-- 商户信息:不声明则默认使用weixin4j.properties配置的weixin4j.account字段 -->
|
||||
<bean class="com.foxinmy.weixin4j.model.WeixinPayAccount">
|
||||
|
||||
@ -25,6 +25,13 @@
|
||||
<artifactId>weixin4j-base</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<!-- 兼容 JDK 9+ 后的maven环境编译 -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.2.11</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<name>weixin4j-pay</name>
|
||||
<artifactId>weixin4j-pay</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<version>1.1.0</version>
|
||||
<url>https://github.com/foxinmy/weixin4j/tree/master/weixin4j-pay</url>
|
||||
<description>微信支付商户平台API</description>
|
||||
<developers>
|
||||
@ -39,6 +39,13 @@
|
||||
<artifactId>weixin4j-base</artifactId>
|
||||
<version>1.9.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- 兼容 JDK 9+ 后的maven环境编译 -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.2.11</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
||||
@ -0,0 +1,246 @@
|
||||
package com.foxinmy.weixin4j.pay;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.foxinmy.weixin4j.pay.payment.mch.MchPayPackage;
|
||||
import com.foxinmy.weixin4j.pay.payment.mch.SceneInfo;
|
||||
import com.foxinmy.weixin4j.pay.payment.mch.SceneInfoApp;
|
||||
import com.foxinmy.weixin4j.pay.payment.mch.SceneInfoStore;
|
||||
import com.foxinmy.weixin4j.pay.type.TradeType;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* MchPayPackage生成器
|
||||
*
|
||||
* 微信支付中很多新增的支付产品或功能不定期的在原来各种支付API中添加参数项,导致MchPayPackage类会不断更新
|
||||
* MchPayPackage构造方法参数会越来越多,不断增加的参数项也不好继续改构造方法。
|
||||
* PayApi中一些特定的支付api(如JSAPI、MACROPAY)等都是直接传入参数,然后在API内构造MchPayPackage,而不是传入MchPayPackage,
|
||||
* 一旦增加新参数就需要改API,影响正在使用SDK的工程,但如果改为直接使用MchPayPackag的createPayRequest方法,
|
||||
* MchPayPackage的构造方式又太难看,开发者需要对着微信文档然后看着构造函数里边一大堆的参数一一匹配
|
||||
* 所以最终有了PayPackageBuilder这个类,通过一些链式的API构造MchPayPackage,既提供最小参数的各种支付构造方法,又能让代码看上去直观一些
|
||||
*
|
||||
* @author kit (kit.li@qq.com)
|
||||
* @date 2020年06月02日
|
||||
*/
|
||||
public class PayPackageBuilder {
|
||||
private static final String Y = "Y";
|
||||
private MchPayPackage mchPayPackage;
|
||||
|
||||
private PayPackageBuilder(){
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用MchPayPackage初始化
|
||||
*
|
||||
* @param payPackage
|
||||
* @return
|
||||
*/
|
||||
public static PayPackageBuilder init(MchPayPackage payPackage){
|
||||
PayPackageBuilder instance = new PayPackageBuilder();
|
||||
instance.mchPayPackage = payPackage;
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 付款码支付/人脸支付
|
||||
*
|
||||
* @param body
|
||||
* 商品描述
|
||||
* @param outTradeNo
|
||||
* 商户订单号
|
||||
* @param totalFee
|
||||
* 支付金额
|
||||
* @param createIp
|
||||
* 终端IP
|
||||
* @param authCode
|
||||
* 用户付款码
|
||||
* @return
|
||||
*/
|
||||
public static PayPackageBuilder microPay(String body, String outTradeNo, double totalFee, String createIp,
|
||||
String authCode){
|
||||
PayPackageBuilder instance = new PayPackageBuilder();
|
||||
instance.mchPayPackage = new MchPayPackage(body, outTradeNo, totalFee, null, createIp, TradeType.MICROPAY,
|
||||
null, authCode, null, null);
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* JSAPI支付/小程序支付
|
||||
*
|
||||
* @param body
|
||||
* 商品描述
|
||||
* @param outTradeNo
|
||||
* 商户订单号
|
||||
* @param totalFee
|
||||
* 支付金额
|
||||
* @param createIp
|
||||
* 终端IP
|
||||
* @param notifyUrl
|
||||
* 回调通知地址
|
||||
* @param openid
|
||||
* 用户标识
|
||||
* @return
|
||||
*/
|
||||
public static PayPackageBuilder jsapiPay(String body, String outTradeNo, double totalFee, String createIp,
|
||||
String notifyUrl, String openid){
|
||||
PayPackageBuilder instance = new PayPackageBuilder();
|
||||
instance.mchPayPackage = new MchPayPackage(body, outTradeNo, totalFee, notifyUrl, createIp, TradeType.JSAPI,
|
||||
openid, null, null, null);
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* native支付
|
||||
*
|
||||
* @param body
|
||||
* 商品描述
|
||||
* @param outTradeNo
|
||||
* 商户订单号
|
||||
* @param totalFee
|
||||
* 支付金额
|
||||
* @param createIp
|
||||
* 终端IP
|
||||
* @param notifyUrl
|
||||
* 回调通知地址
|
||||
* @param productId
|
||||
* 产品ID
|
||||
* @return
|
||||
*/
|
||||
public static PayPackageBuilder nativePay(String body, String outTradeNo, double totalFee, String createIp,
|
||||
String notifyUrl, String productId){
|
||||
PayPackageBuilder instance = new PayPackageBuilder();
|
||||
instance.mchPayPackage = new MchPayPackage(body, outTradeNo, totalFee, notifyUrl, createIp, TradeType.NATIVE,
|
||||
null, null, productId, null);
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* APP支付
|
||||
*
|
||||
* @param body
|
||||
* 商品描述
|
||||
* @param outTradeNo
|
||||
* 商户订单号
|
||||
* @param totalFee
|
||||
* 支付金额
|
||||
* @param createIp
|
||||
* 终端IP
|
||||
* @param notifyUrl
|
||||
* 回调通知地址
|
||||
* @return
|
||||
*/
|
||||
public static PayPackageBuilder appPay(String body, String outTradeNo, double totalFee, String createIp, String notifyUrl){
|
||||
PayPackageBuilder instance = new PayPackageBuilder();
|
||||
instance.mchPayPackage = new MchPayPackage(body, outTradeNo, totalFee, notifyUrl, createIp, TradeType.APP,
|
||||
null, null, null, null);
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* H5支付
|
||||
*
|
||||
* @param body
|
||||
* 商品描述
|
||||
* @param outTradeNo
|
||||
* 商户订单号
|
||||
* @param totalFee
|
||||
* 支付金额
|
||||
* @param createIp
|
||||
* 终端IP
|
||||
* @param notifyUrl
|
||||
* 回调通知地址
|
||||
* @param wapUrl
|
||||
* wap网站URL地址
|
||||
* @param wapName
|
||||
* wap网站名
|
||||
* @return
|
||||
*/
|
||||
public static PayPackageBuilder h5Pay(String body, String outTradeNo, double totalFee, String createIp,
|
||||
String notifyUrl, String wapUrl, String wapName){
|
||||
PayPackageBuilder instance = new PayPackageBuilder();
|
||||
instance.mchPayPackage = new MchPayPackage(body, outTradeNo, totalFee, notifyUrl, createIp, TradeType.APP,
|
||||
null, null, null, null);
|
||||
SceneInfoApp app = SceneInfoApp.createWapAPP(wapName, wapUrl);
|
||||
instance.mchPayPackage.setSceneInfo(String.format("{\"h5_info\":\"%s\"}", app.getSceneInfo()));
|
||||
return instance;
|
||||
}
|
||||
|
||||
public PayPackageBuilder detail(String detail){
|
||||
this.mchPayPackage.setDetail(detail);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PayPackageBuilder attach(String attach){
|
||||
this.mchPayPackage.setAttach(attach);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PayPackageBuilder goodsTag(String goodsTag){
|
||||
this.mchPayPackage.setGoodsTag(goodsTag);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PayPackageBuilder limitPay(){
|
||||
this.mchPayPackage.setLimitPay("no_credit");
|
||||
return this;
|
||||
}
|
||||
|
||||
public PayPackageBuilder timeStart(Date date){
|
||||
this.mchPayPackage.setTimeStart(date);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PayPackageBuilder timeStart(String date){
|
||||
this.mchPayPackage.setTimeStart(date);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PayPackageBuilder timeExpire(Date date){
|
||||
this.mchPayPackage.setTimeExpire(date);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PayPackageBuilder timeExpire(String date){
|
||||
this.mchPayPackage.setTimeExpire(date);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PayPackageBuilder receipt(){
|
||||
this.mchPayPackage.setReceipt(Y);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PayPackageBuilder sceneInfo(SceneInfo info){
|
||||
this.mchPayPackage.setSceneInfo(info.toJson());
|
||||
return this;
|
||||
}
|
||||
|
||||
public PayPackageBuilder deposit(){
|
||||
this.mchPayPackage.setDeposit(Y);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PayPackageBuilder profitSharing(){
|
||||
this.mchPayPackage.setProfitSharing(Y);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PayPackageBuilder subOpenId(String subOpenId){
|
||||
this.mchPayPackage.setSubOpenId(subOpenId);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PayPackageBuilder totalFee(double totalFee){
|
||||
this.mchPayPackage.setTotalFee(totalFee);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PayPackageBuilder totalFee(int totalFee){
|
||||
this.mchPayPackage.setTotalFee(totalFee);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MchPayPackage build(){
|
||||
return this.mchPayPackage;
|
||||
}
|
||||
}
|
||||
@ -1,47 +1,30 @@
|
||||
支付模块【JSAPI】【NATIVE】【MICROPAY】
|
||||
|
||||
微信公众平台[V2版本支付](https://mp.weixin.qq.com/paymch/readtemplate?t=mp/business/course2_tmpl&lang=zh_CN)文档
|
||||
目前只支持商户平台v2版本的支付API
|
||||
|
||||
微信公众平台[V3版本支付](https://mp.weixin.qq.com/paymch/readtemplate?t=mp/business/course3_tmpl&lang=zh_CN)文档
|
||||
|
||||
**在`2014年10月9号`之前申请并审核通过的支付接口应该属于`V2版本`支付,而之后申请的接口则为`V3版本(商户平台)`支付**
|
||||
**V3版在计划中,但目前因V3版针对的电商平台、微信支付分两类商户目前都是邀请制的,所以具体什么时候开展还未知。有能力的朋友可以帮忙贡献代码**
|
||||
|
||||
|
||||
[WeixinPayProxy](WeixinPayProxy.java)
|
||||
[WeixinPayProxy](https://github.com/foxinmy/weixin4j/blob/master/weixin4j-pay/src/main/java/com/foxinmy/weixin4j/pay/WeixinPayProxy.java)
|
||||
-------------------------
|
||||
|
||||
* createPayJsRequestJson: 创建V3版本(商户平台)的JSAPI支付串
|
||||
|
||||
* createNativePayRequestURL: 创建V3版本(商户平台)的扫码支付链接
|
||||
|
||||
* createPrePay: 调用V3版本(商户平台)的统一订单接口生成预订单数据
|
||||
|
||||
* createMicroPay: 创建刷卡支付(商户平台)请求
|
||||
|
||||
* orderQuery: 订单查询接口
|
||||
|
||||
* refundOrder: 退款申请接口
|
||||
|
||||
* reverseOrder: 冲正订单接口
|
||||
|
||||
* closeOrder: 关闭订单接口
|
||||
|
||||
* downloadBill: 下载对账单接口
|
||||
|
||||
* refundQuery: 退款查询接口
|
||||
这是所有支付平台所有API的代理类,入参是一个WeixinPayAccount,建议调用API都通过代理类去调用,会相对简单些。
|
||||
|
||||
|
||||
[Pay2Api](https://github.com/foxinmy/weixin4j/blob/master/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/api/Pay2Api.java)
|
||||
|
||||
[PayApi](https://github.com/foxinmy/weixin4j/blob/master/weixin4j-pay/src/main/java/com/foxinmy/weixin4j/pay/api/PayApi.java)
|
||||
-------------------------
|
||||
微信支付API
|
||||
|
||||
* createPayJsRequestJson: 创建V2版本的JSAPI支付串
|
||||
[CashApi](https://github.com/foxinmy/weixin4j/blob/master/weixin4j-pay/src/main/java/com/foxinmy/weixin4j/pay/api/CashApi.java)
|
||||
-------------------------
|
||||
微信现金红包API
|
||||
|
||||
* createNativePayRequestURL: 创建V2版本的扫码支付链接
|
||||
[CouponApi](https://github.com/foxinmy/weixin4j/blob/master/weixin4j-pay/src/main/java/com/foxinmy/weixin4j/pay/api/CouponApi.java)
|
||||
-------------------------
|
||||
微信代金券API
|
||||
|
||||
* orderQuery: 订单查询接口
|
||||
[ProfitSharingApi](https://github.com/foxinmy/weixin4j/blob/master/weixin4j-pay/src/main/java/com/foxinmy/weixin4j/pay/api/ProfitSharingApi.java)
|
||||
-------------------------
|
||||
微信分帐API
|
||||
|
||||
* refundOrder: 退款申请接口
|
||||
|
||||
* downloadBill: 下载对账单接口
|
||||
|
||||
* refundQuery: 退款查询接口
|
||||
|
||||
@ -10,10 +10,12 @@ import com.foxinmy.weixin4j.pay.payment.coupon.*;
|
||||
import com.foxinmy.weixin4j.pay.payment.face.PayfaceAuthinfo;
|
||||
import com.foxinmy.weixin4j.pay.payment.face.PayfaceAuthinfoRequest;
|
||||
import com.foxinmy.weixin4j.pay.payment.mch.*;
|
||||
import com.foxinmy.weixin4j.pay.profitsharing.*;
|
||||
import com.foxinmy.weixin4j.pay.sign.WeixinSignature;
|
||||
import com.foxinmy.weixin4j.pay.type.*;
|
||||
import com.foxinmy.weixin4j.pay.type.mch.BillType;
|
||||
import com.foxinmy.weixin4j.pay.type.mch.RefundAccountType;
|
||||
import com.foxinmy.weixin4j.pay.type.profitsharing.ReturnAccountType;
|
||||
import com.foxinmy.weixin4j.util.Consts;
|
||||
import com.foxinmy.weixin4j.util.Weixin4jConfigUtil;
|
||||
|
||||
@ -53,6 +55,10 @@ public class WeixinPayProxy {
|
||||
* 商户信息
|
||||
*/
|
||||
private final WeixinPayAccount weixinPayAccount;
|
||||
/**
|
||||
* 分帐接口
|
||||
*/
|
||||
private final ProfitSharingApi profitSharingApi;
|
||||
|
||||
/**
|
||||
* 微信支付接口实现(使用weixin4j.properties配置的account商户信息)
|
||||
@ -78,6 +84,7 @@ public class WeixinPayProxy {
|
||||
this.couponApi = new CouponApi(weixinPayAccount);
|
||||
this.cashApi = new CashApi(weixinPayAccount);
|
||||
this.customsApi = new CustomsApi(weixinPayAccount);
|
||||
this.profitSharingApi = new ProfitSharingApi(weixinPayAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -272,7 +279,7 @@ public class WeixinPayProxy {
|
||||
* @param attach
|
||||
* 附加数据 非必填
|
||||
* @param store
|
||||
* 门店信息 非必填
|
||||
* APP支付已无门店信息,不需要再传
|
||||
* @return APP支付对象
|
||||
* @see PayApi
|
||||
* @see SceneInfoStore
|
||||
@ -359,41 +366,9 @@ public class WeixinPayProxy {
|
||||
totalFee, createIp, attach, store);
|
||||
}
|
||||
|
||||
/**
|
||||
* 旧版刷脸支付接口
|
||||
*
|
||||
* @param faceCode
|
||||
* 人脸凭证
|
||||
* @param body
|
||||
* 商品或支付单简要描述,格式要求:门店品牌名-城市分店名-实际商品名称
|
||||
* @param outTradeNo
|
||||
* 商户系统内部的订单号,32个字符内、可包含字母;更换授权码必须要换新的商户订单号
|
||||
* @param totalFee
|
||||
* 订单总金额,单位元
|
||||
* @param createIp
|
||||
* 调用微信支付API的机器IP
|
||||
* @param openId
|
||||
* 用户在商户appid 下的唯一标识
|
||||
* @param attach
|
||||
* 附加数据,在查询API和支付通知中原样返回,该字段主要用于商户携带订单的自定义数据
|
||||
* @return
|
||||
* @throws WeixinException
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/wxfacepay/develop/backend.html#刷脸支付后端接口">
|
||||
* 刷脸支付后端接口</a>
|
||||
* @see <a href=
|
||||
* "https://pay.weixin.qq.com/wiki/doc/wxfacepay/develop/sdk-android.html#人脸支付凭证-getwxpayfacecode"
|
||||
* 获取人脸支付凭证</a>
|
||||
*/
|
||||
public MchPayRequest createFacePayRequest(String faceCode, String body,
|
||||
String outTradeNo, double totalFee, String createIp, String openId,
|
||||
String attach) throws WeixinException {
|
||||
return payApi.createFacePayRequest(faceCode, body, outTradeNo,
|
||||
totalFee, createIp, openId, attach);
|
||||
}
|
||||
|
||||
/**
|
||||
* 押金支付请求
|
||||
* 注意:(此功能微信已下架,改为邀请开通,因此暂未使用)
|
||||
*
|
||||
* @param code
|
||||
* 授权码/人脸凭证
|
||||
@ -886,5 +861,142 @@ public class WeixinPayProxy {
|
||||
return payApi.getWxPayfaceAuthinfo(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加分账接收方
|
||||
* 服务商代子商户发起添加分账接收方请求,后续可通过发起分账请求将结算后的钱分到该分账接收方。
|
||||
*
|
||||
* @param receiver
|
||||
* 分帐接收方
|
||||
* @return
|
||||
* @throws WeixinException
|
||||
* @see Receiver
|
||||
* @see ReceiverResult
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/api/allocation_sl.php?chapter=25_3&index=4">添加分账接收方</a>
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*
|
||||
*/
|
||||
public ReceiverResult addProfitSharingReceiver(Receiver receiver) throws WeixinException {
|
||||
return profitSharingApi.addReceiver(receiver);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分账接收方
|
||||
* 商户发起删除分账接收方请求,删除后不支持将结算后的钱分到该分账接收方。
|
||||
*
|
||||
* @param receiver
|
||||
* 分帐接收方
|
||||
* @return
|
||||
* @throws WeixinException
|
||||
* @see Receiver
|
||||
* @see ReceiverResult
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_4&index=5">删除分账接收方</a>
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public ReceiverResult removeProfitSharingReceiver(Receiver receiver) throws WeixinException {
|
||||
return profitSharingApi.removeReceiver(receiver);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求分帐
|
||||
*
|
||||
* @param transactionId
|
||||
* 微信订单号
|
||||
* @param outOrderNo
|
||||
* 商户分帐单号
|
||||
* @param receivers
|
||||
* 分帐接收方列表
|
||||
* @param multi
|
||||
* 是否多次分帐,默认为单次分帐,即调用分帐成功后马上解冻剩余金额给商户,不需要完结分帐。多次分帐可多次调用分帐API,需调完结分帐结束分帐
|
||||
* @return
|
||||
* @throws WeixinException
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_1&index=1">请求单次分帐</a>
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public ProfitSharingResult profitSharing(String transactionId, String outOrderNo, List<ReceiverProfit> receivers,
|
||||
Boolean multi) throws WeixinException{
|
||||
return profitSharingApi.profitSharing(transactionId, outOrderNo, receivers, multi);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分帐查询
|
||||
*
|
||||
* @param transactionId
|
||||
* 微信订单号
|
||||
* @param outOrderNo
|
||||
* 商户分帐单号
|
||||
* @return
|
||||
* @throws WeixinException
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_2&index=3">分帐查询</a>
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public ProfitSharingResult profitSharingQuery(String transactionId, String outOrderNo) throws WeixinException{
|
||||
return profitSharingApi.profitSharingQuery(transactionId, outOrderNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 完结分账
|
||||
* 1、不需要进行分账的订单,可直接调用本接口将订单的金额全部解冻给本商户
|
||||
* 2、调用多次分账接口后,需要解冻剩余资金时,调用本接口将剩余的分账金额全部解冻给特约商户
|
||||
* 3、已调用请求单次分账后,剩余待分账金额为零,不需要再调用此接口。
|
||||
*
|
||||
* @param transactionId
|
||||
* 微信订单号
|
||||
* @param outOrderNo
|
||||
* 商户分帐单号
|
||||
* @param description
|
||||
* 分帐完结描述
|
||||
* @return
|
||||
* @throws WeixinException
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_5&index=6">完结分账</a>
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public ProfitSharingResult profitSharingFinish(String transactionId, String outOrderNo, String description)
|
||||
throws WeixinException{
|
||||
return profitSharingApi.profitSharingFinish(transactionId, outOrderNo, description);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分账回退
|
||||
*
|
||||
* @param id
|
||||
* 分帐单号
|
||||
* @param outReturnNo
|
||||
* 商户回退单号
|
||||
* @param returnAccountType
|
||||
* 回退方类型
|
||||
* @param returnAccount
|
||||
* 回退方账号
|
||||
* @param description
|
||||
* 回退描述
|
||||
* @return
|
||||
* @throws WeixinException
|
||||
* @see ProfitSharingReturnRequest
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_7&index=7">分账回退</a>
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public ProfitSharingReturnResult profitSharingReturn(ProfitId id, String outReturnNo,
|
||||
ReturnAccountType returnAccountType, String returnAccount,
|
||||
int returnAmount, String description)
|
||||
throws WeixinException{
|
||||
return profitSharingApi.profitSharingReturn(id, outReturnNo, returnAccountType, returnAccount, returnAmount,
|
||||
description);
|
||||
}
|
||||
|
||||
/**
|
||||
* 回退结果查询
|
||||
*
|
||||
* @param id
|
||||
* 分帐单号
|
||||
* @param outReturnNo
|
||||
* 商户回退单号
|
||||
* @return
|
||||
* @throws WeixinException
|
||||
* @see ProfitSharingReturnRequest
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_8&index=8">回退结果查询</a>
|
||||
*/
|
||||
public ProfitSharingReturnResult profitSharingReturnQuery(ProfitId id, String outReturnNo) throws WeixinException{
|
||||
return profitSharingApi.profitSharingReturnQuery(id, outReturnNo);
|
||||
}
|
||||
|
||||
public final static String VERSION = Consts.VERSION;
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ public class MchApi extends BaseApi {
|
||||
private final static String PEM_CERT_PREFIX = "-----BEGIN CERTIFICATE-----";
|
||||
|
||||
static {
|
||||
WEIXIN_BUNDLE = ResourceBundle.getBundle("com/foxinmy/weixin4j/payment/weixin");
|
||||
WEIXIN_BUNDLE = ResourceBundle.getBundle("com/foxinmy/weixin4j/pay/weixin");
|
||||
}
|
||||
|
||||
protected final WeixinPayAccount weixinAccount;
|
||||
|
||||
@ -10,7 +10,6 @@ import com.foxinmy.weixin4j.pay.payment.face.PayfaceAuthinfo;
|
||||
import com.foxinmy.weixin4j.pay.payment.face.PayfaceAuthinfoRequest;
|
||||
import com.foxinmy.weixin4j.pay.payment.mch.*;
|
||||
import com.foxinmy.weixin4j.pay.type.mch.BillType;
|
||||
import com.foxinmy.weixin4j.pay.type.mch.DepositType;
|
||||
import com.foxinmy.weixin4j.pay.type.mch.RefundAccountType;
|
||||
import com.foxinmy.weixin4j.pay.type.*;
|
||||
import com.foxinmy.weixin4j.util.*;
|
||||
@ -34,6 +33,8 @@ import java.util.Map;
|
||||
*/
|
||||
public class PayApi extends MchApi {
|
||||
|
||||
private final static String Y = "Y";
|
||||
|
||||
public PayApi(WeixinPayAccount weixinAccount) {
|
||||
super(weixinAccount);
|
||||
}
|
||||
@ -88,14 +89,14 @@ public class PayApi extends MchApi {
|
||||
null, payPackage.getCreateIp(), null, payPackage.getOpenId(),
|
||||
payPackage.getAuthCode(), null, payPackage.getAttach(),
|
||||
null, null, payPackage.getGoodsTag(),
|
||||
payPackage.getLimitPay(), payPackage.getSubAppId(), payPackage.getFaceCode(),
|
||||
payPackage.getDeposit());
|
||||
payPackage.getLimitPay(), payPackage.getSubAppId(), payPackage.getReceipt(),
|
||||
payPackage.getDeposit(), payPackage.getProfitSharing());
|
||||
// 默认为MD5签名
|
||||
SignType signType= SignType.MD5;
|
||||
super.declareMerchant(_payPackage);
|
||||
// 默认为刷卡支付(付款码支付)的API地址
|
||||
String url = getRequestUri("micropay_uri");
|
||||
if(payPackage.getDeposit()==DepositType.Y){
|
||||
if(Y.equals(payPackage.getDeposit())){
|
||||
// 押金支付只支持HMAC-SHA256签名
|
||||
signType = SignType.HMAC$SHA256;
|
||||
_payPackage.setSignType("HMAC-SHA256");
|
||||
@ -276,7 +277,7 @@ public class PayApi extends MchApi {
|
||||
* @param attach
|
||||
* 附加数据 非必填
|
||||
* @param store
|
||||
* 门店信息 非必填
|
||||
* APP支付已无门店信息,不需要再传
|
||||
* @return APP支付对象
|
||||
* @see SceneInfoStore
|
||||
* @see APPPayRequest
|
||||
@ -291,11 +292,6 @@ public class PayApi extends MchApi {
|
||||
MchPayPackage payPackage = new MchPayPackage(body, outTradeNo,
|
||||
totalFee, notifyUrl, createIp, TradeType.APP, null, null, null,
|
||||
attach);
|
||||
if (store != null) {
|
||||
payPackage.setSceneInfo(String.format(
|
||||
"{\"store_id\": \"%s\", \"store_name\":\"%s\"}",
|
||||
store.getId(), store.getName()));
|
||||
}
|
||||
return createPayRequest(payPackage);
|
||||
}
|
||||
|
||||
@ -332,8 +328,7 @@ public class PayApi extends MchApi {
|
||||
totalFee, notifyUrl, createIp, TradeType.MWEB, null, null,
|
||||
null, attach);
|
||||
if (app != null) {
|
||||
payPackage.setSceneInfo(String.format("{\"h5_info\":\"%s\"}",
|
||||
app.getSceneInfo()));
|
||||
payPackage.setSceneInfo(app.toJson());
|
||||
}
|
||||
return createPayRequest(payPackage);
|
||||
}
|
||||
@ -371,8 +366,7 @@ public class PayApi extends MchApi {
|
||||
totalFee, null, createIp, TradeType.MICROPAY, null, authCode,
|
||||
null, attach);
|
||||
if (store != null) {
|
||||
payPackage.setSceneInfo(String.format("{\"store_info\":\"%s\"}",
|
||||
JSON.toJSONString(store)));
|
||||
payPackage.setSceneInfo(store.toJson());
|
||||
}
|
||||
return createPayRequest(payPackage);
|
||||
}
|
||||
@ -769,28 +763,22 @@ public class PayApi extends MchApi {
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信旧版刷脸支付
|
||||
* 创建押金支付
|
||||
*
|
||||
* @param faceCode
|
||||
* @param code
|
||||
* @param body
|
||||
* @param outTradeNo
|
||||
* @param totalFee
|
||||
* @param createIp
|
||||
* @param openId
|
||||
* @param attach
|
||||
* @param store
|
||||
* @param isFacePay
|
||||
* @return
|
||||
* @throws WeixinException
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/api/deposit_sl.php?chapter=27_1&index=2">支付押金(付款码支付)</a>
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/api/deposit_sl.php?chapter=27_0&index=1">支付押金(人脸支付)</a>
|
||||
*/
|
||||
public MchPayRequest createFacePayRequest(String faceCode, String body,
|
||||
String outTradeNo, double totalFee, String createIp, String openId,
|
||||
String attach) throws WeixinException {
|
||||
MchPayPackage payPackage = new MchPayPackage(body, outTradeNo,
|
||||
totalFee, null, createIp, TradeType.FACEPAY, openId, null,
|
||||
null, attach);
|
||||
payPackage.setFaceCode(faceCode);
|
||||
return createPayRequest(payPackage);
|
||||
}
|
||||
|
||||
public MchPayRequest createDepositPayRequest(String code, String body, String outTradeNo, double totalFee,
|
||||
String createIp, String openId, String attach, SceneInfoStore store,
|
||||
boolean isFacePay) throws WeixinException {
|
||||
@ -798,16 +786,15 @@ public class PayApi extends MchApi {
|
||||
if(isFacePay) {
|
||||
payPackage = new MchPayPackage(body, outTradeNo, totalFee, null, createIp, TradeType.FACEPAY,
|
||||
openId, null, null, attach);
|
||||
payPackage.setFaceCode(code);
|
||||
payPackage.setDeposit(DepositType.Y);
|
||||
payPackage.setAuthCode(code);
|
||||
payPackage.setDeposit(Y);
|
||||
return createPayRequest(payPackage);
|
||||
}else{
|
||||
payPackage = new MchPayPackage(body, outTradeNo, totalFee, null, createIp, TradeType.MICROPAY,
|
||||
openId, code, null, attach);
|
||||
payPackage.setDeposit(DepositType.Y);
|
||||
payPackage.setDeposit(Y);
|
||||
if (store != null) {
|
||||
payPackage.setSceneInfo(String.format("{\"store_info\":\"%s\"}",
|
||||
JSON.toJSONString(store)));
|
||||
payPackage.setSceneInfo(store.toJson());
|
||||
}
|
||||
return createPayRequest(payPackage);
|
||||
}
|
||||
|
||||
@ -0,0 +1,216 @@
|
||||
package com.foxinmy.weixin4j.pay.api;
|
||||
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
import com.foxinmy.weixin4j.http.weixin.WeixinResponse;
|
||||
import com.foxinmy.weixin4j.pay.model.WeixinPayAccount;
|
||||
import com.foxinmy.weixin4j.pay.profitsharing.*;
|
||||
import com.foxinmy.weixin4j.pay.type.ProfitIdType;
|
||||
import com.foxinmy.weixin4j.pay.type.SignType;
|
||||
import com.foxinmy.weixin4j.pay.type.profitsharing.ReturnAccountType;
|
||||
import com.foxinmy.weixin4j.util.RandomUtil;
|
||||
import com.foxinmy.weixin4j.xml.XmlStream;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 微信商户平台分账接口(直连商户/服务商)
|
||||
*
|
||||
* @author kit (kit.li@qq.com)
|
||||
* @date 2020年05月20日
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public class ProfitSharingApi extends MchApi {
|
||||
|
||||
public ProfitSharingApi(WeixinPayAccount weixinAccount) {
|
||||
super(weixinAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加分账接收方
|
||||
* 服务商代子商户发起添加分账接收方请求,后续可通过发起分账请求将结算后的钱分到该分账接收方。
|
||||
*
|
||||
* @param receiver
|
||||
* 分帐接收方
|
||||
* @return
|
||||
* @see Receiver
|
||||
* @see ReceiverResult
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/api/allocation_sl.php?chapter=25_3&index=4">添加分账接收方</a>
|
||||
*
|
||||
*/
|
||||
public ReceiverResult addReceiver(Receiver receiver) throws WeixinException {
|
||||
ReceiverRequest receiverRequest = new ReceiverRequest(receiver);
|
||||
super.declareMerchant(receiverRequest);
|
||||
String url = getRequestUri("profit_sharing_add_receiver_uri");
|
||||
receiverRequest.setSign(weixinSignature.sign(receiverRequest, SignType.HMAC$SHA256));
|
||||
String para = XmlStream.toXML(receiverRequest);
|
||||
WeixinResponse response = weixinExecutor.post(url, para);
|
||||
return response.getAsObject(new TypeReference<ReceiverResult>(){});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分账接收方
|
||||
* 商户发起删除分账接收方请求,删除后不支持将结算后的钱分到该分账接收方。
|
||||
*
|
||||
* @param receiver
|
||||
* 分帐接收方
|
||||
* @return
|
||||
* @throws WeixinException
|
||||
* @see Receiver
|
||||
* @see ReceiverResult
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_4&index=5">删除分账接收方</a>
|
||||
*/
|
||||
public ReceiverResult removeReceiver(Receiver receiver) throws WeixinException {
|
||||
ReceiverRequest receiverRequest = new ReceiverRequest(receiver);
|
||||
super.declareMerchant(receiverRequest);
|
||||
String url = getRequestUri("profit_sharing_remove_receiver_uri");
|
||||
receiverRequest.setSign(weixinSignature.sign(receiverRequest, SignType.HMAC$SHA256));
|
||||
String para = XmlStream.toXML(receiverRequest);
|
||||
WeixinResponse response = weixinExecutor.post(url, para);
|
||||
return response.getAsObject(new TypeReference<ReceiverResult>(){});
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求分帐
|
||||
*
|
||||
* @param transactionId
|
||||
* 微信订单号
|
||||
* @param outOrderNo
|
||||
* 商户分帐单号
|
||||
* @param receivers
|
||||
* 分帐接收方
|
||||
* @param multi
|
||||
* 是否多次分帐,默认为单次分帐,即调用分帐成功后马上解冻剩余金额给商户,不需要完结分帐。多次分帐可多次调用分帐API,需调完结分帐结束分帐
|
||||
* @return
|
||||
* @throws WeixinException
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_1&index=1">请求单次分帐</a>
|
||||
*/
|
||||
public ProfitSharingResult profitSharing(String transactionId, String outOrderNo, List<ReceiverProfit> receivers,
|
||||
Boolean multi) throws WeixinException {
|
||||
ProfitSharingRequest request = new ProfitSharingRequest(transactionId, outOrderNo, receivers);
|
||||
super.declareMerchant(request);
|
||||
String url = multi==null || multi.booleanValue()==false ? getRequestUri("profit_sharing_uri") :
|
||||
getRequestUri("multi_profit_sharing_uri");
|
||||
request.setSign(weixinSignature.sign(request, SignType.HMAC$SHA256));
|
||||
String para = XmlStream.toXML(request);
|
||||
WeixinResponse response = getWeixinSSLExecutor().post(url, para);
|
||||
return response.getAsObject(new TypeReference<ProfitSharingResult>(){});
|
||||
}
|
||||
|
||||
/**
|
||||
* 分帐查询
|
||||
*
|
||||
* @param transactionId
|
||||
* 微信订单号
|
||||
* @param outOrderNo
|
||||
* 商户分帐单号
|
||||
* @return
|
||||
* @throws WeixinException
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_2&index=3">分帐查询</a>
|
||||
*/
|
||||
public ProfitSharingResult profitSharingQuery(String transactionId, String outOrderNo) throws WeixinException {
|
||||
ProfitSharingRequest request = new ProfitSharingRequest(transactionId, outOrderNo, null);
|
||||
request.setMchId(weixinAccount.getMchId());
|
||||
request.setNonceStr(RandomUtil.generateString(16));
|
||||
request.setSubMchId(weixinAccount.getSubMchId());
|
||||
String url = getRequestUri("profit_sharing_query_uri");
|
||||
request.setSign(weixinSignature.sign(request, SignType.HMAC$SHA256));
|
||||
String para = XmlStream.toXML(request);
|
||||
WeixinResponse response = weixinExecutor.post(url, para);
|
||||
return response.getAsObject(new TypeReference<ProfitSharingResult>(){});
|
||||
}
|
||||
|
||||
/**
|
||||
* 完结分账
|
||||
* 1、不需要进行分账的订单,可直接调用本接口将订单的金额全部解冻给本商户
|
||||
* 2、调用多次分账接口后,需要解冻剩余资金时,调用本接口将剩余的分账金额全部解冻给特约商户
|
||||
* 3、已调用请求单次分账后,剩余待分账金额为零,不需要再调用此接口。
|
||||
*
|
||||
* @param transactionId
|
||||
* 微信订单号
|
||||
* @param outOrderNo
|
||||
* 商户分帐单号
|
||||
* @param description
|
||||
* 分帐完结描述
|
||||
* @return
|
||||
* @throws WeixinException
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_5&index=6">完结分账</a>
|
||||
*/
|
||||
public ProfitSharingResult profitSharingFinish(String transactionId, String outOrderNo, String description)
|
||||
throws WeixinException {
|
||||
ProfitSharingRequest request = new ProfitSharingRequest(transactionId, outOrderNo, null);
|
||||
request.setDescription(description);
|
||||
super.declareMerchant(request);
|
||||
String url = getRequestUri("profit_sharing_finish_uri");
|
||||
request.setSign(weixinSignature.sign(request, SignType.HMAC$SHA256));
|
||||
String para = XmlStream.toXML(request);
|
||||
WeixinResponse response = getWeixinSSLExecutor().post(url, para);
|
||||
return response.getAsObject(new TypeReference<ProfitSharingResult>(){});
|
||||
}
|
||||
|
||||
/**
|
||||
* 分账回退
|
||||
*
|
||||
* @param id
|
||||
* 分帐单号
|
||||
* @param outReturnNo
|
||||
* 商户回退单号
|
||||
* @param returnAccountType
|
||||
* 回退方类型
|
||||
* @param returnAccount
|
||||
* 回退方账号
|
||||
* @param returnAmount
|
||||
* 回退金额
|
||||
* @param description
|
||||
* 回退描述
|
||||
* @return
|
||||
* @throws WeixinException
|
||||
* @see ProfitSharingReturnRequest
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_7&index=7">分账回退</a>
|
||||
*/
|
||||
public ProfitSharingReturnResult profitSharingReturn(ProfitId id, String outReturnNo,
|
||||
ReturnAccountType returnAccountType, String returnAccount,
|
||||
int returnAmount, String description) throws WeixinException{
|
||||
ProfitSharingReturnRequest request;
|
||||
if(id.getIdType()== ProfitIdType.ORDER_ID){
|
||||
request = new ProfitSharingReturnRequest(id.getId(), null, outReturnNo, returnAccountType,
|
||||
returnAccount, returnAmount, description);
|
||||
}else{
|
||||
request = new ProfitSharingReturnRequest(null, id.getId(), outReturnNo, returnAccountType,
|
||||
returnAccount, returnAmount, description);
|
||||
}
|
||||
super.declareMerchant(request);
|
||||
String url = getRequestUri("profit_sharing_return_uri");
|
||||
request.setSign(weixinSignature.sign(request, SignType.HMAC$SHA256));
|
||||
String para = XmlStream.toXML(request);
|
||||
WeixinResponse response = getWeixinSSLExecutor().post(url, para);
|
||||
return response.getAsObject(new TypeReference<ProfitSharingReturnResult>(){});
|
||||
}
|
||||
|
||||
/**
|
||||
* 回退结果查询
|
||||
*
|
||||
* @param id
|
||||
* 分帐单号
|
||||
* @param outReturnNo
|
||||
* 商户回退单号
|
||||
* @return
|
||||
* @throws WeixinException
|
||||
* @see ProfitSharingReturnRequest
|
||||
* @see <a href="https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_8&index=8">回退结果查询</a>
|
||||
*/
|
||||
public ProfitSharingReturnResult profitSharingReturnQuery(ProfitId id, String outReturnNo) throws WeixinException{
|
||||
ProfitSharingReturnRequest request;
|
||||
if(id.getIdType()== ProfitIdType.ORDER_ID){
|
||||
request = new ProfitSharingReturnRequest(id.getId(), null, outReturnNo);
|
||||
}else{
|
||||
request = new ProfitSharingReturnRequest(null, id.getId(), outReturnNo);
|
||||
}
|
||||
super.declareMerchant(request);
|
||||
String url = getRequestUri("profit_sharing_return_query_uri");
|
||||
request.setSign(weixinSignature.sign(request, SignType.HMAC$SHA256));
|
||||
String para = XmlStream.toXML(request);
|
||||
WeixinResponse response = weixinExecutor.post(url, para);
|
||||
return response.getAsObject(new TypeReference<ProfitSharingReturnResult>(){});
|
||||
}
|
||||
}
|
||||
@ -43,10 +43,18 @@ public class JsPayNotify extends PayBaseInfo {
|
||||
return openId;
|
||||
}
|
||||
|
||||
public void setOpenId(String openId) {
|
||||
this.openId = openId;
|
||||
}
|
||||
|
||||
public int getIsSubscribe() {
|
||||
return isSubscribe;
|
||||
}
|
||||
|
||||
public void setIsSubscribe(int isSubscribe) {
|
||||
this.isSubscribe = isSubscribe;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public boolean getFormatIsSubscribe() {
|
||||
return isSubscribe == 1;
|
||||
|
||||
@ -195,6 +195,10 @@ public class PayPackage extends MerchantResult {
|
||||
return totalFee;
|
||||
}
|
||||
|
||||
public void setTotalFee(int totalFee) {
|
||||
this.totalFee = totalFee;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
|
||||
@ -178,10 +178,18 @@ public class CouponDetail extends MerchantResult {
|
||||
return couponStockId;
|
||||
}
|
||||
|
||||
public void setCouponStockId(String couponStockId) {
|
||||
this.couponStockId = couponStockId;
|
||||
}
|
||||
|
||||
public int getCouponStockType() {
|
||||
return couponStockType;
|
||||
}
|
||||
|
||||
public void setCouponStockType(int couponStockType) {
|
||||
this.couponStockType = couponStockType;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public CouponStockType getFormatCouponStockType() {
|
||||
for (CouponStockType couponStockType : CouponStockType.values()) {
|
||||
@ -196,10 +204,18 @@ public class CouponDetail extends MerchantResult {
|
||||
return couponId;
|
||||
}
|
||||
|
||||
public void setCouponId(String couponId) {
|
||||
this.couponId = couponId;
|
||||
}
|
||||
|
||||
public int getCouponValue() {
|
||||
return couponValue;
|
||||
}
|
||||
|
||||
public void setCouponValue(int couponValue) {
|
||||
this.couponValue = couponValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -214,6 +230,10 @@ public class CouponDetail extends MerchantResult {
|
||||
return couponMininum;
|
||||
}
|
||||
|
||||
public void setCouponMininum(int couponMininum) {
|
||||
this.couponMininum = couponMininum;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -228,10 +248,18 @@ public class CouponDetail extends MerchantResult {
|
||||
return couponName;
|
||||
}
|
||||
|
||||
public void setCouponName(String couponName) {
|
||||
this.couponName = couponName;
|
||||
}
|
||||
|
||||
public int getCouponStatus() {
|
||||
return couponStatus;
|
||||
}
|
||||
|
||||
public void setCouponStatus(int couponStatus) {
|
||||
this.couponStatus = couponStatus;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public CouponStatus getFormatCouponStatus() {
|
||||
for (CouponStatus couponStatus : CouponStatus.values()) {
|
||||
@ -246,6 +274,10 @@ public class CouponDetail extends MerchantResult {
|
||||
return couponType;
|
||||
}
|
||||
|
||||
public void setCouponType(int couponType) {
|
||||
this.couponType = couponType;
|
||||
}
|
||||
|
||||
@JSONField(deserialize = false, serialize = false)
|
||||
public CouponType getFormatCouponType() {
|
||||
for (CouponType couponType : CouponType.values()) {
|
||||
@ -260,10 +292,18 @@ public class CouponDetail extends MerchantResult {
|
||||
return couponDesc;
|
||||
}
|
||||
|
||||
public void setCouponDesc(String couponDesc) {
|
||||
this.couponDesc = couponDesc;
|
||||
}
|
||||
|
||||
public int getCouponUseValue() {
|
||||
return couponUseValue;
|
||||
}
|
||||
|
||||
public void setCouponUseValue(int couponUseValue) {
|
||||
this.couponUseValue = couponUseValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -288,10 +328,18 @@ public class CouponDetail extends MerchantResult {
|
||||
return couponRemainValue / 100d;
|
||||
}
|
||||
|
||||
public void setCouponRemainValue(int couponRemainValue) {
|
||||
this.couponRemainValue = couponRemainValue;
|
||||
}
|
||||
|
||||
public String getBeginTime() {
|
||||
return beginTime;
|
||||
}
|
||||
|
||||
public void setBeginTime(String beginTime) {
|
||||
this.beginTime = beginTime;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public Date getFormatBeginTime() {
|
||||
return beginTime != null ? DateUtil.parse2yyyyMMddHHmmss(beginTime)
|
||||
@ -302,6 +350,10 @@ public class CouponDetail extends MerchantResult {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public Date getFormatEndTime() {
|
||||
return endTime != null ? DateUtil.parse2yyyyMMddHHmmss(endTime) : null;
|
||||
@ -311,6 +363,10 @@ public class CouponDetail extends MerchantResult {
|
||||
return sendTime;
|
||||
}
|
||||
|
||||
public void setSendTime(String sendTime) {
|
||||
this.sendTime = sendTime;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public Date getFormatSendTime() {
|
||||
return sendTime != null ? DateUtil.parse2yyyyMMddHHmmss(sendTime)
|
||||
@ -326,26 +382,50 @@ public class CouponDetail extends MerchantResult {
|
||||
return useTime != null ? DateUtil.parse2yyyyMMddHHmmss(useTime) : null;
|
||||
}
|
||||
|
||||
public void setUseTime(String useTime) {
|
||||
this.useTime = useTime;
|
||||
}
|
||||
|
||||
public String getTradeNo() {
|
||||
return tradeNo;
|
||||
}
|
||||
|
||||
public void setTradeNo(String tradeNo) {
|
||||
this.tradeNo = tradeNo;
|
||||
}
|
||||
|
||||
public String getConsumerMchId() {
|
||||
return consumerMchId;
|
||||
}
|
||||
|
||||
public void setConsumerMchId(String consumerMchId) {
|
||||
this.consumerMchId = consumerMchId;
|
||||
}
|
||||
|
||||
public String getConsumerMchName() {
|
||||
return consumerMchName;
|
||||
}
|
||||
|
||||
public void setConsumerMchName(String consumerMchName) {
|
||||
this.consumerMchName = consumerMchName;
|
||||
}
|
||||
|
||||
public String getConsumerMchAppid() {
|
||||
return consumerMchAppid;
|
||||
}
|
||||
|
||||
public void setConsumerMchAppid(String consumerMchAppid) {
|
||||
this.consumerMchAppid = consumerMchAppid;
|
||||
}
|
||||
|
||||
public String getSendSource() {
|
||||
return sendSource;
|
||||
}
|
||||
|
||||
public void setSendSource(String sendSource) {
|
||||
this.sendSource = sendSource;
|
||||
}
|
||||
|
||||
public int getIsPartialUse() {
|
||||
return isPartialUse;
|
||||
}
|
||||
@ -355,6 +435,10 @@ public class CouponDetail extends MerchantResult {
|
||||
return isPartialUse == 1;
|
||||
}
|
||||
|
||||
public void setIsPartialUse(int isPartialUse) {
|
||||
this.isPartialUse = isPartialUse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CouponDetail [couponStockId=" + couponStockId
|
||||
|
||||
@ -80,18 +80,38 @@ public class CouponResult extends MerchantResult {
|
||||
return couponStockId;
|
||||
}
|
||||
|
||||
public void setCouponStockId(String couponStockId) {
|
||||
this.couponStockId = couponStockId;
|
||||
}
|
||||
|
||||
public void setOpenId(String openId) {
|
||||
this.openId = openId;
|
||||
}
|
||||
|
||||
public int getResponseCount() {
|
||||
return responseCount;
|
||||
}
|
||||
|
||||
public void setResponseCount(int responseCount) {
|
||||
this.responseCount = responseCount;
|
||||
}
|
||||
|
||||
public int getSuccessCount() {
|
||||
return successCount;
|
||||
}
|
||||
|
||||
public void setSuccessCount(int successCount) {
|
||||
this.successCount = successCount;
|
||||
}
|
||||
|
||||
public int getFailedCount() {
|
||||
return failedCount;
|
||||
}
|
||||
|
||||
public void setFailedCount(int failedCount) {
|
||||
this.failedCount = failedCount;
|
||||
}
|
||||
|
||||
public String getOpenId() {
|
||||
return openId;
|
||||
}
|
||||
@ -100,14 +120,26 @@ public class CouponResult extends MerchantResult {
|
||||
return retCode;
|
||||
}
|
||||
|
||||
public void setRetCode(String retCode) {
|
||||
this.retCode = retCode;
|
||||
}
|
||||
|
||||
public String getCouponId() {
|
||||
return couponId;
|
||||
}
|
||||
|
||||
public void setCouponId(String couponId) {
|
||||
this.couponId = couponId;
|
||||
}
|
||||
|
||||
public String getRetMsg() {
|
||||
return retMsg;
|
||||
}
|
||||
|
||||
public void setRetMsg(String retMsg) {
|
||||
this.retMsg = retMsg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CouponResult [couponStockId=" + couponStockId
|
||||
|
||||
@ -126,14 +126,26 @@ public class CouponStock extends MerchantResult {
|
||||
return couponStockId;
|
||||
}
|
||||
|
||||
public void setCouponStockId(String couponStockId) {
|
||||
this.couponStockId = couponStockId;
|
||||
}
|
||||
|
||||
public String getCouponName() {
|
||||
return couponName;
|
||||
}
|
||||
|
||||
public void setCouponName(String couponName) {
|
||||
this.couponName = couponName;
|
||||
}
|
||||
|
||||
public int getCouponValue() {
|
||||
return couponValue;
|
||||
}
|
||||
|
||||
public void setCouponValue(int couponValue) {
|
||||
this.couponValue = couponValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -148,6 +160,10 @@ public class CouponStock extends MerchantResult {
|
||||
return couponMininumn;
|
||||
}
|
||||
|
||||
public void setCouponMininumn(Integer couponMininumn) {
|
||||
this.couponMininumn = couponMininumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -172,6 +188,10 @@ public class CouponStock extends MerchantResult {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setCouponType(int couponType) {
|
||||
this.couponType = couponType;
|
||||
}
|
||||
|
||||
public int getCouponStockStatus() {
|
||||
return couponStockStatus;
|
||||
}
|
||||
@ -186,14 +206,26 @@ public class CouponStock extends MerchantResult {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setCouponStockStatus(int couponStockStatus) {
|
||||
this.couponStockStatus = couponStockStatus;
|
||||
}
|
||||
|
||||
public int getCouponTotal() {
|
||||
return couponTotal;
|
||||
}
|
||||
|
||||
public void setCouponTotal(int couponTotal) {
|
||||
this.couponTotal = couponTotal;
|
||||
}
|
||||
|
||||
public Integer getMaxQuota() {
|
||||
return maxQuota;
|
||||
}
|
||||
|
||||
public void setMaxQuota(Integer maxQuota) {
|
||||
this.maxQuota = maxQuota;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -208,6 +240,10 @@ public class CouponStock extends MerchantResult {
|
||||
return lockedNum;
|
||||
}
|
||||
|
||||
public void setLockedNum(Integer lockedNum) {
|
||||
this.lockedNum = lockedNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -222,6 +258,10 @@ public class CouponStock extends MerchantResult {
|
||||
return usedNum;
|
||||
}
|
||||
|
||||
public void setUsedNum(Integer usedNum) {
|
||||
this.usedNum = usedNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -236,6 +276,10 @@ public class CouponStock extends MerchantResult {
|
||||
return sendNum;
|
||||
}
|
||||
|
||||
public void setSendNum(Integer sendNum) {
|
||||
this.sendNum = sendNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -250,6 +294,10 @@ public class CouponStock extends MerchantResult {
|
||||
return beginTime;
|
||||
}
|
||||
|
||||
public void setBeginTime(String beginTime) {
|
||||
this.beginTime = beginTime;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public Date getFormatBeginTime() {
|
||||
return beginTime != null ? DateUtil.parse2yyyyMMddHHmmss(beginTime)
|
||||
@ -260,6 +308,10 @@ public class CouponStock extends MerchantResult {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public Date getFormatEndTime() {
|
||||
return endTime != null ? DateUtil.parse2yyyyMMddHHmmss(endTime) : null;
|
||||
@ -269,6 +321,10 @@ public class CouponStock extends MerchantResult {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public Date getFormatCreateTime() {
|
||||
return createTime != null ? DateUtil.parse2yyyyMMddHHmmss(createTime)
|
||||
@ -279,6 +335,10 @@ public class CouponStock extends MerchantResult {
|
||||
return couponBudget;
|
||||
}
|
||||
|
||||
public void setCouponBudget(Integer couponBudget) {
|
||||
this.couponBudget = couponBudget;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
|
||||
@ -59,10 +59,18 @@ public class OrderCouponInfo implements Serializable {
|
||||
return couponBatchId;
|
||||
}
|
||||
|
||||
public void setCouponBatchId(String couponBatchId) {
|
||||
this.couponBatchId = couponBatchId;
|
||||
}
|
||||
|
||||
public String getCouponType() {
|
||||
return couponType;
|
||||
}
|
||||
|
||||
public void setCouponType(String couponType) {
|
||||
this.couponType = couponType;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public CouponType getFormatCouponType() {
|
||||
return couponType != null ? CouponType
|
||||
@ -73,10 +81,18 @@ public class OrderCouponInfo implements Serializable {
|
||||
return couponId;
|
||||
}
|
||||
|
||||
public void setCouponId(String couponId) {
|
||||
this.couponId = couponId;
|
||||
}
|
||||
|
||||
public Integer getCouponFee() {
|
||||
return couponFee;
|
||||
}
|
||||
|
||||
public void setCouponFee(Integer couponFee) {
|
||||
this.couponFee = couponFee;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
|
||||
@ -50,14 +50,26 @@ public class RefundCouponInfo implements Serializable {
|
||||
return couponBatchId;
|
||||
}
|
||||
|
||||
public void setCouponBatchId(String couponBatchId) {
|
||||
this.couponBatchId = couponBatchId;
|
||||
}
|
||||
|
||||
public String getCouponId() {
|
||||
return couponId;
|
||||
}
|
||||
|
||||
public void setCouponId(String couponId) {
|
||||
this.couponId = couponId;
|
||||
}
|
||||
|
||||
public Integer getCouponFee() {
|
||||
return couponFee;
|
||||
}
|
||||
|
||||
public void setCouponFee(Integer couponFee) {
|
||||
this.couponFee = couponFee;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
|
||||
@ -34,6 +34,22 @@ public class PayfaceAuthinfo extends MerchantResult {
|
||||
*/
|
||||
private String authinfo;
|
||||
|
||||
public int getExpiresIn() {
|
||||
return expiresIn;
|
||||
}
|
||||
|
||||
public void setExpiresIn(int expiresIn) {
|
||||
this.expiresIn = expiresIn;
|
||||
}
|
||||
|
||||
public String getAuthinfo() {
|
||||
return authinfo;
|
||||
}
|
||||
|
||||
public void setAuthinfo(String authinfo) {
|
||||
this.authinfo = authinfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PayfaceAuthinfo{" +
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.foxinmy.weixin4j.pay.payment.mch;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.type.mch.CorpPaymentCheckNameType;
|
||||
import com.foxinmy.weixin4j.pay.type.mch.CorpPaymentCheckNameType;
|
||||
import com.foxinmy.weixin4j.util.DateUtil;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
@ -38,7 +38,7 @@ public class CorpPayment extends MerchantResult {
|
||||
/**
|
||||
* 校验用户姓名选项
|
||||
*
|
||||
* @see CorpPaymentCheckNameType.type.MPPaymentCheckNameType
|
||||
* @see CorpPaymentCheckNameType
|
||||
*/
|
||||
@XmlElement(name = "check_name")
|
||||
@JSONField(name = "check_name")
|
||||
@ -99,26 +99,50 @@ public class CorpPayment extends MerchantResult {
|
||||
return outTradeNo;
|
||||
}
|
||||
|
||||
public void setOutTradeNo(String outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
}
|
||||
|
||||
public String getOpenId() {
|
||||
return openId;
|
||||
}
|
||||
|
||||
public void setOpenId(String openId) {
|
||||
this.openId = openId;
|
||||
}
|
||||
|
||||
public CorpPaymentCheckNameType getCheckNameType() {
|
||||
return checkNameType;
|
||||
}
|
||||
|
||||
public void setCheckNameType(CorpPaymentCheckNameType checkNameType) {
|
||||
this.checkNameType = checkNameType;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -133,8 +157,8 @@ public class CorpPayment extends MerchantResult {
|
||||
return clientIp;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
public void setClientIp(String clientIp) {
|
||||
this.clientIp = clientIp;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.foxinmy.weixin4j.pay.payment.mch;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.type.mch.CorpPaymentCheckNameType;
|
||||
import com.foxinmy.weixin4j.pay.type.mch.CorpPaymentCheckNameType;
|
||||
import com.foxinmy.weixin4j.util.DateUtil;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
@ -76,7 +76,7 @@ public class CorpPaymentRecord extends MerchantResult {
|
||||
/**
|
||||
* 校验用户姓名选项
|
||||
*
|
||||
* @see CorpPaymentCheckNameType.type.MPPaymentCheckNameType
|
||||
* @see CorpPaymentCheckNameType
|
||||
*/
|
||||
@XmlElement(name = "check_name")
|
||||
@JSONField(name = "check_name")
|
||||
@ -101,14 +101,26 @@ public class CorpPaymentRecord extends MerchantResult {
|
||||
return transactionId;
|
||||
}
|
||||
|
||||
public void setTransactionId(String transactionId) {
|
||||
this.transactionId = transactionId;
|
||||
}
|
||||
|
||||
public String getOutTradeNo() {
|
||||
return outTradeNo;
|
||||
}
|
||||
|
||||
public void setOutTradeNo(String outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
}
|
||||
|
||||
public String getTransactionStatus() {
|
||||
return transactionStatus;
|
||||
}
|
||||
|
||||
public void setTransactionStatus(String transactionStatus) {
|
||||
this.transactionStatus = transactionStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化交易状态
|
||||
*
|
||||
@ -123,18 +135,34 @@ public class CorpPaymentRecord extends MerchantResult {
|
||||
return failureReason;
|
||||
}
|
||||
|
||||
public void setFailureReason(String failureReason) {
|
||||
this.failureReason = failureReason;
|
||||
}
|
||||
|
||||
public String getOpenId() {
|
||||
return openId;
|
||||
}
|
||||
|
||||
public void setOpenId(String openId) {
|
||||
this.openId = openId;
|
||||
}
|
||||
|
||||
public String getTransferName() {
|
||||
return transferName;
|
||||
}
|
||||
|
||||
public void setTransferName(String transferName) {
|
||||
this.transferName = transferName;
|
||||
}
|
||||
|
||||
public int getPaymentAmount() {
|
||||
return paymentAmount;
|
||||
}
|
||||
|
||||
public void setPaymentAmount(int paymentAmount) {
|
||||
this.paymentAmount = paymentAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -149,6 +177,10 @@ public class CorpPaymentRecord extends MerchantResult {
|
||||
return transferTime;
|
||||
}
|
||||
|
||||
public void setTransferTime(String transferTime) {
|
||||
this.transferTime = transferTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化转账时间
|
||||
*
|
||||
@ -164,6 +196,10 @@ public class CorpPaymentRecord extends MerchantResult {
|
||||
return checkNameType;
|
||||
}
|
||||
|
||||
public void setCheckNameType(String checkNameType) {
|
||||
this.checkNameType = checkNameType;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public CorpPaymentCheckNameType getFormatCheckNameType() {
|
||||
return checkNameType != null ? CorpPaymentCheckNameType
|
||||
@ -174,10 +210,18 @@ public class CorpPaymentRecord extends MerchantResult {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCheckNameResult() {
|
||||
return checkNameResult;
|
||||
}
|
||||
|
||||
public void setCheckNameResult(String checkNameResult) {
|
||||
this.checkNameResult = checkNameResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化交易状态
|
||||
*
|
||||
|
||||
@ -51,14 +51,26 @@ public class CorpPaymentResult extends MerchantResult {
|
||||
return transactionId;
|
||||
}
|
||||
|
||||
public void setTransactionId(String transactionId) {
|
||||
this.transactionId = transactionId;
|
||||
}
|
||||
|
||||
public String getOutTradeNo() {
|
||||
return outTradeNo;
|
||||
}
|
||||
|
||||
public void setOutTradeNo(String outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
}
|
||||
|
||||
public String getPaymentTime() {
|
||||
return paymentTime;
|
||||
}
|
||||
|
||||
public void setPaymentTime(String paymentTime) {
|
||||
this.paymentTime = paymentTime;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public Date getFormatPaymentTime() {
|
||||
return paymentTime != null ? DateUtil.parseDate(paymentTime,
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package com.foxinmy.weixin4j.pay.payment.mch;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.type.CredentialType;
|
||||
import com.foxinmy.weixin4j.type.CurrencyType;
|
||||
import com.foxinmy.weixin4j.type.CustomsCity;
|
||||
import com.foxinmy.weixin4j.pay.type.CredentialType;
|
||||
import com.foxinmy.weixin4j.pay.type.CurrencyType;
|
||||
import com.foxinmy.weixin4j.pay.type.CustomsCity;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
@ -40,7 +40,7 @@ public class CustomsOrder extends MerchantResult {
|
||||
/**
|
||||
* 货币类型,符合 ISO 4217 标准的三位字母代码,默认人民币:CNY
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.mp.type.CurrencyType
|
||||
* @see com.foxinmy.weixin4j.pay.type.CurrencyType
|
||||
*/
|
||||
@XmlElement(name = "fee_type")
|
||||
@JSONField(name = "fee_type")
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.foxinmy.weixin4j.pay.payment.mch;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.type.CustomsSatus;
|
||||
import com.foxinmy.weixin4j.pay.type.CustomsSatus;
|
||||
import com.foxinmy.weixin4j.util.DateUtil;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
@ -4,7 +4,6 @@ import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.pay.payment.PayPackage;
|
||||
import com.foxinmy.weixin4j.pay.type.CurrencyType;
|
||||
import com.foxinmy.weixin4j.pay.type.TradeType;
|
||||
import com.foxinmy.weixin4j.pay.type.mch.DepositType;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
@ -77,18 +76,23 @@ public class MchPayPackage extends PayPackage {
|
||||
@XmlElement(name = "scene_info")
|
||||
@JSONField(name = "scene_info")
|
||||
private String sceneInfo;
|
||||
|
||||
/**
|
||||
* 人脸凭证,用于旧版人脸支付。
|
||||
* 电子发票入口开放标识
|
||||
*/
|
||||
@XmlElement(name = "face_code")
|
||||
@JSONField(name = "face_code")
|
||||
private String faceCode;
|
||||
private String receipt;
|
||||
/**
|
||||
* 是否押金人脸支付,Y-是,N-普通人脸支付
|
||||
*/
|
||||
@XmlElement(name = "deposit")
|
||||
@JSONField(name = "deposit")
|
||||
private DepositType deposit;
|
||||
private String deposit;
|
||||
|
||||
/**
|
||||
* 是否需要分帐,非必传,默认为不分帐
|
||||
* Y-是,需要分账,N-否,不分账
|
||||
*/
|
||||
@XmlElement(name = "profit_sharing")
|
||||
@JSONField(name = "profit_sharing")
|
||||
private String profitSharing;
|
||||
|
||||
protected MchPayPackage() {
|
||||
// jaxb required
|
||||
@ -123,7 +127,7 @@ public class MchPayPackage extends PayPackage {
|
||||
String openId, String authCode, String productId, String attach) {
|
||||
this(body, null, outTradeNo, totalFee, CurrencyType.CNY, notifyUrl,
|
||||
createIp, tradeType, openId, authCode, productId, attach, null,
|
||||
null, null, null, null, null, null);
|
||||
null, null, null, null, null, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -164,51 +168,73 @@ public class MchPayPackage extends PayPackage {
|
||||
* @param subOpenId
|
||||
* 用户在子商户appid下的唯一标识 非必填
|
||||
* openid和sub_openid可以选传其中之一,如果选择传sub_openid ,则必须传sub_appid
|
||||
* @param faceCode
|
||||
* 人脸凭证,用于旧版刷脸支付。
|
||||
* @param depositType
|
||||
* @param receipt
|
||||
* 电子发票入口开放标识
|
||||
* @param deposit
|
||||
* 是否押金支付
|
||||
* @param profitSharing
|
||||
* 是否需要分账
|
||||
*/
|
||||
public MchPayPackage(String body, String detial, String outTradeNo,
|
||||
double totalFee, CurrencyType feeType, String notifyUrl,
|
||||
String createIp, TradeType tradeType, String openId,
|
||||
String authCode, String productId, String attach, Date timeStart,
|
||||
Date timeExpire, String goodsTag, String limitPay, String subOpenId, String faceCode,
|
||||
DepositType depositType) {
|
||||
Date timeExpire, String goodsTag, String limitPay, String subOpenId, String receipt,
|
||||
String deposit, String profitSharing) {
|
||||
super(body, detial, outTradeNo, totalFee, notifyUrl, createIp, attach,
|
||||
timeStart, timeExpire, goodsTag);
|
||||
this.tradeType = tradeType != null ? tradeType.name() : null;
|
||||
this.feeType = feeType == null ? CurrencyType.CNY.name() : feeType
|
||||
.name();
|
||||
this.feeType = feeType == null ? CurrencyType.CNY.name() : feeType.name();
|
||||
this.openId = openId;
|
||||
this.authCode = authCode;
|
||||
this.productId = productId;
|
||||
this.limitPay = limitPay;
|
||||
this.subOpenId = subOpenId;
|
||||
this.faceCode = faceCode;
|
||||
this.deposit = depositType;
|
||||
this.receipt = receipt;
|
||||
this.deposit = deposit;
|
||||
this.profitSharing = profitSharing;
|
||||
}
|
||||
|
||||
public String getTradeType() {
|
||||
return tradeType;
|
||||
}
|
||||
|
||||
public void setTradeType(String tradeType) {
|
||||
this.tradeType = tradeType;
|
||||
}
|
||||
|
||||
public String getFeeType() {
|
||||
return feeType;
|
||||
}
|
||||
|
||||
public void setFeeType(String feeType) {
|
||||
this.feeType = feeType;
|
||||
}
|
||||
|
||||
public String getOpenId() {
|
||||
return openId;
|
||||
}
|
||||
|
||||
public void setOpenId(String openId) {
|
||||
this.openId = openId;
|
||||
}
|
||||
|
||||
public String getAuthCode() {
|
||||
return authCode;
|
||||
}
|
||||
|
||||
public void setAuthCode(String authCode) {
|
||||
this.authCode = authCode;
|
||||
}
|
||||
|
||||
public String getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(String productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getLimitPay() {
|
||||
return limitPay;
|
||||
}
|
||||
@ -233,22 +259,30 @@ public class MchPayPackage extends PayPackage {
|
||||
this.sceneInfo = sceneInfo;
|
||||
}
|
||||
|
||||
public String getFaceCode() {
|
||||
return faceCode;
|
||||
public String getReceipt() {
|
||||
return receipt;
|
||||
}
|
||||
|
||||
public void setFaceCode(String faceCode) {
|
||||
this.faceCode = faceCode;
|
||||
public void setReceipt(String receipt) {
|
||||
this.receipt = receipt;
|
||||
}
|
||||
|
||||
public DepositType getDeposit() {
|
||||
public String getDeposit() {
|
||||
return deposit;
|
||||
}
|
||||
|
||||
public void setDeposit(DepositType deposit) {
|
||||
public void setDeposit(String deposit) {
|
||||
this.deposit = deposit;
|
||||
}
|
||||
|
||||
public String getProfitSharing() {
|
||||
return profitSharing;
|
||||
}
|
||||
|
||||
public void setProfitSharing(String profitSharing) {
|
||||
this.profitSharing = profitSharing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MchPayPackage{" +
|
||||
@ -260,8 +294,9 @@ public class MchPayPackage extends PayPackage {
|
||||
", limitPay='" + limitPay + '\'' +
|
||||
", subOpenId='" + subOpenId + '\'' +
|
||||
", sceneInfo='" + sceneInfo + '\'' +
|
||||
", faceCode='" + faceCode + '\'' +
|
||||
", receipt='" + receipt + '\'' +
|
||||
", deposit=" + deposit +
|
||||
", profitSharing=" + profitSharing +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.foxinmy.weixin4j.pay.payment.mch;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.type.CurrencyType;
|
||||
import com.foxinmy.weixin4j.pay.type.CurrencyType;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
@ -60,6 +60,10 @@ public class MerchantTradeResult extends MerchantResult {
|
||||
return cashFee;
|
||||
}
|
||||
|
||||
public void setCashFee(Integer cashFee) {
|
||||
this.cashFee = cashFee;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -74,6 +78,10 @@ public class MerchantTradeResult extends MerchantResult {
|
||||
return totalFee;
|
||||
}
|
||||
|
||||
public void setTotalFee(Integer totalFee) {
|
||||
this.totalFee = totalFee;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -94,18 +102,34 @@ public class MerchantTradeResult extends MerchantResult {
|
||||
return feeType;
|
||||
}
|
||||
|
||||
public void setFeeType(String feeType) {
|
||||
this.feeType = feeType;
|
||||
}
|
||||
|
||||
public String getTransactionId() {
|
||||
return transactionId;
|
||||
}
|
||||
|
||||
public void setTransactionId(String transactionId) {
|
||||
this.transactionId = transactionId;
|
||||
}
|
||||
|
||||
public String getOutTradeNo() {
|
||||
return outTradeNo;
|
||||
}
|
||||
|
||||
public void setOutTradeNo(String outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
}
|
||||
|
||||
public Integer getSettlementTotalFee() {
|
||||
return settlementTotalFee;
|
||||
}
|
||||
|
||||
public void setSettlementTotalFee(Integer settlementTotalFee) {
|
||||
this.settlementTotalFee = settlementTotalFee;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
|
||||
@ -42,10 +42,18 @@ public class NativePayNotify extends OpenIdResult {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setIsSubscribe(String isSubscribe) {
|
||||
this.isSubscribe = isSubscribe;
|
||||
}
|
||||
|
||||
public String getIsSubscribe() {
|
||||
return isSubscribe;
|
||||
}
|
||||
|
||||
public void setProductId(String productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NativePayNotify [productId=" + productId + ", isSubscribe="
|
||||
|
||||
@ -71,6 +71,10 @@ public class NativePayResponse extends MerchantResult {
|
||||
return prepayId;
|
||||
}
|
||||
|
||||
public void setPrepayId(String prepayId) {
|
||||
this.prepayId = prepayId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NativePayResponse [prepayId=" + prepayId + ", "
|
||||
|
||||
@ -40,10 +40,18 @@ public class OpenIdResult extends MerchantResult {
|
||||
return openId;
|
||||
}
|
||||
|
||||
public void setOpenId(String openId) {
|
||||
this.openId = openId;
|
||||
}
|
||||
|
||||
public String getSubOpenId() {
|
||||
return subOpenId;
|
||||
}
|
||||
|
||||
public void setSubOpenId(String subOpenId) {
|
||||
this.subOpenId = subOpenId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OpenIdResult [openId=" + openId + ", subOpenId=" + subOpenId
|
||||
|
||||
@ -2,10 +2,10 @@ package com.foxinmy.weixin4j.pay.payment.mch;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.pay.payment.coupon.OrderCouponInfo;
|
||||
import com.foxinmy.weixin4j.type.BankType;
|
||||
import com.foxinmy.weixin4j.type.CurrencyType;
|
||||
import com.foxinmy.weixin4j.type.TradeState;
|
||||
import com.foxinmy.weixin4j.type.TradeType;
|
||||
import com.foxinmy.weixin4j.pay.type.BankType;
|
||||
import com.foxinmy.weixin4j.pay.type.CurrencyType;
|
||||
import com.foxinmy.weixin4j.pay.type.TradeState;
|
||||
import com.foxinmy.weixin4j.pay.type.TradeType;
|
||||
import com.foxinmy.weixin4j.util.DateUtil;
|
||||
import com.foxinmy.weixin4j.xml.ListsuffixResult;
|
||||
|
||||
@ -134,10 +134,18 @@ public class Order extends MerchantTradeResult {
|
||||
return openId;
|
||||
}
|
||||
|
||||
public void setOpenId(String openId) {
|
||||
this.openId = openId;
|
||||
}
|
||||
|
||||
public String getIsSubscribe() {
|
||||
return isSubscribe;
|
||||
}
|
||||
|
||||
public void setIsSubscribe(String isSubscribe) {
|
||||
this.isSubscribe = isSubscribe;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public boolean getFormatIsSubscribe() {
|
||||
return isSubscribe != null && isSubscribe.equalsIgnoreCase("y");
|
||||
@ -153,6 +161,10 @@ public class Order extends MerchantTradeResult {
|
||||
return bankType;
|
||||
}
|
||||
|
||||
public void setBankType(String bankType) {
|
||||
this.bankType = bankType;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public BankType getFormatBankType() {
|
||||
return bankType != null ? BankType.valueOf(bankType.toUpperCase())
|
||||
@ -163,6 +175,10 @@ public class Order extends MerchantTradeResult {
|
||||
return couponFee;
|
||||
}
|
||||
|
||||
public void setCouponFee(Integer couponFee) {
|
||||
this.couponFee = couponFee;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -177,22 +193,42 @@ public class Order extends MerchantTradeResult {
|
||||
return couponCount;
|
||||
}
|
||||
|
||||
public void setCouponCount(Integer couponCount) {
|
||||
this.couponCount = couponCount;
|
||||
}
|
||||
|
||||
public String getTradeState() {
|
||||
return tradeState;
|
||||
}
|
||||
|
||||
public void setTradeState(String tradeState) {
|
||||
this.tradeState = tradeState;
|
||||
}
|
||||
|
||||
public String getTradeType() {
|
||||
return tradeType;
|
||||
}
|
||||
|
||||
public void setTradeType(String tradeType) {
|
||||
this.tradeType = tradeType;
|
||||
}
|
||||
|
||||
public String getAttach() {
|
||||
return attach;
|
||||
}
|
||||
|
||||
public void setAttach(String attach) {
|
||||
this.attach = attach;
|
||||
}
|
||||
|
||||
public String getTimeEnd() {
|
||||
return timeEnd;
|
||||
}
|
||||
|
||||
public void setTimeEnd(String timeEnd) {
|
||||
this.timeEnd = timeEnd;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public Date getFormatTimeEnd() {
|
||||
return timeEnd != null ? DateUtil.parse2yyyyMMddHHmmss(timeEnd) : null;
|
||||
@ -202,6 +238,10 @@ public class Order extends MerchantTradeResult {
|
||||
return tradeStateDesc;
|
||||
}
|
||||
|
||||
public void setTradeStateDesc(String tradeStateDesc) {
|
||||
this.tradeStateDesc = tradeStateDesc;
|
||||
}
|
||||
|
||||
public List<OrderCouponInfo> getCouponList() {
|
||||
return couponList;
|
||||
}
|
||||
@ -214,10 +254,18 @@ public class Order extends MerchantTradeResult {
|
||||
return subOpenId;
|
||||
}
|
||||
|
||||
public void setSubOpenId(String subOpenId) {
|
||||
this.subOpenId = subOpenId;
|
||||
}
|
||||
|
||||
public String getSubIsSubscribe() {
|
||||
return subIsSubscribe;
|
||||
}
|
||||
|
||||
public void setSubIsSubscribe(String subIsSubscribe) {
|
||||
this.subIsSubscribe = subIsSubscribe;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public boolean getFormatSubIsSubscribe() {
|
||||
return subIsSubscribe != null && subIsSubscribe.equalsIgnoreCase("y");
|
||||
@ -227,6 +275,10 @@ public class Order extends MerchantTradeResult {
|
||||
return cashFeeType;
|
||||
}
|
||||
|
||||
public void setCashFeeType(String cashFeeType) {
|
||||
this.cashFeeType = cashFeeType;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public CurrencyType getFormatCashFeeType() {
|
||||
return cashFeeType != null ? CurrencyType.valueOf(cashFeeType
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.foxinmy.weixin4j.pay.payment.mch;
|
||||
|
||||
import com.foxinmy.weixin4j.type.TradeType;
|
||||
import com.foxinmy.weixin4j.pay.type.TradeType;
|
||||
|
||||
import javax.xml.bind.annotation.*;
|
||||
|
||||
@ -22,7 +22,7 @@ public class PrePay extends MerchantResult {
|
||||
/**
|
||||
* 调用接口提交的交易类型,取值如下:JSAPI,NATIVE,APP,
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.mp.type.TradeType
|
||||
* @see com.foxinmy.weixin4j.pay.type.TradeType
|
||||
*/
|
||||
@XmlElement(name = "trade_type")
|
||||
private TradeType tradeType;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.foxinmy.weixin4j.pay.payment.mch;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.type.mch.RedpacketSceneType;
|
||||
import com.foxinmy.weixin4j.pay.type.mch.RedpacketSceneType;
|
||||
import com.foxinmy.weixin4j.util.DateUtil;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
@ -174,18 +174,34 @@ public class Redpacket extends MerchantResult {
|
||||
return outTradeNo;
|
||||
}
|
||||
|
||||
public void setOutTradeNo(String outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
}
|
||||
|
||||
public String getOpenId() {
|
||||
return openId;
|
||||
}
|
||||
|
||||
public void setOpenId(String openId) {
|
||||
this.openId = openId;
|
||||
}
|
||||
|
||||
public String getSendName() {
|
||||
return sendName;
|
||||
}
|
||||
|
||||
public void setSendName(String sendName) {
|
||||
this.sendName = sendName;
|
||||
}
|
||||
|
||||
public int getTotalAmount() {
|
||||
return totalAmount;
|
||||
}
|
||||
|
||||
public void setTotalAmount(int totalAmount) {
|
||||
this.totalAmount = totalAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -200,26 +216,50 @@ public class Redpacket extends MerchantResult {
|
||||
return totalNum;
|
||||
}
|
||||
|
||||
public void setTotalNum(int totalNum) {
|
||||
this.totalNum = totalNum;
|
||||
}
|
||||
|
||||
public String getWishing() {
|
||||
return wishing;
|
||||
}
|
||||
|
||||
public void setWishing(String wishing) {
|
||||
this.wishing = wishing;
|
||||
}
|
||||
|
||||
public String getAmtType() {
|
||||
return amtType;
|
||||
}
|
||||
|
||||
public void setAmtType(String amtType) {
|
||||
this.amtType = amtType;
|
||||
}
|
||||
|
||||
public String getClientIp() {
|
||||
return clientIp;
|
||||
}
|
||||
|
||||
public void setClientIp(String clientIp) {
|
||||
this.clientIp = clientIp;
|
||||
}
|
||||
|
||||
public String getActName() {
|
||||
return actName;
|
||||
}
|
||||
|
||||
public void setActName(String actName) {
|
||||
this.actName = actName;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getMsgAppId() {
|
||||
return msgAppId;
|
||||
}
|
||||
|
||||
@ -2,9 +2,9 @@ package com.foxinmy.weixin4j.pay.payment.mch;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.http.weixin.XmlResult;
|
||||
import com.foxinmy.weixin4j.type.mch.RedpacketSendType;
|
||||
import com.foxinmy.weixin4j.type.mch.RedpacketStatus;
|
||||
import com.foxinmy.weixin4j.type.mch.RedpacketType;
|
||||
import com.foxinmy.weixin4j.pay.type.mch.RedpacketSendType;
|
||||
import com.foxinmy.weixin4j.pay.type.mch.RedpacketStatus;
|
||||
import com.foxinmy.weixin4j.pay.type.mch.RedpacketType;
|
||||
import com.foxinmy.weixin4j.util.DateUtil;
|
||||
|
||||
import javax.xml.bind.annotation.*;
|
||||
|
||||
@ -72,6 +72,10 @@ public class RedpacketRisk {
|
||||
return risk;
|
||||
}
|
||||
|
||||
public void setRisk(Map<String, String> risk) {
|
||||
this.risk = risk;
|
||||
}
|
||||
|
||||
public String toContent() {
|
||||
if (risk.isEmpty())
|
||||
return null;
|
||||
|
||||
@ -62,14 +62,26 @@ public class RedpacketSendResult extends MerchantResult {
|
||||
return outTradeNo;
|
||||
}
|
||||
|
||||
public void setOutTradeNo(String outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
}
|
||||
|
||||
public String getOpenId() {
|
||||
return openId;
|
||||
}
|
||||
|
||||
public void setOpenId(String openId) {
|
||||
this.openId = openId;
|
||||
}
|
||||
|
||||
public int getTotalAmount() {
|
||||
return totalAmount;
|
||||
}
|
||||
|
||||
public void setTotalAmount(int totalAmount) {
|
||||
this.totalAmount = totalAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -84,6 +96,10 @@ public class RedpacketSendResult extends MerchantResult {
|
||||
return sendTime;
|
||||
}
|
||||
|
||||
public void setSendTime(String sendTime) {
|
||||
this.sendTime = sendTime;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public Date getFormatSendTime() {
|
||||
return DateUtil.parse2yyyyMMddHHmmss(sendTime);
|
||||
@ -93,6 +109,10 @@ public class RedpacketSendResult extends MerchantResult {
|
||||
return sendListid;
|
||||
}
|
||||
|
||||
public void setSendListid(String sendListid) {
|
||||
this.sendListid = sendListid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RedpacketSendResult [outTradeNo=" + outTradeNo + ", openId="
|
||||
|
||||
@ -2,9 +2,9 @@ package com.foxinmy.weixin4j.pay.payment.mch;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.pay.payment.coupon.RefundCouponInfo;
|
||||
import com.foxinmy.weixin4j.type.mch.CouponType;
|
||||
import com.foxinmy.weixin4j.type.mch.RefundChannel;
|
||||
import com.foxinmy.weixin4j.type.mch.RefundStatus;
|
||||
import com.foxinmy.weixin4j.pay.type.mch.CouponType;
|
||||
import com.foxinmy.weixin4j.pay.type.mch.RefundChannel;
|
||||
import com.foxinmy.weixin4j.pay.type.mch.RefundStatus;
|
||||
import com.foxinmy.weixin4j.util.DateUtil;
|
||||
import com.foxinmy.weixin4j.xml.ListsuffixResult;
|
||||
|
||||
@ -113,14 +113,26 @@ public class RefundDetail implements Serializable {
|
||||
return outRefundNo;
|
||||
}
|
||||
|
||||
public void setOutRefundNo(String outRefundNo) {
|
||||
this.outRefundNo = outRefundNo;
|
||||
}
|
||||
|
||||
public String getRefundId() {
|
||||
return refundId;
|
||||
}
|
||||
|
||||
public void setRefundId(String refundId) {
|
||||
this.refundId = refundId;
|
||||
}
|
||||
|
||||
public String getRefundChannel() {
|
||||
return refundChannel;
|
||||
}
|
||||
|
||||
public void setRefundChannel(String refundChannel) {
|
||||
this.refundChannel = refundChannel;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public RefundChannel getFormatRefundChannel() {
|
||||
return refundChannel != null ? RefundChannel.valueOf(refundChannel
|
||||
@ -131,10 +143,18 @@ public class RefundDetail implements Serializable {
|
||||
return refundFee;
|
||||
}
|
||||
|
||||
public void setRefundFee(int refundFee) {
|
||||
this.refundFee = refundFee;
|
||||
}
|
||||
|
||||
public String getRefundStatus() {
|
||||
return refundStatus;
|
||||
}
|
||||
|
||||
public void setRefundStatus(String refundStatus) {
|
||||
this.refundStatus = refundStatus;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public RefundStatus getFormatRefundStatus() {
|
||||
return refundStatus != null ? RefundStatus.valueOf(refundStatus
|
||||
@ -153,6 +173,10 @@ public class RefundDetail implements Serializable {
|
||||
return settlementRefundFee;
|
||||
}
|
||||
|
||||
public void setSettlementRefundFee(Integer settlementRefundFee) {
|
||||
this.settlementRefundFee = settlementRefundFee;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -167,6 +191,10 @@ public class RefundDetail implements Serializable {
|
||||
return couponRefundFee;
|
||||
}
|
||||
|
||||
public void setCouponRefundFee(Integer couponRefundFee) {
|
||||
this.couponRefundFee = couponRefundFee;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -181,10 +209,18 @@ public class RefundDetail implements Serializable {
|
||||
return couponRefundCount;
|
||||
}
|
||||
|
||||
public void setCouponRefundCount(Integer couponRefundCount) {
|
||||
this.couponRefundCount = couponRefundCount;
|
||||
}
|
||||
|
||||
public String getCouponType() {
|
||||
return couponType;
|
||||
}
|
||||
|
||||
public void setCouponType(String couponType) {
|
||||
this.couponType = couponType;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public CouponType getFormatCouponType() {
|
||||
return couponType != null ? CouponType
|
||||
@ -195,10 +231,18 @@ public class RefundDetail implements Serializable {
|
||||
return refundRecvAccout;
|
||||
}
|
||||
|
||||
public void setRefundRecvAccout(String refundRecvAccout) {
|
||||
this.refundRecvAccout = refundRecvAccout;
|
||||
}
|
||||
|
||||
public String getRefundSuccessTime() {
|
||||
return refundSuccessTime;
|
||||
}
|
||||
|
||||
public void setRefundSuccessTime(String refundSuccessTime) {
|
||||
this.refundSuccessTime = refundSuccessTime;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public Date getFormatRefundSuccessTime() {
|
||||
return refundSuccessTime != null ? DateUtil.parse2yyyyMMddHHmmss(refundSuccessTime) : null;
|
||||
|
||||
@ -50,10 +50,18 @@ public class RefundRecord extends MerchantTradeResult {
|
||||
return refundCount;
|
||||
}
|
||||
|
||||
public void setRefundCount(int refundCount) {
|
||||
this.refundCount = refundCount;
|
||||
}
|
||||
|
||||
public int getRefundFee() {
|
||||
return refundFee;
|
||||
}
|
||||
|
||||
public void setRefundFee(int refundFee) {
|
||||
this.refundFee = refundFee;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.foxinmy.weixin4j.pay.payment.mch;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.type.mch.RefundChannel;
|
||||
import com.foxinmy.weixin4j.pay.type.mch.RefundChannel;
|
||||
import com.foxinmy.weixin4j.xml.ListsuffixResult;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
@ -71,14 +71,26 @@ public class RefundResult extends MerchantTradeResult {
|
||||
return outRefundNo;
|
||||
}
|
||||
|
||||
public void setOutRefundNo(String outRefundNo) {
|
||||
this.outRefundNo = outRefundNo;
|
||||
}
|
||||
|
||||
public String getRefundId() {
|
||||
return refundId;
|
||||
}
|
||||
|
||||
public void setRefundId(String refundId) {
|
||||
this.refundId = refundId;
|
||||
}
|
||||
|
||||
public String getRefundChannel() {
|
||||
return refundChannel;
|
||||
}
|
||||
|
||||
public void setRefundChannel(String refundChannel) {
|
||||
this.refundChannel = refundChannel;
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public RefundChannel getFormatRefundChannel() {
|
||||
return refundChannel != null ? RefundChannel.valueOf(refundChannel
|
||||
@ -89,6 +101,10 @@ public class RefundResult extends MerchantTradeResult {
|
||||
return refundFee;
|
||||
}
|
||||
|
||||
public void setRefundFee(int refundFee) {
|
||||
this.refundFee = refundFee;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -103,6 +119,10 @@ public class RefundResult extends MerchantTradeResult {
|
||||
return cashRefundFee;
|
||||
}
|
||||
|
||||
public void setCashRefundFee(Integer cashRefundFee) {
|
||||
this.cashRefundFee = cashRefundFee;
|
||||
}
|
||||
|
||||
/**
|
||||
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
|
||||
*
|
||||
@ -117,6 +137,10 @@ public class RefundResult extends MerchantTradeResult {
|
||||
return refundList;
|
||||
}
|
||||
|
||||
public void setRefundList(List<RefundDetail> refundList) {
|
||||
this.refundList = refundList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RefundResult [" + super.toString() + ", outRefundNo="
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
package com.foxinmy.weixin4j.pay.payment.mch;
|
||||
|
||||
/**
|
||||
* 支付场景信息接口
|
||||
*
|
||||
* @author kit
|
||||
* @date 2020年06月03日
|
||||
*/
|
||||
public interface SceneInfo {
|
||||
/**
|
||||
* 格式化为Json字符串
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String toJson();
|
||||
}
|
||||
@ -1,26 +1,40 @@
|
||||
package com.foxinmy.weixin4j.pay.payment.mch;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class SceneInfoApp {
|
||||
public class SceneInfoApp implements SceneInfo {
|
||||
/**
|
||||
* 终端类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 应用名称
|
||||
* WAP 网站名
|
||||
*/
|
||||
@XmlElement(name = "wap_name")
|
||||
@JSONField(name = "wap_name")
|
||||
private String name;
|
||||
/**
|
||||
* 应用路径
|
||||
* WAP网站URL地址
|
||||
*/
|
||||
@XmlElement(name = "wap_url")
|
||||
@JSONField(name = "wap_url")
|
||||
private String path;
|
||||
|
||||
@JSONField(serialize = false)
|
||||
private String sceneInfo;
|
||||
|
||||
protected SceneInfoApp(){
|
||||
|
||||
}
|
||||
|
||||
private SceneInfoApp(String type, String name, String path) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
@ -31,29 +45,45 @@ public class SceneInfoApp {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String getSceneInfo() {
|
||||
return sceneInfo;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setSceneInfo(String sceneInfo) {
|
||||
this.sceneInfo = sceneInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* IOS应用
|
||||
* APP环境直接使用APP支付,此方法将作废
|
||||
*
|
||||
* @param appName 应用名
|
||||
* @param bundleId 模块ID
|
||||
* @return
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public static SceneInfoApp createIOSAPP(String appName, String bundleId) {
|
||||
SceneInfoApp app = new SceneInfoApp("IOS", appName, bundleId);
|
||||
String sceneInfo = String
|
||||
@ -65,11 +95,14 @@ public class SceneInfoApp {
|
||||
|
||||
/**
|
||||
* Android应用
|
||||
* APP环境直接使用APP支付,此方法将作废
|
||||
*
|
||||
* @param appName 应用名
|
||||
* @param packageName 包名
|
||||
* @return
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public static SceneInfoApp createAndroidAPP(String appName, String packageName) {
|
||||
SceneInfoApp app = new SceneInfoApp("Android", appName, packageName);
|
||||
String sceneInfo = String
|
||||
@ -96,4 +129,9 @@ public class SceneInfoApp {
|
||||
app.setSceneInfo(sceneInfo);
|
||||
return app;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toJson() {
|
||||
return String.format("{\"h5_info\": %s}", JSON.toJSONString(this));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.foxinmy.weixin4j.pay.payment.mch;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
@ -9,7 +10,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class SceneInfoStore {
|
||||
public class SceneInfoStore implements SceneInfo {
|
||||
/**
|
||||
* SZTX001 门店唯一标识
|
||||
*/
|
||||
@ -67,9 +68,22 @@ public class SceneInfoStore {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public SceneInfoStore(String id, String name, String areaCode, String address) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.areaCode = areaCode;
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SceneInfoStore [id=" + id + ", name=" + name + ", areaCode="
|
||||
+ areaCode + ", address=" + address + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toJson() {
|
||||
return String.format("{\"store_info\": %s}", JSON.toJSONString(this));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package com.foxinmy.weixin4j.pay.profitsharing;
|
||||
|
||||
import com.foxinmy.weixin4j.pay.type.ProfitIdType;
|
||||
|
||||
/**
|
||||
* 分帐单单号
|
||||
*
|
||||
* @author kit
|
||||
* @date 2020年05月25日
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public class ProfitId {
|
||||
private String id;
|
||||
private ProfitIdType idType;
|
||||
|
||||
public ProfitId(String id, ProfitIdType type){
|
||||
this.id = id;
|
||||
this.idType = type;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public ProfitIdType getIdType() {
|
||||
return idType;
|
||||
}
|
||||
|
||||
public void setIdType(ProfitIdType idType) {
|
||||
this.idType = idType;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
package com.foxinmy.weixin4j.pay.profitsharing;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.pay.payment.mch.MerchantResult;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 单次分帐的请求内容
|
||||
*
|
||||
* @author kit(kit.li@qq.com)
|
||||
* @date 2020年5月25日
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public class ProfitSharingRequest extends MerchantResult {
|
||||
/**
|
||||
* 只支持HMAC-SHA256
|
||||
*/
|
||||
@XmlElement(name = "sign_type")
|
||||
@JSONField(name = "sign_type")
|
||||
private final String signType = "HMAC-SHA256";
|
||||
/**
|
||||
* 微信支付订单号
|
||||
*/
|
||||
@XmlElement(name = "transaction_id")
|
||||
@JSONField(name = "transaction_id")
|
||||
private String transactionId;
|
||||
/**
|
||||
* 商户订单号
|
||||
*/
|
||||
@XmlElement(name = "out_order_no")
|
||||
@JSONField(name = "out_order_no")
|
||||
private String outOrderNo;
|
||||
/**
|
||||
* 分账接收方列表,不超过50个
|
||||
*/
|
||||
private String receivers;
|
||||
/**
|
||||
* 分账完结描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
public ProfitSharingRequest(String transactionId, String outOrderNo, List<ReceiverProfit> receivers){
|
||||
this.transactionId = transactionId;
|
||||
this.outOrderNo = outOrderNo;
|
||||
this.receivers = receivers!=null && receivers.size()>0 ? JSON.toJSONString(receivers) : null;
|
||||
}
|
||||
|
||||
public String getTransactionId() {
|
||||
return transactionId;
|
||||
}
|
||||
|
||||
public void setTransactionId(String transactionId) {
|
||||
this.transactionId = transactionId;
|
||||
}
|
||||
|
||||
public String getOutOrderNo() {
|
||||
return outOrderNo;
|
||||
}
|
||||
|
||||
public void setOutOrderNo(String outOrderNo) {
|
||||
this.outOrderNo = outOrderNo;
|
||||
}
|
||||
|
||||
public String getReceivers() {
|
||||
return receivers;
|
||||
}
|
||||
|
||||
public void setReceivers(String receivers) {
|
||||
this.receivers = receivers;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSignType() {
|
||||
return signType;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,134 @@
|
||||
package com.foxinmy.weixin4j.pay.profitsharing;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.pay.payment.mch.MerchantResult;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 单次分帐返回结果
|
||||
*
|
||||
* @author kit
|
||||
* @date 2020年05月25日
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public class ProfitSharingResult extends MerchantResult {
|
||||
/**
|
||||
* 微信支付订单号
|
||||
*/
|
||||
@XmlElement(name = "transaction_id")
|
||||
@JSONField(name = "transaction_id")
|
||||
private String transactionId;
|
||||
/**
|
||||
* 商户订单号
|
||||
*/
|
||||
@XmlElement(name = "out_trade_no")
|
||||
@JSONField(name = "out_trade_no")
|
||||
private String outOrderNo;
|
||||
/**
|
||||
* 微信分帐单号
|
||||
*/
|
||||
@XmlElement(name = "order_id")
|
||||
@JSONField(name = "order_id")
|
||||
private String orderId;
|
||||
/**
|
||||
* 分账单状态(分帐查询)
|
||||
* ACCEPTED—受理成功
|
||||
* PROCESSING—处理中
|
||||
* FINISHED—处理完成
|
||||
* CLOSED—处理失败,已关单
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 关单原因(分帐查询),非必传,默认值:NO_AUTH----分账授权已解除
|
||||
*/
|
||||
@XmlElement(name = "close_reason")
|
||||
@JSONField(name = "close_reason")
|
||||
private String closeReason;
|
||||
/**
|
||||
* 分账接收方列表(分帐查询)
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
private String receivers;
|
||||
/**
|
||||
* 分账金额(分帐查询)
|
||||
* 分账完结的分账金额,单位为分, 仅当查询分账完结的执行结果时,存在本字段
|
||||
*/
|
||||
private Integer amount;
|
||||
/**
|
||||
* 分帐描述(分帐查询)
|
||||
* 分账完结的原因描述,仅当查询分账完结的执行结果时,存在本字段
|
||||
*/
|
||||
private String description;
|
||||
|
||||
public String getTransactionId() {
|
||||
return transactionId;
|
||||
}
|
||||
|
||||
public void setTransactionId(String transactionId) {
|
||||
this.transactionId = transactionId;
|
||||
}
|
||||
|
||||
public String getOutOrderNo() {
|
||||
return outOrderNo;
|
||||
}
|
||||
|
||||
public void setOutOrderNo(String outOrderNo) {
|
||||
this.outOrderNo = outOrderNo;
|
||||
}
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getCloseReason() {
|
||||
return closeReason;
|
||||
}
|
||||
|
||||
public void setCloseReason(String closeReason) {
|
||||
this.closeReason = closeReason;
|
||||
}
|
||||
|
||||
public String getReceivers() {
|
||||
return receivers;
|
||||
}
|
||||
|
||||
public void setReceivers(String receivers) {
|
||||
this.receivers = receivers;
|
||||
}
|
||||
|
||||
public Integer getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(Integer amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@JSONField(name = "receivers")
|
||||
public List<ReceiverProfitResult> getProfitResult(){
|
||||
return JSON.parseArray(this.receivers, ReceiverProfitResult.class);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,169 @@
|
||||
package com.foxinmy.weixin4j.pay.profitsharing;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.pay.payment.mch.MerchantResult;
|
||||
import com.foxinmy.weixin4j.pay.type.profitsharing.ReturnAccountType;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
/**
|
||||
* 分帐回退API请求内容
|
||||
*
|
||||
* @author kit (kit.li@qq.com)
|
||||
* @date 2020年05月25日
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public class ProfitSharingReturnRequest extends MerchantResult {
|
||||
/**
|
||||
* 只支持HMAC-SHA256
|
||||
*/
|
||||
@XmlElement(name = "sign_type")
|
||||
@JSONField(name = "sign_type")
|
||||
private final String signType = "HMAC-SHA256";
|
||||
/**
|
||||
* 微信分帐单号
|
||||
* 原发起分账请求时,微信返回的微信分账单号,与商户分账单号一一对应。微信分账单号与商户分账单号二选一填写
|
||||
*/
|
||||
private String orderId;
|
||||
/**
|
||||
* 商户订单号
|
||||
* 原发起分账请求时使用的商户系统内部的分账单号。微信分账单号与商户分账单号二选一填写
|
||||
*/
|
||||
@XmlElement(name = "out_trade_no")
|
||||
@JSONField(name = "out_trade_no")
|
||||
private String outOrderNo;
|
||||
/**
|
||||
* 商户回退单号
|
||||
*/
|
||||
@XmlElement(name = "out_return_no")
|
||||
@JSONField(name = "out_return_no")
|
||||
private String outReturnNo;
|
||||
/**
|
||||
* 回退方类型
|
||||
*/
|
||||
@XmlElement(name = "return_account_type")
|
||||
@JSONField(name = "return_account_type")
|
||||
private ReturnAccountType returnAccountType = ReturnAccountType.MERCHANT_ID;
|
||||
/**
|
||||
* 回退方账号
|
||||
* 当回退方类型为商户ID时,填写商户ID
|
||||
*/
|
||||
@XmlElement(name = "return_account")
|
||||
@JSONField(name = "return_account")
|
||||
private String returnAccount;
|
||||
/**
|
||||
* 回退金额
|
||||
*/
|
||||
@XmlElement(name = "return_amount")
|
||||
@JSONField(name = "return_amount")
|
||||
private int returnAmount;
|
||||
/**
|
||||
* 回退描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 用于回退查询的参数构造方法
|
||||
*
|
||||
* @param orderId
|
||||
* 微信分帐单号
|
||||
* @param outOrderNo
|
||||
* 商户分帐单号
|
||||
* @param outReturnNo
|
||||
* 商户回退单号
|
||||
*/
|
||||
public ProfitSharingReturnRequest(String orderId, String outOrderNo, String outReturnNo) {
|
||||
this.orderId = orderId;
|
||||
this.outOrderNo = outOrderNo;
|
||||
this.outReturnNo = outReturnNo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于回退请求的参数构造方法
|
||||
*
|
||||
* @param orderId
|
||||
* 微信分帐单号
|
||||
* @param outOrderNo
|
||||
* 商户分帐单号
|
||||
* @param outReturnNo
|
||||
* 商户回退单号
|
||||
* @param returnAccountType
|
||||
* 回退方类型
|
||||
* @param returnAccount
|
||||
* 回退方帐号
|
||||
* @param description
|
||||
* 回退描述
|
||||
*/
|
||||
public ProfitSharingReturnRequest(String orderId, String outOrderNo, String outReturnNo,
|
||||
ReturnAccountType returnAccountType, String returnAccount,
|
||||
int returnAmount, String description) {
|
||||
this.orderId = orderId;
|
||||
this.outOrderNo = outOrderNo;
|
||||
this.outReturnNo = outReturnNo;
|
||||
this.returnAccountType = returnAccountType;
|
||||
this.returnAccount = returnAccount;
|
||||
this.returnAmount = returnAmount;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSignType() {
|
||||
return signType;
|
||||
}
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public String getOutOrderNo() {
|
||||
return outOrderNo;
|
||||
}
|
||||
|
||||
public void setOutOrderNo(String outOrderNo) {
|
||||
this.outOrderNo = outOrderNo;
|
||||
}
|
||||
|
||||
public String getOutReturnNo() {
|
||||
return outReturnNo;
|
||||
}
|
||||
|
||||
public void setOutReturnNo(String outReturnNo) {
|
||||
this.outReturnNo = outReturnNo;
|
||||
}
|
||||
|
||||
public ReturnAccountType getReturnAccountType() {
|
||||
return returnAccountType;
|
||||
}
|
||||
|
||||
public void setReturnAccountType(ReturnAccountType returnAccountType) {
|
||||
this.returnAccountType = returnAccountType;
|
||||
}
|
||||
|
||||
public String getReturnAccount() {
|
||||
return returnAccount;
|
||||
}
|
||||
|
||||
public void setReturnAccount(String returnAccount) {
|
||||
this.returnAccount = returnAccount;
|
||||
}
|
||||
|
||||
public int getReturnAmount() {
|
||||
return returnAmount;
|
||||
}
|
||||
|
||||
public void setReturnAmount(int returnAmount) {
|
||||
this.returnAmount = returnAmount;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,167 @@
|
||||
package com.foxinmy.weixin4j.pay.profitsharing;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.pay.payment.mch.MerchantResult;
|
||||
import com.foxinmy.weixin4j.pay.type.profitsharing.ReturnAccountType;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
/**
|
||||
* 分帐回退/回退查询返回内容
|
||||
*
|
||||
* @author kit(kit.li@qq.com)
|
||||
* @date 2020年05年25日
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public class ProfitSharingReturnResult extends MerchantResult {
|
||||
/**
|
||||
* 微信分账单号
|
||||
*/
|
||||
@XmlElement(name = "order_id")
|
||||
@JSONField(name = "order_id")
|
||||
private String orderId;
|
||||
/**
|
||||
* 商户分账单号
|
||||
*/
|
||||
@XmlElement(name = "out_order_no")
|
||||
@JSONField(name = "out_order_no")
|
||||
private String outOrderNo;
|
||||
/**
|
||||
* 商户回退单号
|
||||
*/
|
||||
@XmlElement(name = "out_return_no")
|
||||
@JSONField(name = "out_return_no")
|
||||
private String outReturnNo;
|
||||
/**
|
||||
* 微信回退单号
|
||||
*/
|
||||
@XmlElement(name = "return_no")
|
||||
@JSONField(name = "return_no")
|
||||
private String returnNo;
|
||||
/**
|
||||
* 回退方类型
|
||||
*/
|
||||
@XmlElement(name = "return_account_type")
|
||||
@JSONField(name = "return_account_type")
|
||||
private ReturnAccountType returnAccountType;
|
||||
/**
|
||||
* 回退方账号
|
||||
*/
|
||||
@XmlElement(name = "return_account")
|
||||
@JSONField(name = "return_account")
|
||||
private String returnAccount;
|
||||
/**
|
||||
* 回退金额
|
||||
*/
|
||||
@XmlElement(name = "return_amount")
|
||||
@JSONField(name = "return_amount")
|
||||
private Integer returnAmount;
|
||||
/**
|
||||
* 回退描述
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 回退结果
|
||||
*/
|
||||
private String result;
|
||||
/**
|
||||
* 失败原因
|
||||
*/
|
||||
@XmlElement(name = "fail_reason")
|
||||
@JSONField(name = "fail_reason")
|
||||
private String failReason;
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@XmlElement(name = "finish_time")
|
||||
@JSONField(name = "finish_time")
|
||||
private String finishTime;
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public String getOutOrderNo() {
|
||||
return outOrderNo;
|
||||
}
|
||||
|
||||
public void setOutOrderNo(String outOrderNo) {
|
||||
this.outOrderNo = outOrderNo;
|
||||
}
|
||||
|
||||
public String getOutReturnNo() {
|
||||
return outReturnNo;
|
||||
}
|
||||
|
||||
public void setOutReturnNo(String outReturnNo) {
|
||||
this.outReturnNo = outReturnNo;
|
||||
}
|
||||
|
||||
public String getReturnNo() {
|
||||
return returnNo;
|
||||
}
|
||||
|
||||
public void setReturnNo(String returnNo) {
|
||||
this.returnNo = returnNo;
|
||||
}
|
||||
|
||||
public ReturnAccountType getReturnAccountType() {
|
||||
return returnAccountType;
|
||||
}
|
||||
|
||||
public void setReturnAccountType(ReturnAccountType returnAccountType) {
|
||||
this.returnAccountType = returnAccountType;
|
||||
}
|
||||
|
||||
public String getReturnAccount() {
|
||||
return returnAccount;
|
||||
}
|
||||
|
||||
public void setReturnAccount(String returnAccount) {
|
||||
this.returnAccount = returnAccount;
|
||||
}
|
||||
|
||||
public Integer getReturnAmount() {
|
||||
return returnAmount;
|
||||
}
|
||||
|
||||
public void setReturnAmount(Integer returnAmount) {
|
||||
this.returnAmount = returnAmount;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public String getFailReason() {
|
||||
return failReason;
|
||||
}
|
||||
|
||||
public void setFailReason(String failReason) {
|
||||
this.failReason = failReason;
|
||||
}
|
||||
|
||||
public String getFinishTime() {
|
||||
return finishTime;
|
||||
}
|
||||
|
||||
public void setFinishTime(String finishTime) {
|
||||
this.finishTime = finishTime;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,105 @@
|
||||
package com.foxinmy.weixin4j.pay.profitsharing;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.pay.type.profitsharing.ReceiverType;
|
||||
import com.foxinmy.weixin4j.pay.type.profitsharing.RelationType;
|
||||
|
||||
/**
|
||||
* 分账接收方基础信息
|
||||
* 用于添加或删除分帐接收方时使用
|
||||
*
|
||||
* @author kit(kit_21cn@21cn.com)
|
||||
* @date 2020年05月20日
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public class Receiver {
|
||||
|
||||
public Receiver(){}
|
||||
|
||||
public Receiver(ReceiverType type, String account, RelationType relationType) {
|
||||
this.type = type;
|
||||
this.account = account;
|
||||
this.relationType = relationType;
|
||||
}
|
||||
|
||||
public Receiver(ReceiverType type, String account, String name, RelationType relationType, String customRelation) {
|
||||
this.type = type;
|
||||
this.account = account;
|
||||
this.name = name;
|
||||
this.relationType = relationType;
|
||||
this.customRelation = customRelation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分账接收方类型
|
||||
*/
|
||||
private ReceiverType type;
|
||||
/**
|
||||
* 分账接收方帐号
|
||||
* 类型是MERCHANT_ID时,是商户ID
|
||||
* 类型是PERSONAL_WECHATID时,是个人微信号
|
||||
* 类型是PERSONAL_OPENID时,是个人openid
|
||||
* 类型是PERSONAL_SUB_OPENID时,是个人sub_openid
|
||||
*/
|
||||
private String account;
|
||||
/**
|
||||
* 分账接收方全称
|
||||
* 分账接收方类型是MERCHANT_ID时,是商户全称(必传)
|
||||
* 分账接收方类型是PERSONAL_WECHATID 时,是个人姓名(必传)
|
||||
* 分账接收方类型是PERSONAL_OPENID时,是个人姓名(选传,传则校验)
|
||||
* 分账接收方类型是PERSONAL_SUB_OPENID时,是个人姓名(选传,传则校验)
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 与分账方的关系类型
|
||||
*/
|
||||
@JSONField(name = "relation_type")
|
||||
private RelationType relationType;
|
||||
/**
|
||||
* 自定义的分账关系
|
||||
* 子商户与接收方具体的关系,本字段最多10个字。
|
||||
* 当字段relation_type的值为CUSTOM时,本字段必填
|
||||
*/
|
||||
@JSONField(name = "custom_relation")
|
||||
private String customRelation;
|
||||
|
||||
public ReceiverType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(ReceiverType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public RelationType getRelationType() {
|
||||
return relationType;
|
||||
}
|
||||
|
||||
public void setRelationType(RelationType relationType) {
|
||||
this.relationType = relationType;
|
||||
}
|
||||
|
||||
public String getCustomRelation() {
|
||||
return customRelation;
|
||||
}
|
||||
|
||||
public void setCustomRelation(String customRelation) {
|
||||
this.customRelation = customRelation;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.foxinmy.weixin4j.pay.profitsharing;
|
||||
|
||||
import com.foxinmy.weixin4j.pay.type.profitsharing.ReceiverType;
|
||||
|
||||
/**
|
||||
* 请求分帐时使用的分帐方信息
|
||||
*
|
||||
* @author kit(kit.li@qq.com)
|
||||
* @date 2020年05月25日
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public class ReceiverProfit extends Receiver {
|
||||
private int amount;
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* json deserialize need
|
||||
*/
|
||||
public ReceiverProfit(){
|
||||
super();
|
||||
}
|
||||
|
||||
public ReceiverProfit(ReceiverType type, String account, int amount, String description){
|
||||
super(type, account, null);
|
||||
this.amount = amount;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package com.foxinmy.weixin4j.pay.profitsharing;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.pay.type.profitsharing.ReceiverType;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
/**
|
||||
* 分帐方添加删除API调用结果
|
||||
*
|
||||
* @author kit (kit.li@qq.com)
|
||||
* @date 2020年05月25日
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public class ReceiverProfitResult extends ReceiverProfit {
|
||||
/**
|
||||
* 分帐结果:
|
||||
* PENDING:待分账
|
||||
* SUCCESS:分账成功
|
||||
* ADJUST:分账失败待调账
|
||||
* RETURNED:已转回分账方
|
||||
* CLOSED: 已关闭
|
||||
*/
|
||||
private String result;
|
||||
/**
|
||||
* 分账完成时间
|
||||
*/
|
||||
@XmlElement(name = "finish_time")
|
||||
@JSONField(name = "finish_time")
|
||||
private String finishTime;
|
||||
@XmlElement(name = "fail_reason")
|
||||
@JSONField(name = "fail_reason")
|
||||
private String failReason;
|
||||
|
||||
public ReceiverProfitResult(ReceiverType type, String account, int amount, String description, String result){
|
||||
super(type, account, amount, description);
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public String getFinishTime() {
|
||||
return finishTime;
|
||||
}
|
||||
|
||||
public void setFinishTime(String finishTime) {
|
||||
this.finishTime = finishTime;
|
||||
}
|
||||
|
||||
public String getFailReason() {
|
||||
return failReason;
|
||||
}
|
||||
|
||||
public void setFailReason(String failReason) {
|
||||
this.failReason = failReason;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.foxinmy.weixin4j.pay.profitsharing;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.pay.payment.mch.MerchantResult;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
/**
|
||||
* 分帐方添加及删除的API请求
|
||||
*
|
||||
* @author kit (kit.li@qq.com)
|
||||
* @date 2020年05月20日
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public class ReceiverRequest extends MerchantResult {
|
||||
|
||||
@XmlElement(name = "sign_type")
|
||||
@JSONField(name = "sign_type")
|
||||
private final String signType = "HMAC-SHA256";
|
||||
|
||||
public ReceiverRequest(Receiver receiver){
|
||||
super();
|
||||
this.receiver = JSON.toJSONString(receiver);
|
||||
}
|
||||
|
||||
private String receiver;
|
||||
|
||||
public String getReceiver() {
|
||||
return this.receiver;
|
||||
}
|
||||
|
||||
public void setReceiver(String receiver) {
|
||||
this.receiver = receiver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSignType() {
|
||||
return signType;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.foxinmy.weixin4j.pay.profitsharing;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.pay.payment.mch.MerchantResult;
|
||||
|
||||
/**
|
||||
* 微信支付-服务商分帐接口-分帐接收方API返回结果
|
||||
*
|
||||
* @author kit(kit_21cn@21cn.com)
|
||||
* @className ProfitSharingReceiverResult
|
||||
* @date 2020年05月20日
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public class ReceiverResult extends MerchantResult {
|
||||
/**
|
||||
* 分账接收方对象,json格式字符串
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
private String receiver;
|
||||
|
||||
public String getReceiver() {
|
||||
return receiver;
|
||||
}
|
||||
|
||||
public void setReceiver(String receiver) {
|
||||
this.receiver = receiver;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回接收方java对象
|
||||
*/
|
||||
@JSONField(name = "receiver")
|
||||
public Receiver getReceiverObject(){
|
||||
try {
|
||||
return JSON.parseObject(receiver, Receiver.class);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.foxinmy.weixin4j.pay.type;
|
||||
|
||||
/**
|
||||
* 分帐单号类型
|
||||
*
|
||||
* @author kit (kit.li@qq.com)
|
||||
* @date 2020年05月25日
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public enum ProfitIdType {
|
||||
/**
|
||||
* 微信分帐单号
|
||||
*/
|
||||
ORDER_ID,
|
||||
/**
|
||||
* 商户分帐单号
|
||||
*/
|
||||
OUT_ORDER_NO
|
||||
}
|
||||
@ -8,7 +8,6 @@ package com.foxinmy.weixin4j.pay.type;
|
||||
* @date 2014年11月2日
|
||||
* @since JDK 1.6
|
||||
* @see
|
||||
* @deprecated 迁移到子模块weixin4j-pay
|
||||
*/
|
||||
public enum TradeState {
|
||||
/**
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
package com.foxinmy.weixin4j.pay.type.mch;
|
||||
|
||||
/**
|
||||
* 是否押金支付
|
||||
*
|
||||
* @className DepositType
|
||||
* @author kit(kit_21cn@21cn.com)
|
||||
* @date 2019年9月21日
|
||||
* @since JDK 1.6
|
||||
*/
|
||||
public enum DepositType {
|
||||
/**
|
||||
* 是
|
||||
*/
|
||||
Y,
|
||||
/**
|
||||
* 否
|
||||
*/
|
||||
N;
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.foxinmy.weixin4j.pay.type.profitsharing;
|
||||
|
||||
/**
|
||||
* 分帐接收方类型
|
||||
*
|
||||
* @author kit (kit.li@qq.com)
|
||||
* @date 2020年05月20日
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public enum ReceiverType {
|
||||
/**
|
||||
* 商户ID
|
||||
*/
|
||||
MERCHANT_ID,
|
||||
/**
|
||||
* 个人微信号
|
||||
*/
|
||||
PERSONAL_WECHATID,
|
||||
/**
|
||||
* 个人微信openid
|
||||
*/
|
||||
PERSONAL_OPENID,
|
||||
/**
|
||||
* 个人微信sub_openid (对应服务商API的子商户sub_appid转换得到)
|
||||
*/
|
||||
PERSONAL_SUB_OPENID;
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package com.foxinmy.weixin4j.pay.type.profitsharing;
|
||||
|
||||
/**
|
||||
* 子商户与接收方的关系
|
||||
*
|
||||
* @author kit (kit.li@qq.com)
|
||||
* @date 2020年05月20日
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public enum RelationType {
|
||||
/**
|
||||
* 服务商
|
||||
*/
|
||||
SERVICE_PROVIDER,
|
||||
/**
|
||||
* 门店
|
||||
*/
|
||||
STORE,
|
||||
/**
|
||||
* 员工
|
||||
*/
|
||||
STAFF,
|
||||
/**
|
||||
* 店主
|
||||
*/
|
||||
STORE_OWNER,
|
||||
/**
|
||||
* 合作伙伴
|
||||
*/
|
||||
PARTNER,
|
||||
/**
|
||||
* 总部
|
||||
*/
|
||||
HEADQUARTER,
|
||||
/**
|
||||
* 品牌方
|
||||
*/
|
||||
BRAND,
|
||||
/**
|
||||
* 分销商
|
||||
*/
|
||||
DISTRIBUTOR,
|
||||
/**
|
||||
* 用户
|
||||
*/
|
||||
USER,
|
||||
/**
|
||||
* 供应商
|
||||
*/
|
||||
SUPPLIER,
|
||||
/**
|
||||
* 自定义
|
||||
*/
|
||||
CUSTOM;
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.foxinmy.weixin4j.pay.type.profitsharing;
|
||||
|
||||
/**
|
||||
* 分帐回退的回退方类型
|
||||
*
|
||||
* @author kit
|
||||
* @date 2020年05月25日
|
||||
* @since weixin4j-pay 1.1.0
|
||||
*/
|
||||
public enum ReturnAccountType {
|
||||
/**
|
||||
* 商户ID
|
||||
* 目前仅支付商户接收方的回退
|
||||
*/
|
||||
MERCHANT_ID
|
||||
}
|
||||
@ -62,3 +62,19 @@ facepay_url={mch_base_url}/pay/facepay
|
||||
deposit_facepay_uri={mch_base_url}/deposit/facepay
|
||||
# \u652F\u4ED8\u62BC\u91D1\uFF08\u4ED8\u6B3E\u7801\uFF09
|
||||
deposit_micropay_uri={mch_base_url}/deposit/micropay
|
||||
# \u670D\u52A1\u5546\u5206\u5E10\u63A5\u53E3--\u6DFB\u52A0\u5206\u8D26\u63A5\u6536\u65B9
|
||||
profit_sharing_add_receiver_uri={mch_base_url}/pay/profitsharingaddreceiver
|
||||
# \u670D\u52A1\u5546\u5206\u5E10\u63A5\u53E3--\u5220\u9664\u5206\u8D26\u63A5\u6536\u65B9
|
||||
profit_sharing_remove_receiver_uri={mch_base_url}/pay/profitsharingremovereceiver
|
||||
# \u8BF7\u6C42\u5355\u6B21\u5206\u5E10
|
||||
profit_sharing_uri={mch_base_url}/secapi/pay/profitsharing
|
||||
# \u8BF7\u6C42\u591A\u6B21\u5206\u5E10
|
||||
multi_profit_sharing_uri={mch_base_url}/secapi/pay/multiprofitsharing
|
||||
# \u67E5\u8BE2\u5206\u8D26\u7ED3\u679C
|
||||
profit_sharing_query_uri={mch_base_url}/pay/profitsharingquery
|
||||
# \u5206\u5E10\u5B8C\u7ED3
|
||||
profit_sharing_finish_uri={mch_base_url}/secapi/pay/profitsharingfinish
|
||||
# \u5206\u5E10\u56DE\u9000
|
||||
profit_sharing_return_uri={mch_base_url}/secapi/pay/profitsharingreturn
|
||||
# \u5206\u5E10\u56DE\u9000\u67E5\u8BE2
|
||||
profit_sharing_return_query_uri={mch_base_url}/pay/profitsharingreturnquery
|
||||
@ -0,0 +1,37 @@
|
||||
package com.foxinmy.weixin4j.pay.test;
|
||||
|
||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
import com.foxinmy.weixin4j.pay.PayPackageBuilder;
|
||||
import com.foxinmy.weixin4j.pay.WeixinPayProxy;
|
||||
import com.foxinmy.weixin4j.pay.model.WeixinPayAccount;
|
||||
import com.foxinmy.weixin4j.pay.payment.mch.MICROPayRequest;
|
||||
import com.foxinmy.weixin4j.pay.payment.mch.MchPayPackage;
|
||||
import com.foxinmy.weixin4j.pay.payment.mch.MchPayRequest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* 一个支付例子
|
||||
*
|
||||
* @author kit (kit.li@qq.com)
|
||||
*/
|
||||
public class PayApiExample {
|
||||
|
||||
/**
|
||||
* 这是一个付款码支付的例子
|
||||
*
|
||||
* @throws WeixinException
|
||||
*/
|
||||
@Test
|
||||
public void testPay() throws WeixinException {
|
||||
WeixinPayAccount payAccount = new WeixinPayAccount("你的appid", "支付密钥", "商户号");
|
||||
MchPayPackage payPackage = PayPackageBuilder.microPay("body内容", "商户订单号", 1.00D, "127.0.0.1",
|
||||
"你的付款码")
|
||||
.attach("这是一个测试")
|
||||
.limitPay()
|
||||
.build();
|
||||
WeixinPayProxy proxy = new WeixinPayProxy(payAccount);
|
||||
MICROPayRequest r = (MICROPayRequest) proxy.createPayRequest(payPackage);
|
||||
Assert.assertEquals(r.getResultCode(), "SUCCESS");
|
||||
}
|
||||
}
|
||||
@ -1,31 +0,0 @@
|
||||
package com.foxinmy.weixin4j.pay.test;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
import com.foxinmy.weixin4j.pay.WeixinPayProxy;
|
||||
import com.foxinmy.weixin4j.pay.model.WeixinPayAccount;
|
||||
import com.foxinmy.weixin4j.pay.payment.mch.MchPayRequest;
|
||||
import com.foxinmy.weixin4j.pay.type.mch.DepositType;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TestFacePay {
|
||||
@Test
|
||||
public void test() throws WeixinException {
|
||||
String appid = "";
|
||||
String mchid = "";
|
||||
String paySignKey = "";
|
||||
WeixinPayAccount payAccount = new WeixinPayAccount(appid, paySignKey, mchid);
|
||||
WeixinPayProxy proxy = new WeixinPayProxy(payAccount);
|
||||
|
||||
String orderNo = "TESTORDER2019092001";
|
||||
String openId = "oguJRswolIOGg7Vd1VaqGJuDBFAE";
|
||||
String faceCode = "0f879a6c-5fff-421c-a233-5fac0f4aad12";
|
||||
|
||||
MchPayRequest rsp = proxy.createFacePayRequest(faceCode, "测试的人脸支付",
|
||||
orderNo, 1,
|
||||
"127.0.0.1", openId, null);
|
||||
|
||||
JSONObject obj = (JSONObject) JSON.toJSON(rsp);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.foxinmy.weixin4j.pay.test;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
import com.foxinmy.weixin4j.pay.WeixinPayProxy;
|
||||
import com.foxinmy.weixin4j.pay.model.WeixinPayAccount;
|
||||
import com.foxinmy.weixin4j.pay.profitsharing.*;
|
||||
import com.foxinmy.weixin4j.pay.type.profitsharing.ReceiverType;
|
||||
import com.foxinmy.weixin4j.pay.type.profitsharing.RelationType;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TestProfitSharingApi {
|
||||
// 微信公众号appid
|
||||
private static String APPID = "";
|
||||
// 微信支付商户密钥
|
||||
private static String PAY_SIGN_KEY = "";
|
||||
// 商户号
|
||||
private static String MCHID = "";
|
||||
//
|
||||
private static String OPENID = "";
|
||||
|
||||
/**
|
||||
* 测试添加分帐方
|
||||
*/
|
||||
@Test
|
||||
public void testAddReceiver() throws WeixinException {
|
||||
Receiver receiver = new Receiver(ReceiverType.PERSONAL_OPENID, OPENID, RelationType.STAFF);
|
||||
WeixinPayAccount account = new WeixinPayAccount(APPID, PAY_SIGN_KEY, MCHID);
|
||||
WeixinPayProxy proxy = new WeixinPayProxy(account);
|
||||
ReceiverResult result = proxy.addProfitSharingReceiver(receiver);
|
||||
System.out.println(JSON.toJSONString(result));
|
||||
Assert.assertEquals(result.getReturnCode(), "SUCCESS");
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试删除分帐方
|
||||
*/
|
||||
@Test
|
||||
public void testRemoveReceiver() throws WeixinException {
|
||||
Receiver receiver = new Receiver(ReceiverType.PERSONAL_OPENID, OPENID, null);
|
||||
WeixinPayAccount account = new WeixinPayAccount(APPID, PAY_SIGN_KEY, MCHID);
|
||||
WeixinPayProxy proxy = new WeixinPayProxy(account);
|
||||
ReceiverResult result = proxy.removeProfitSharingReceiver(receiver);
|
||||
System.out.println(JSON.toJSONString(result));
|
||||
Assert.assertEquals(result.getReturnCode(), "SUCCESS");
|
||||
}
|
||||
|
||||
/**
|
||||
* 单次分帐
|
||||
*
|
||||
* @throws WeixinException
|
||||
*/
|
||||
@Test
|
||||
public void testProfitSharing() throws WeixinException {
|
||||
ReceiverProfit receiverProfit = new ReceiverProfit(ReceiverType.MERCHANT_ID, "", 1, "test");
|
||||
List<ReceiverProfit> list = new ArrayList<ReceiverProfit>();
|
||||
list.add(receiverProfit);
|
||||
WeixinPayAccount account = new WeixinPayAccount(APPID, PAY_SIGN_KEY, MCHID);
|
||||
WeixinPayProxy proxy = new WeixinPayProxy(account);
|
||||
ProfitSharingResult result = proxy.profitSharing("transactioId", "outOrderNo", list, false);
|
||||
System.out.println(JSON.toJSONString(result));
|
||||
Assert.assertEquals(result.getReturnCode(), "SUCCESS");
|
||||
}
|
||||
|
||||
}
|
||||
@ -30,6 +30,13 @@
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
</dependency>
|
||||
<!-- 兼容 JDK 9+ 后的maven环境编译 -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.2.11</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
||||
@ -26,6 +26,18 @@
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<!-- 兼容 JDK 9+ 后的maven环境编译 -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.2.11</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<version>1.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
|
||||
@ -35,11 +35,6 @@
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<version>1.55</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
||||
@ -15,6 +15,7 @@ import com.foxinmy.weixin4j.wxa.api.QrCodeApi;
|
||||
import com.foxinmy.weixin4j.wxa.api.SecCheckApi;
|
||||
import com.foxinmy.weixin4j.wxa.api.TemplateApi;
|
||||
import com.foxinmy.weixin4j.wxa.api.TemplateMessageApi;
|
||||
import com.foxinmy.weixin4j.wxa.api.SubscribeMessageApi;
|
||||
|
||||
/**
|
||||
* The facade of WeChat Mini Program APIs.
|
||||
@ -29,6 +30,7 @@ public class WeixinAppFacade {
|
||||
private final TemplateMessageApi templateMessageApi;
|
||||
private final CustomMessageApi customMessageApi;
|
||||
private final SecCheckApi secCheckApi;
|
||||
private final SubscribeMessageApi subscribeMessageApi;
|
||||
|
||||
/**
|
||||
* Constructs {@link WeixinAppFacade} using {@link FileCacheStorager}.
|
||||
@ -111,6 +113,7 @@ public class WeixinAppFacade {
|
||||
this.templateMessageApi = new TemplateMessageApi(tokenManager, properties);
|
||||
this.customMessageApi = new CustomMessageApi(tokenManager, properties);
|
||||
this.secCheckApi = new SecCheckApi(tokenManager, properties);
|
||||
this.subscribeMessageApi = new SubscribeMessageApi(tokenManager, properties);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -149,6 +152,15 @@ public class WeixinAppFacade {
|
||||
return templateMessageApi;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订阅消息相关的 API。
|
||||
*
|
||||
* @return 模板消息相关的 API。
|
||||
*/
|
||||
public SubscribeMessageApi getSubscribeMessageApi() {
|
||||
return subscribeMessageApi;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取客服消息相关的 API。
|
||||
*
|
||||
|
||||
@ -95,4 +95,22 @@ public class SecCheckApi extends TokenManagerApi {
|
||||
r.checkErrCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步校验图片/音频是否含有违法违规内容。
|
||||
*
|
||||
* @param mediaUrl 要检测的多媒体 URL
|
||||
* @param mediaType {@code 1}: 音频; {@code 2}: 图片
|
||||
* @return 任务 ID,用于匹配异步推送结果
|
||||
* @throws WeixinException indicates getting access token failed.
|
||||
* @see <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/sec-check/security.mediaCheckAsync.html">security.mediaCheckAsync</a>
|
||||
*/
|
||||
public String mediaCheckAsync(String mediaUrl, int mediaType) throws WeixinException {
|
||||
final Map<String, Object> params = new HashMap<String, Object>(2);
|
||||
params.put("media_url", mediaUrl);
|
||||
params.put("media_type", mediaType);
|
||||
final WxaApiAsyncResult r = this.post("wxa_media_check_async", params, WxaApiAsyncResult.TYPE_REFERENCE);
|
||||
r.checkErrCode();
|
||||
return r.getTraceId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
package com.foxinmy.weixin4j.wxa.api;
|
||||
|
||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
import com.foxinmy.weixin4j.token.TokenManager;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
public class SubscribeMessageApi extends TokenManagerApi {
|
||||
|
||||
public SubscribeMessageApi(TokenManager tokenManager) {
|
||||
super(tokenManager, null);
|
||||
}
|
||||
|
||||
public SubscribeMessageApi(TokenManager tokenManager, Properties properties) {
|
||||
super(tokenManager, properties);
|
||||
}
|
||||
/**
|
||||
* 发送订阅消息
|
||||
*
|
||||
* @param toUser 接收者(用户)的 openid。
|
||||
* @param templateId 所需下发的订阅模板id
|
||||
* @param page 点击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数,(示例index?foo=bar)。该字段不填则模板无跳转。
|
||||
* @param data 模板内容,格式形如 { "key1": { "value": any }, "key2": { "value": any } }
|
||||
* @throws WeixinException indicates getting access token failed, or sending template message failed.
|
||||
* @see <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.send.html">发送订阅消息</a>
|
||||
*/
|
||||
public void sendSubscribeMessage(
|
||||
String toUser,
|
||||
String templateId,
|
||||
String page,
|
||||
Map<String, String> data
|
||||
) throws WeixinException {
|
||||
|
||||
final SubscribeMessageParameter message = new SubscribeMessageParameter(
|
||||
toUser, templateId, page, data
|
||||
);
|
||||
WxaApiResult r = this.post("wxopen_subscribe_message_send", message, WxaApiResult.TYPE_REFERENCE);
|
||||
r.checkErrCode();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
package com.foxinmy.weixin4j.wxa.api;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
class SubscribeMessageParameter {
|
||||
|
||||
private static final long serialVersionUID = 2018052601L;
|
||||
|
||||
private String toUser;
|
||||
private String templateId;
|
||||
private String page;
|
||||
private Map<String, SubscribeMessageData> data;
|
||||
|
||||
public SubscribeMessageParameter() {
|
||||
|
||||
}
|
||||
|
||||
public SubscribeMessageParameter(
|
||||
String toUser,
|
||||
String templateId,
|
||||
String page,
|
||||
Map<String, String> data
|
||||
) {
|
||||
this.toUser = toUser;
|
||||
this.templateId = templateId;
|
||||
this.page = page;
|
||||
if (data != null) {
|
||||
this.data = new HashMap<String, SubscribeMessageData>(data.size());
|
||||
for (Map.Entry<String, String> entry : data.entrySet()) {
|
||||
this.data.put(entry.getKey(), new SubscribeMessageData(entry.getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JSONField(name = "touser")
|
||||
public String getToUser() {
|
||||
return toUser;
|
||||
}
|
||||
|
||||
public void setToUser(String toUser) {
|
||||
this.toUser = toUser;
|
||||
}
|
||||
|
||||
@JSONField(name = "template_id")
|
||||
public String getTemplateId() {
|
||||
return templateId;
|
||||
}
|
||||
|
||||
public void setTemplateId(String templateId) {
|
||||
this.templateId = templateId;
|
||||
}
|
||||
|
||||
public String getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(String page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public Map<String, SubscribeMessageData> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Map<String, SubscribeMessageData> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* SubscribeMessageData
|
||||
*/
|
||||
public static class SubscribeMessageData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 2018052601L;
|
||||
|
||||
private String value;
|
||||
|
||||
public SubscribeMessageData() {
|
||||
|
||||
}
|
||||
|
||||
public SubscribeMessageData(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.foxinmy.weixin4j.wxa.api;
|
||||
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
|
||||
class WxaApiAsyncResult extends WxaApiResult {
|
||||
|
||||
private static final long serialVersionUID = 2020022001L;
|
||||
|
||||
public static final TypeReference<WxaApiAsyncResult> TYPE_REFERENCE
|
||||
= new TypeReference<WxaApiAsyncResult>() {
|
||||
};
|
||||
|
||||
private String traceId;
|
||||
|
||||
public WxaApiAsyncResult() {
|
||||
}
|
||||
|
||||
public String getTraceId() {
|
||||
return traceId;
|
||||
}
|
||||
|
||||
public void setTraceId(String traceId) {
|
||||
this.traceId = traceId;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
package com.foxinmy.weixin4j.wxa.model.subscribemessage;
|
||||
|
||||
/**
|
||||
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.send.html
|
||||
*/
|
||||
public enum ParameterType {
|
||||
|
||||
/**
|
||||
* 20个以内字符 可汉字、数字、字母或符号组合
|
||||
* 可汉字、数字、字母或符号组合
|
||||
*/
|
||||
THING("thing"),
|
||||
|
||||
/**
|
||||
* 24小时制时间格式(支持+年月日)
|
||||
* 例如:15:01,或:2019年10月1日 15:01
|
||||
*/
|
||||
TIME("time"),
|
||||
|
||||
/**
|
||||
* 年月日格式(支持+24小时制时间)
|
||||
* 例如:2019年10月1日,或:2019年10月1日 15:01
|
||||
*/
|
||||
DATE("date"),
|
||||
|
||||
/**
|
||||
* 10个以内纯汉字或20个以内纯字母或符号
|
||||
* 中文名10个汉字内;纯英文名20个字母内;中文和字母混合按中文名算,10个字内
|
||||
*/
|
||||
NAME("name"),
|
||||
|
||||
/**
|
||||
* 32位以内数字
|
||||
* 只能数字,可带小数
|
||||
*/
|
||||
NUMBER("number"),
|
||||
|
||||
/**
|
||||
* 32位以内字母
|
||||
* 只能字母
|
||||
*/
|
||||
LETTER("letter"),
|
||||
|
||||
/**
|
||||
* 5位以内符号
|
||||
* 只能符号
|
||||
*/
|
||||
SYMBOL("symbol"),
|
||||
|
||||
/**
|
||||
* 5个以内汉字
|
||||
* 5个以内纯汉字,例如:配送中
|
||||
*/
|
||||
PHRASE("phrase"),
|
||||
|
||||
/**
|
||||
* 1个币种符号+10位以内纯数字,可带小数,结尾可带“元”
|
||||
* 可带小数
|
||||
*/
|
||||
AMOUNT("amount"),
|
||||
|
||||
/**
|
||||
* 8位以内,第一位与最后一位可为汉字,其余为字母或数字
|
||||
* 车牌号码:粤A8Z888挂
|
||||
*/
|
||||
CAR_NUMBER("car_number"),
|
||||
|
||||
/**
|
||||
* 17位以内,数字、符号
|
||||
* 电话号码,例:+86-0766-66888866
|
||||
*/
|
||||
PHONE_NUMBER("phone_number"),
|
||||
|
||||
/**
|
||||
* 32位以内数字、字母或符号
|
||||
* 可数字、字母或符号组合
|
||||
*/
|
||||
CHARACTER_STRING("character_string");
|
||||
|
||||
private final String value;
|
||||
|
||||
ParameterType(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Models for {@link com.foxinmy.weixin4j.wxa.api.TemplateApi}.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
package com.foxinmy.weixin4j.wxa.model.subscribemessage;
|
||||
@ -38,6 +38,8 @@ wxopen_template_del={api_cgi_url}/wxopen/template/del?access_token=%s
|
||||
# \u53d1\u9001\u6a21\u7248\u6d88\u606f
|
||||
wxopen_template_message_send={api_cgi_url}/message/wxopen/template/send?access_token=%s
|
||||
|
||||
# \u53d1\u9001\u8ba2\u9605\u6d88\u606f
|
||||
wxopen_subscribe_message_send={api_cgi_url}/message/subscribe/send?access_token=%s
|
||||
|
||||
# \u53d1\u9001\u5ba2\u670d\u6d88\u606f
|
||||
message_custom_send={api_cgi_url}/message/custom/send?access_token=%s
|
||||
@ -48,5 +50,8 @@ message_custom_typing={api_cgi_url}/message/custom/typing?access_token=%s
|
||||
# imgSecCheck
|
||||
wxa_img_sec_check={api_wxa_url}/img_sec_check?access_token=%s
|
||||
|
||||
# mediaCheckAsync
|
||||
wxa_media_check_async={api_wxa_url}/media_check_async?access_token=%s
|
||||
|
||||
# msgSecCheck
|
||||
wxa_msg_sec_check={api_wxa_url}/msg_sec_check?access_token=%s
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user