8000 :art: ProfitSharingResult类增加分账接收方列表字段解析方法 · Cocowwy/WxJava@f94e670 · GitHub
[go: up one dir, main page]

Skip to content

Commit f94e670

Browse files
authored
🎨 ProfitSharingResult类增加分账接收方列表字段解析方法
2 parents c3f4943 + 066c77c commit f94e670

File tree

1 file changed

+161
-1
lines changed

1 file changed

+161
-1
lines changed

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/profitsharing/ProfitSharingResult.java

Lines changed: 161 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
package com.github.binarywang.wxpay.bean.profitsharing;
22

33
import com.github.binarywang.wxpay.bean.result.BaseWxPayResult;
4+
import com.google.gson.annotations.SerializedName;
45
import com.thoughtworks.xstream.annotations.XStreamAlias;
56
import lombok.Data;
67
import lombok.EqualsAndHashCode;
78
import lombok.NoArgsConstructor;
89
import org.w3c.dom.Document;
10+
import com.google.gson.Gson;
11+
import com.google.gson.GsonBuilder;
912

1013
import java.io.Serializable;
14+
import java.util.List;
1115

1216
/**
1317
* @author Wang GuangXin 2019/10/22 10:06
@@ -20,6 +24,11 @@
2024
public class ProfitSharingResult extends BaseWxPayResult implements Serializable {
2125
private static final long serialVersionUID = 7435709584788869456L;
2226

27+
/**
28+
* GSON工具
29+
*/
30+
private static final Gson GSON = new GsonBuilder().create();
31+
2332
/**
2433
* 微信订单号.
2534
*/
@@ -43,11 +52,32 @@ public class ProfitSharingResult extends BaseWxPayResult implements Serializable
4352
private String status;
4453

4554
/**
46-
* 分账接收方列表.
55+
* 分账接收方列表
4756
*/
4857
@XStreamAlias("receivers")
4958
private String receivers;
5059

60+
/**
61+
* 分账接收方列表
62+
*/
63+
private List<Receiver> receiverList;
64+
65+
/**
66+
* 获取分账接收方列表方法
67+
*
68+
* @return
69+
*/
70+
public List<Receiver> getReceiverList() {
71+
if (receiverList == null && receivers != null && receivers.length() > 0) {
72+
List<String> tempList = GSON.fromJson(receivers, List.class);
73+
for (String str : tempList) {
74+
Receiver receiver = GSON.fromJson(str, Receiver.class);
75+
receiverList.add(receiver);
76+
}
77+
}
78+
return receiverList;
79+
}
80+
5181
@Override
5282
protected void loadXml(Document d) {
5383
transactionId = readXmlString(d, "transaction_id");
@@ -56,4 +86,134 @@ protected void loadXml(Document d) {
5686
status = readXmlString(d, "status");
5787
receivers = readXmlString(d, "receivers");
5888
}
89+
90+
/**
91+
* 分账接收方列表对象
92+
*/
93+
@Data
94+
public static class Receiver implements Serializable {
95+
private static final long serialVersionUID = 4240983048700956806L;
96+
97+
/**
98+
* <pre>
99+
* 字段名:分账接收方类型
100+
* 是否必填:是
101+
* 描述:
102+
* 枚举值:
103+
* MERCHANT_ID:商户号(mch_id或者sub_mch_id)
104+
* PERSONAL_OPENID:个人openid(由服务商的APPID转换得到)
105+
* PERSONAL_SUB_OPENID:个人sub_openid(由品牌主的APPID转换得到)
106+
* </pre>
107+
*/
108+
@SerializedName("type")
109+
private String type;
110+
111+
/**
112+
* <pre>
113+
* 字段名:分账接收方帐号
114+
* 是否必填:是
115+
* 描述:
116+
* 1、分账接收方类型为MERCHANT_ID时,分账接收方账号为商户号
117+
* 2、分账接收方类型为PERSONAL_OPENID时,分账接收方账号为个人openid
118+
* </pre>
119+
*/
120+
@SerializedName("account")
121+
private String account;
122+
123+
/**
124+
* <pre>
125+
* 字段名:分账金额
126+
* 是否必填:是
127+
* 描述: 分账金额,单位为分,只能为整数,不能超过原订单支付金额及最大分账比例金额
128+
* </pre>
129+
*/
130+
@SerializedName("amount")
131+
private Long amount;
132+
133+
/**
134+
* <pre>
135+
* 字段名:分账接收商户号
136+
* 是否必填:是
137+
* 描述: 仅分账接收方类型为MERCHANT_ID时,填写微信支付分配的商户号
138+
* </pre>
139+
*/
140+
@SerializedName(("receiver_mchid"))
141+
private String receiverMchid;
142+
143+
/**
144+
* <pre>
145+
* 字段名:分账描述
146+
* 是否必填:是
147+
* 描述: 分账的原因描述,分账账单中需要体现
148+
* </pre>
149+
*/
150+
@SerializedName("description")
151+
private String description;
152+
153+
/**
154+
* <pre>
155+
* 字段名:分账结果
156+
* 是否必填:是
157+
* 描述:
158+
* 1、PENDING:待分账
159+
* 2、SUCCESS:分账成功
160+
* 3、CLOSED:已关闭
161+
* </pre>
162+
*/
163+
@SerializedName("result")
164+
private String result;
165+
166+
/**
167+
* <pre>
168+
* 字段名:分账失败原因
169+
* 是否必填:是
170+
* 描述:包含以下枚举值:
171+
* 1、ACCOUNT_ABNORMAL : 分账接收账户异常
172+
* 2、NO_RELATION : 分账关系已解除
173+
* 3、RECEIVER_HIGH_RISK : 高风险接收方
174+
* 4、RECEIVER_REAL_NAME_NOT_VERIFIED : 接收方未实名
175+
* 5、NO_AUTH : 分账权限已解除
176+
* </pre>
177+
*/
178+
@SerializedName("fail_reason")
179+
private String failReason;
180+
181+
/**
182+
* <pre>
183+
* 字段名:分账创建时间
184+
* 是否必填:是
185+
* 描述:遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss.sss+TIMEZONE,
186+
* YYYY-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,
187+
* HH:mm:ss.sss表示时分秒毫秒,
188+
* TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。
189+
* 例如:2015-05-20T13:29:35.120+08:00表示,北京时间2015年5月20日 13点29分35秒。
190+
* </pre>
191+
*/
192+
@SerializedName("create_time")
193+
private String createTime;
194+
/**
195+
* <pre>
196+
* 字段名:分账完成时间
197+
* 是否必填:是
198+
* 描述:遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss.sss+TIMEZONE,
199+
* YYYY-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,
200+
* HH:mm:ss.sss表示时分秒毫秒,
201+
* TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。
202+
* 例如:2015-05-20T13:29:35.120+08:00表示,北京时间2015年5月20日 13点29分35秒。
203+
* </pre>
204+
*/
205+
@SerializedName("finish_time")
206+
private String finishTime;
207+
208+
/**
209+
* <pre>
210+
* 字段名:微信分账明细单号
211+
* 是否必填:是
212+
* 每笔分账业务执行的明细单号,可与资金账单对账使用,
213+
* 例如:36011111111111111111111
214+
* </pre>
215+
*/
216+
@SerializedName("detail_id")
217+
private String detailId;
218+
}
59219
}

0 commit comments

Comments
 (0)
0