Skip to content

Commit 37959e0

Browse files
author
pengg
committed
微信分账服务类增加v3接口 binarywang#2120
1 parent bf266b8 commit 37959e0

12 files changed

+1135
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
package com.github.binarywang.wxpay.bean.profitsharingV3;
2+
3+
import com.github.binarywang.wxpay.v3.SpecEncrypt;
4+
import com.google.gson.annotations.SerializedName;
5+
import lombok.AllArgsConstructor;
6+
import lombok.Builder;
7+
import lombok.Data;
8+
import lombok.NoArgsConstructor;
9+
10+
import java.io.Serializable;
11+
12+
/**
13+
*
14+
* 微信V3接口 分账接收方实体
15+
* @author pg
16+
* @date 2021-6-25
17+
*
18+
*/
19+
@Data
20+
@Builder(builderMethodName = "newBuilder")
21+
@NoArgsConstructor
22+
@AllArgsConstructor
23+
public class ProfitSharingReceiver implements Serializable {
24+
private static final long serialVersionUID = -4391888575149767840L;
25+
26+
/**
27+
* <pre>
28+
* 字段名:应用ID
29+
* 是否必填:是
30+
* 描述:微信分配的商户appid
31+
* </pre>
32+
*/
33+
@SerializedName("appid")
34+
private String appid;
35+
36+
/**
37+
* <pre>
38+
* 字段名:分账接收方类型
39+
* 是否必填:是
40+
* 描述:
41+
* 1、MERCHANT_ID:商户号
42+
* 2、PERSONAL_OPENID:个人openid(由父商户APPID转换得到)
43+
* </pre>
44+
*/
45+
@SerializedName("type")
46+
private String type;
47+
48+
/**
49+
* <pre>
50+
* 字段名:分账接收方帐号
51+
* 是否必填:是
52+
* 描述:
53+
* 1、分账接收方类型为MERCHANT_ID时,分账接收方账号为商户号
54+
* 2、分账接收方类型为PERSONAL_OPENID时,分账接收方账号为个人openid
55+
* </pre>
56+
*/
57+
@SerializedName("account")
58+
private String account;
59+
60+
/**
61+
* <pre>
62+
* 字段名:分账个人接收方姓名
63+
* 是否必填:否
64+
* 描述:
65+
* 可选项,在接收方类型为个人的时可选填,若有值,会检查与 name 是否实名匹配,不匹配会拒绝分账请求
66+
* 1、分账接收方类型是PERSONAL_OPENID,是个人姓名的密文(选传,传则校验) 此字段的加密方法详见:敏感信息加密说明
67+
* 2、使用微信支付平台证书中的公钥
68+
* 3、使用RSAES-OAEP算法进行加密
69+
* 4、将请求中HTTP头部的Wechatpay-Serial设置为证书序列号
70+
* </pre>
71+
*/
72+
@SerializedName("name")
73+
@SpecEncrypt
74+
private String name;
75+
76+
/**
77+
* <pre>
78+
* 字段名:与分账方的关系类型
79+
* 是否必填:是
80+
* 描述:子商户与接收方的关系。 本字段值为枚举:
81+
* STORE:门店
82+
* STAFF:员工
83+
* STORE_OWNER:店主
84+
* PARTNER:合作伙伴
85+
* HEADQUARTER:总部
86+
* BRAND:品牌方
87+
* DISTRIBUTOR:分销商
88+
* USER:用户
89+
* SUPPLIER: 供应商
90+
* CUSTOM:自定义
91+
* </pre>
92+
*/
93+
@SerializedName("relation_type")
94+
private String relationType;
95+
96+
/**
97+
* <pre>
98+
* 字段名:自定义的分账关系
99+
* 是否必填:是
100+
* 描述:子商户与接收方具体的关系,本字段最多10个字。
101+
* 当字段relationType的值为CUSTOM时,本字段必填;
102+
* 当字段relationType的值不为CUSTOM时,本字段无需填写。
103+
* </pre>
104+
*/
105+
@SerializedName("custom_relation")
106+
private String customRelation;
107+
108+
/**
109+
* <pre>
110+
* 字段名:分账描述
111+
* 是否必填:是
112+
* 描述: 分账的原因描述,分账账单中需要体现
113+
* </pre>
114+
*/
115+
private String description;
116+
/**
117+
* <pre>
118+
* 字段名:分账金额
119+
* 是否必填:是
120+
* 描述: 分账金额,单位为分,只能为整数,不能超过原订单支付金额及最大分账比例金额
121+
* </pre>
122+
*/
123+
private Long amount;
124+
125+
/**
126+
* 此构造函数用于分账接口
127+
*
128+
* @param type MERCHANT_ID:商户ID
129+
* PERSONAL_WECHATID:个人微信号PERSONAL_OPENID:个人openid(由父商户APPID转换得到)PERSONAL_SUB_OPENID: 个人sub_openid(由子商户APPID转换得到)
130+
* @param account 类型是MERCHANT_ID时,是商户ID
131+
* 类型是PERSONAL_WECHATID时,是个人微信号
132+
* 类型是PERSONAL_OPENID时,是个人openid
133+
* 类型是PERSONAL_SUB_OPENID时,是个人sub_openid
134+
* @param amount 分账金额,单位为分,只能为整数,不能超过原订单支付金额及最大分账比例金额
135+
* @param description 分账的原因描述,分账账单中需要体现
136+
*/
137+
public ProfitSharingReceiver(String type, String account, Long amount, String description) {
138+
this.type = type;
139+
this.account = account;
140+
this.amount = amount;
141+
this.description = description;
142+
}
143+
144+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
package com.github.binarywang.wxpay.bean.profitsharingV3;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.AllArgsConstructor;
5+
import lombok.Builder;
6+
import lombok.Data;
7+
import lombok.NoArgsConstructor;
8+
9+
import java.io.Serializable;
10+
import java.util.List;
11+
12+
/**
13+
* 微信V3接口
14+
* 请求分账API请求实体
15+
*
16+
* @author pg
17+
* @date 2021-6-24
18+
*/
19+
@Data
20+
@Builder(builderMethodName = "newBuilder")
21+
@NoArgsConstructor
22+
@AllArgsConstructor
23+
public class ProfitSharingRequest implements Serializable {
24+
private static final long serialVersionUID = 3644929701624280800L;
25+
26+
/**
27+
* <pre>
28+
* 字段名:应用ID
29+
* 是否必填:是
30+
* 描述:微信分配的商户appid
31+
* </pre>
32+
*/
33+
@SerializedName("appid")
34+
private String appid;
35+
36+
/**
37+
* <pre>
38+
* 字段名:微信订单号
39+
* 是否必填:是
40+
* 描述:微信支付订单号
41+
* </pre>
42+
*/
43+
@SerializedName("transaction_id")
44+
private String transactionId;
45+
46+
/**
47+
* <pre>
48+
* 字段名:商户分账单号
49+
* 是否必填:是
50+
* 描述:商户系统内部的分账单号,在商户系统内部唯一,同一分账单号多次请求等同一次。只能是数字、大小写字母_-|*@
51+
* </pre>
52+
*/
53+
@SerializedName("out_order_no")
54+
private String outOrderNo;
55+
56+
/**
57+
* <pre>
58+
* 字段名:分账接收方列表
59+
* 是否必填:是
60+
* 描述:分账接收方列表,可以设置出资商户作为分账接受方,最多可有50个分账接收方
61+
* </pre>
62+
*/
63+
@SerializedName("receivers")
64+
private List<ProfitSharingReceiver> receivers;
65+
66+
/**
67+
* <pre>
68+
* 字段名:是否解冻剩余未分资金
69+
* 是否必填:是
70+
* 描述:
71+
* 1、如果为true,该笔订单剩余未分账的金额会解冻回分账方商户;
72+
* 2、如果为false,该笔订单剩余未分账的金额不会解冻回分账方商户,可以对该笔订单再次进行分账。
73+
* </pre>
74+
*/
75+
@SerializedName("unfreeze_unsplit")
76+
private boolean unfreezeUnsplit;
77+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
package com.github.binarywang.wxpay.bean.profitsharingV3;
2+
3+
4+
import com.google.gson.annotations.SerializedName;
5+
import lombok.Data;
6+
7+
import java.io.Serializable;
8+
import java.util.List;
9+
10+
/**
11+
* 微信V3接口
12+
* 请求分账API返回的分账结果实体
13+
*
14+
* @author pg
15+
* @date 2021-6-24
16+
*/
17+
@Data
18+
public class ProfitSharingResult implements Serializable {
19+
private static final long serialVersionUID = -6201692412535987502L;
20+
21+
/**
22+
* <pre>
23+
* 字段名:微信订单号
24+
* 是否必填:是
25+
* 描述:微信支付订单号
26+
* </pre>
27+
*/
28+
@SerializedName("transaction_id")
29+
private String transactionId;
30+
31+
/**
32+
* <pre>
33+
* 字段名:商户分账单号
34+
* 是否必填:是
35+
* 描述:商户系统内部的分账单号,在商户系统内部唯一,同一分账单号多次请求等同一次。只能是数字、大小写字母_-|*@
36+
* </pre>
37+
*/
38+
@SerializedName("out_order_no")
39+
private String outOrderNo;
40+
41+
/**
42+
* <pre>
43+
* 字段名:微信分账单号,
44+
* 是否必填:是
45+
* 描述:微信系统返回的唯一标识.
46+
* </pre>
47+
*/
48+
@SerializedName("order_id")
49+
private String orderId;
50+
51+
/**
52+
* <pre>
53+
* 字段名:分账单状态
54+
* 是否必填:是
55+
* 描述:分账单状态(每个接收方的分账结果请查看receivers中的result字段):
56+
* 1、PROCESSING:处理中
57+
* 2、FINISHED:分账完成.
58+
* </pre>
59+
*/
60+
@SerializedName("state")
61+
private String state;
62+
63+
/**
64+
* 分账接收方列表
65+
*/
66+
@SerializedName("receivers")
67+
private List<Receiver> receivers;
68+
69+
@Data
70+
public static class Receiver implements Serializable {
71+
private static final long serialVersionUID = 4240983048700956806L;
72+
73+
/**
74+
* <pre>
75+
* 字段名:分账接收方类型
76+
* 是否必填:是
77+
* 描述:
78+
* 1、MERCHANT_ID:商户号
79+
* 2、PERSONAL_OPENID:个人openid(由父商户APPID转换得到)
80+
* </pre>
81+
*/
82+
@SerializedName("type")
83+
private String type;
84+
85+
/**
86+
* <pre>
87+
* 字段名:分账接收方帐号
88+
* 是否必填:是
89+
* 描述:
90+
* 1、分账接收方类型为MERCHANT_ID时,分账接收方账号为商户号
91+
* 2、分账接收方类型为PERSONAL_OPENID时,分账接收方账号为个人openid
92+
* </pre>
93+
*/
94+
@SerializedName("account")
95+
private String account;
96+
97+
/**
98+
* <pre>
99+
* 字段名:分账金额
100+
* 是否必填:是
101+
* 描述: 分账金额,单位为分,只能为整数,不能超过原订单支付金额及最大分账比例金额
102+
* </pre>
103+
*/
104+
@SerializedName("amount")
105+
private Long amount;
106+
107+
/**
108+
* <pre>
109+
* 字段名:分账描述
110+
* 是否必填:是
111+
* 描述: 分账的原因描述,分账账单中需要体现
112+
* </pre>
113+
*/
114+
@SerializedName("description")
115+
private String description;
116+
117+
/**
118+
* <pre>
119+
* 字段名:分账结果
120+
* 是否必填:是
121+
* 描述:
122+
* 1、PENDING:待分账
123+
* 2、SUCCESS:分账成功
124+
* 3、CLOSED:已关闭
125+
* </pre>
126+
*/
127+
@SerializedName("result")
128+
private String result;
129+
130+
/**
131+
* <pre>
132+
* 字段名:分账失败原因
133+
* 是否必填:是
134+
* 描述:包含以下枚举值:
135+
* 1、ACCOUNT_ABNORMAL : 分账接收账户异常
136+
* 2、NO_RELATION : 分账关系已解除
137+
* 3、RECEIVER_HIGH_RISK : 高风险接收方
138+
* 4、RECEIVER_REAL_NAME_NOT_VERIFIED : 接收方未实名
139+
* 5、NO_AUTH : 分账权限已解除
140+
* </pre>
141+
*/
142+
@SerializedName("fail_reason")
143+
private String failReason;
144+
145+
/**
146+
* <pre>
147+
* 字段名:分账创建时间
148+
* 是否必填:是
149+
* 描述:遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss.sss+TIMEZONE,
150+
* YYYY-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,
151+
* HH:mm:ss.sss表示时分秒毫秒,
152+
* TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。
153+
* 例如:2015-05-20T13:29:35.120+08:00表示,北京时间2015年5月20日 13点29分35秒。
154+
* </pre>
155+
*/
156+
@SerializedName("create_time")
157+
private String createTime;
158+
/**
159+
* <pre>
160+
* 字段名:分账完成时间
161+
* 是否必填:是
162+
* 描述:遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss.sss+TIMEZONE,
163+
* YYYY-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,
164+
* HH:mm:ss.sss表示时分秒毫秒,
165+
* TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。
166+
* 例如:2015-05-20T13:29:35.120+08:00表示,北京时间2015年5月20日 13点29分35秒。
167+
* </pre>
168+
*/
169+
@SerializedName("finish_time")
170+
private String finishTime;
171+
}
172+
}

0 commit comments

Comments
 (0)