1 package com.foxinmy.weixin4j.pay.payment;
2
3 import com.alibaba.fastjson.annotation.JSONField;
4 import com.foxinmy.weixin4j.pay.payment.mch.MerchantResult;
5 import com.foxinmy.weixin4j.util.DateUtil;
6
7 import javax.xml.bind.annotation.XmlAccessType;
8 import javax.xml.bind.annotation.XmlAccessorType;
9 import javax.xml.bind.annotation.XmlElement;
10 import javax.xml.bind.annotation.XmlRootElement;
11 import java.util.Date;
12
13
14
15
16
17
18
19
20
21 @XmlRootElement
22 @XmlAccessorType(XmlAccessType.FIELD)
23 public class PayPackage extends MerchantResult {
24
25 private static final long serialVersionUID = 3450161267802545790L;
26
27
28
29
30 private String body;
31
32
33
34 private String detail;
35
36
37
38 @XmlElement(name = "out_trade_no")
39 @JSONField(name = "out_trade_no")
40 private String outTradeNo;
41
42
43
44 @XmlElement(name = "total_fee")
45 @JSONField(name = "total_fee")
46 private int totalFee;
47
48
49
50 @XmlElement(name = "notify_url")
51 @JSONField(name = "notify_url")
52 private String notifyUrl;
53
54
55
56 @XmlElement(name = "spbill_create_ip")
57 @JSONField(name = "spbill_create_ip")
58 private String createIp;
59
60
61
62 private String attach;
63
64
65
66
67 @XmlElement(name = "time_start")
68 @JSONField(name = "time_start")
69 private String timeStart;
70
71
72
73
74 @XmlElement(name = "time_expire")
75 @JSONField(name = "time_expire")
76 private String timeExpire;
77
78
79
80 @XmlElement(name = "goods_tag")
81 @JSONField(name = "goods_tag")
82 private String goodsTag;
83
84 protected PayPackage() {
85
86 }
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112 public PayPackage(String body, String detail, String outTradeNo,
113 double totalFee, String notifyUrl, String createIp, String attach,
114 Date timeStart, Date timeExpire, String goodsTag) {
115 this.body = body;
116 this.detail = detail;
117 this.outTradeNo = outTradeNo;
118 this.totalFee = DateUtil.formatYuan2Fen(totalFee);
119 this.notifyUrl = notifyUrl;
120 this.createIp = createIp;
121 this.attach = attach;
122 this.timeStart = timeStart != null ? DateUtil
123 .fortmat2yyyyMMddHHmmss(timeStart) : null;
124 this.timeExpire = timeExpire != null ? DateUtil
125 .fortmat2yyyyMMddHHmmss(timeExpire) : null;
126 this.goodsTag = goodsTag;
127 }
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153 public PayPackage(String body, String detail, String outTradeNo,
154 long totalFee, String notifyUrl, String createIp, String attach,
155 Date timeStart, Date timeExpire, String goodsTag) {
156 this.body = body;
157 this.detail = detail;
158 this.outTradeNo = outTradeNo;
159 this.totalFee = Long.valueOf(totalFee).intValue();
160 this.notifyUrl = notifyUrl;
161 this.createIp = createIp;
162 this.attach = attach;
163 this.timeStart = timeStart != null ? DateUtil
164 .fortmat2yyyyMMddHHmmss(timeStart) : null;
165 this.timeExpire = timeExpire != null ? DateUtil
166 .fortmat2yyyyMMddHHmmss(timeExpire) : null;
167 this.goodsTag = goodsTag;
168 }
169
170 public String getBody() {
171 return body;
172 }
173
174 public void setBody(String body) {
175 this.body = body;
176 }
177
178 public String getDetail() {
179 return detail;
180 }
181
182 public void setDetail(String detail) {
183 this.detail = detail;
184 }
185
186 public String getOutTradeNo() {
187 return outTradeNo;
188 }
189
190 public void setOutTradeNo(String outTradeNo) {
191 this.outTradeNo = outTradeNo;
192 }
193
194 public int getTotalFee() {
195 return totalFee;
196 }
197
198 public void setTotalFee(int totalFee) {
199 this.totalFee = totalFee;
200 }
201
202
203
204
205
206
207 @JSONField(serialize = false)
208 public double getFormatTotalFee() {
209 return totalFee / 100d;
210 }
211
212
213
214
215
216
217
218 public void setTotalFee(double totalFee) {
219 this.totalFee = DateUtil.formatYuan2Fen(totalFee);
220 }
221
222 public String getNotifyUrl() {
223 return notifyUrl;
224 }
225
226 public void setNotifyUrl(String notifyUrl) {
227 this.notifyUrl = notifyUrl;
228 }
229
230 public String getCreateIp() {
231 return createIp;
232 }
233
234 public void setCreateIp(String createIp) {
235 this.createIp = createIp;
236 }
237
238 public String getAttach() {
239 return attach;
240 }
241
242 public void setAttach(String attach) {
243 this.attach = attach;
244 }
245
246 public String getTimeStart() {
247 return timeStart;
248 }
249
250 public void setTimeStart(String timeStart) {
251 this.timeStart = timeStart;
252 }
253
254 public void setTimeExpire(String timeExpire) {
255 this.timeExpire = timeExpire;
256 }
257
258 public void setTimeStart(Date timeStart) {
259 this.timeStart = timeStart != null ? DateUtil
260 .fortmat2yyyyMMddHHmmss(timeStart) : null;
261 }
262
263 public String getTimeExpire() {
264 return timeExpire;
265 }
266
267 public void setTimeExpire(Date timeExpire) {
268 this.timeExpire = timeExpire != null ? DateUtil
269 .fortmat2yyyyMMddHHmmss(timeExpire) : null;
270 }
271
272 public String getGoodsTag() {
273 return goodsTag;
274 }
275
276 public void setGoodsTag(String goodsTag) {
277 this.goodsTag = goodsTag;
278 }
279
280 @Override
281 public String toString() {
282 return "body=" + body + ", detail=" + detail + ", outTradeNo="
283 + outTradeNo + ", totalFee=" + totalFee + ", notifyUrl="
284 + notifyUrl + ", createIp=" + createIp + ", attach=" + attach
285 + ", timeStart=" + timeStart + ", timeExpire=" + timeExpire
286 + ", goodsTag=" + goodsTag;
287 }
288 }