Skip to content

Commit d4d830f

Browse files
wwy0201binarywang
authored andcommitted
#1309 增加发送和查询企业微信红包的接口
1 parent c1c801c commit d4d830f

File tree

9 files changed

+607
-38
lines changed

9 files changed

+607
-38
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.github.binarywang.wxpay.bean.entpay;
2+
3+
import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest;
4+
import com.github.binarywang.wxpay.exception.WxPayException;
5+
import com.thoughtworks.xstream.annotations.XStreamAlias;
6+
import lombok.*;
7+
8+
/**
9+
* 红包发送记录查询请求
10+
* @author wuyong
11+
* @date 2019-12-01 17:19
12+
*/
13+
@Data
14+
@EqualsAndHashCode(callSuper = true)
15+
@Builder(builderMethodName = "newBuilder")
16+
@NoArgsConstructor
17+
@AllArgsConstructor
18+
@XStreamAlias("xml")
19+
public class EntPayRedpackQueryRequest extends BaseWxPayRequest {
20+
21+
22+
/**
23+
* 商户订单号
24+
*/
25+
@XStreamAlias("mch_billno")
26+
private String mchBillNo;
27+
28+
29+
@Override
30+
protected void checkConstraints() throws WxPayException {
31+
32+
}
33+
}
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
package com.github.binarywang.wxpay.bean.entpay;
2+
3+
import com.github.binarywang.wxpay.bean.result.BaseWxPayResult;
4+
import com.thoughtworks.xstream.annotations.XStreamAlias;
5+
import lombok.Data;
6+
import lombok.EqualsAndHashCode;
7+
import lombok.NoArgsConstructor;
8+
9+
/**
10+
* 红包发送记录查询返回
11+
*
12+
* @author wuyong
13+
* @date 2019-12-01 17:23
14+
*/
15+
@Data
16+
@EqualsAndHashCode(callSuper = true)
17+
@NoArgsConstructor
18+
@XStreamAlias("xml")
19+
public class EntPayRedpackQueryResult extends BaseWxPayResult {
20+
21+
/**
22+
* 商户订单号
23+
* 商户使用查询API填写的商户单号的原路返回
24+
*/
25+
@XStreamAlias("mch_billno")
26+
protected String mchBillNo;
27+
28+
/**
29+
* 红包单号
30+
* 使用API发放现金红包时返回的红包单号
31+
*/
32+
@XStreamAlias("detailId")
33+
private String detailId;
34+
/**
35+
* 红包状态
36+
* SENDING:发放
37+
* SENT:
38+
* 已发放待领取
39+
* FAILED:发放失败
40+
* RECEIVED:已领取
41+
* RFUND_ING:退款中 REFUND:已退款
42+
*/
43+
@XStreamAlias("status")
44+
private String status;
45+
46+
/**
47+
* 发放类型
48+
* API:通过API接口发放
49+
*/
50+
@XStreamAlias("send_type")
51+
private String sendType;
52+
53+
/**
54+
* 红包金额
55+
* 红包总金额(单位分)
56+
*/
57+
@XStreamAlias("total_amount")
58+
private Integer totalAmount;
59+
60+
/**
61+
* 失败原因
62+
* 发送失败原因
63+
*/
64+
@XStreamAlias("reason")
65+
private Integer reason;
66+
67+
/**
68+
* 红包发送时间
69+
*/
70+
@XStreamAlias("send_time")
71+
private String sendTime;
72+
/**
73+
* 红包的退款时间
74+
*/
75+
@XStreamAlias("refund_time")
76+
private String refundTime;
77+
78+
/**
79+
* 红包退款金额
80+
*/
81+
@XStreamAlias("refund_amount")
82+
private Integer refundAmount;
83+
84+
/**
85+
* 祝福语
86+
*/
87+
@XStreamAlias("wishing")
88+
private String wishing;
89+
90+
/**
91+
* 备注
92+
*/
93+
@XStreamAlias("remark")
94+
private String remark;
95+
96+
/**
97+
* 活动名称
98+
*/
99+
@XStreamAlias("act_name")
100+
private String actName;
101+
102+
/**
103+
* 领取红包的Openid
104+
*/
105+
@XStreamAlias("openid")
106+
private String openid;
107+
108+
/**
109+
* 金额
110+
*/
111+
@XStreamAlias("amount")
112+
private Integer amount;
113+
114+
/**
115+
* 接收时间
116+
*/
117+
@XStreamAlias("rcv_time")
118+
private Integer rcvTime;
119+
120+
/**
121+
* 发送者名称
122+
*/
123+
@XStreamAlias("sender_name")
124+
private Integer senderName;
125+
126+
/**
127+
* 发送者头像
128+
* 通过企业微信开放接口上传获取
129+
*/
130+
@XStreamAlias("sender_header_media_id")
131+
private Integer senderHeaderMediaId;
132+
133+
}
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
package com.github.binarywang.wxpay.bean.entpay;
2+
3+
import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest;
4+
import com.github.binarywang.wxpay.exception.WxPayException;
5+
import com.thoughtworks.xstream.annotations.XStreamAlias;
6+
import lombok.*;
7+
import me.chanjar.weixin.common.annotation.Required;
8+
9+
/**
10+
* 发送企业红包
11+
* @author wuyong
12+
* @date 2019-12-1
13+
*/
14+
@Data
15+
@EqualsAndHashCode(callSuper = true)
16+
@Builder(builderMethodName = "newBuilder")
17+
@NoArgsConstructor
18+
@AllArgsConstructor
19+
@XStreamAlias("xml")
20+
public class EntPayRedpackRequest extends BaseWxPayRequest {
21+
22+
private static final long serialVersionUID = 1L;
23+
24+
@Override
25+
protected void checkConstraints() throws WxPayException {
26+
27+
}
28+
29+
/**
30+
* 商户订单号(每个订单号必须唯一)
31+
* 组成:mch_id+yyyymmdd+10位一天内不能重复的数字。 接口根据商户订单号支持重入,如出现超时可再调用。
32+
* 必填:是
33+
*/
34+
@Required
35+
@XStreamAlias("mch_billno")
36+
private String mchBillNo;
37+
38+
/**
39+
* 微信分配的公众账号ID(企业微信corpid即为此appId)
40+
* 必填:是
41+
*/
42+
@Required
43+
@XStreamAlias("wxappid")
44+
private String wxAppId;
45+
46+
/**
47+
* 发送者名称
48+
* 以个人名义发红包,红包发送者名称(需要utf-8格式)。与agentid互斥,二者只能填一个。
49+
* 必填:否
50+
*/
51+
@XStreamAlias("sender_name")
52+
private String senderName;
53+
54+
/**
55+
* 发送红包的应用id
56+
* 以企业应用的名义发红包,企业应用id,整型,可在企业微信管理端应用的设置页面查看。与sender_name互斥,二者只能填一个。
57+
* 必填:否
58+
*/
59+
@XStreamAlias("agentid")
60+
private String agentId;
61+
62+
/**
63+
* 发送者头像
64+
* 发送者头像素材id,通过企业微信开放上传素材接口获取
65+
* 必填:否
66+
*/
67+
@XStreamAlias("sender_header_media_id")
68+
private String senderHeaderMediaId;
69+
70+
/**
71+
* 用户openid
72+
* 接受红包的用户.用户在wxappid下的openid。
73+
* 必填:是
74+
*/
75+
@Required
76+
@XStreamAlias("re_openid")
77+
private String reOpenid;
78+
79+
/**
80+
* 金额
81+
* 单位分,单笔最小金额默认为1元
82+
* 必填:是
83+
*/
84+
@Required
85+
@XStreamAlias("total_amount")
86+
private Integer totalAmount;
87+
88+
/**
89+
* 红包祝福语
90+
* 必填:是
91+
*/
92+
@Required
93+
@XStreamAlias("wishing")
94+
private String wishing;
95+
96+
/**
97+
* 项目名称
98+
* 必填:是
99+
*/
100+
@Required
101+
@XStreamAlias("act_name")
102+
private String actName;
103+
104+
/**
105+
* 备注
106+
* 必填:是
107+
*/
108+
@Required
109+
@XStreamAlias("remark")
110+
private String remark;
111+
112+
/**
113+
* 场景
114+
* 发放红包使用场景,红包金额大于200时必传
115+
* PRODUCT_1:商品促销
116+
* PRODUCT_2:抽奖
117+
* PRODUCT_3:虚拟物品兑奖
118+
* PRODUCT_4:企业内部福利
119+
* PRODUCT_5:渠道分润
120+
* PRODUCT_6:保险回馈
121+
* PRODUCT_7:彩票派奖
122+
* PRODUCT_8:税务刮奖
123+
*/
124+
@XStreamAlias("scene_id")
125+
private String sceneId;
126+
127+
128+
@Override
129+
protected boolean ignoreAppid() {
130+
return true;
131+
}
132+
133+
@Override
134+
protected boolean ignoreSubAppId() {
135+
return true;
136+
}
137+
138+
@Override
139+
protected boolean ignoreSubMchId() {
140+
return true;
141+
}
142+
143+
@Override
144+
protected boolean isWxWorkSign() {
145+
return true;
146+
}
147+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
package com.github.binarywang.wxpay.bean.entpay;
2+
3+
import com.github.binarywang.wxpay.bean.result.BaseWxPayResult;
4+
import com.thoughtworks.xstream.annotations.XStreamAlias;
5+
import lombok.Data;
6+
import lombok.EqualsAndHashCode;
7+
import lombok.NoArgsConstructor;
8+
9+
import java.io.Serializable;
10+
11+
/**
12+
* 企业微信红包返回
13+
* @author wuyong
14+
* @date 2019-12-01 11:31
15+
*/
16+
@Data
17+
@EqualsAndHashCode(callSuper = true)
18+
@NoArgsConstructor
19+
@XStreamAlias("xml")
20+
public class EntPayRedpackResult extends BaseWxPayResult implements Serializable {
21+
22+
private static final long serialVersionUID = 1L;
23+
24+
/**
25+
* 商户订单号
26+
* 商户订单号(每个订单号必须唯一)组成:mch_id+yyyymmdd+10位一天内不能重复的数字
27+
*/
28+
@XStreamAlias("mch_billno")
29+
private String mchBillNo;
30+
31+
/**
32+
* 商户号
33+
* 微信支付分配的商户号
34+
*/
35+
@XStreamAlias("mch_id")
36+
private String mchId;
37+
38+
/**
39+
* 公众账号appid
40+
* 商户appid,接口传入的所有appid应该为公众号的appid,不能为APP的appid
41+
*/
42+
@XStreamAlias("wxappid")
43+
private String wxAppId;
44+
45+
/**
46+
* 用户openid
47+
* 接受收红包的用户在wxappid下的openid
48+
*/
49+
@XStreamAlias("re_openid")
50+
private String reOpenid;
51+
52+
/**
53+
* 付款金额
54+
* 付款金额,单位分
55+
*/
56+
@XStreamAlias("totalAmount")
57+
private String totalAmount;
58+
59+
/**
60+
* 微信单号
61+
* 红包订单的微信单号
62+
*/
63+
@XStreamAlias("sendListid")
64+
private String sendListId;
65+
66+
/**
67+
* 发送者名称
68+
* 红包发送者名称(需要utf-8格式)
69+
*/
70+
@XStreamAlias("sender_name")
71+
private String senderName;
72+
73+
/**
74+
* 发送者头像
75+
* 发送者头像素材id,通过企业微信开放上传素材接口获取
76+
*/
77+
@XStreamAlias("sender_header_media_id")
78+
private String senderHeaderMediaId;
79+
80+
}

0 commit comments

Comments
 (0)