1 package com.foxinmy.weixin4j.payment.mch;
2
3 import java.util.Date;
4 import java.util.List;
5
6 import javax.xml.bind.annotation.XmlAccessType;
7 import javax.xml.bind.annotation.XmlAccessorType;
8 import javax.xml.bind.annotation.XmlElement;
9 import javax.xml.bind.annotation.XmlRootElement;
10
11 import com.alibaba.fastjson.annotation.JSONField;
12 import com.foxinmy.weixin4j.payment.coupon.OrderCouponInfo;
13 import com.foxinmy.weixin4j.type.BankType;
14 import com.foxinmy.weixin4j.type.CurrencyType;
15 import com.foxinmy.weixin4j.type.TradeState;
16 import com.foxinmy.weixin4j.type.TradeType;
17 import com.foxinmy.weixin4j.util.DateUtil;
18 import com.foxinmy.weixin4j.xml.ListsuffixResult;
19
20
21
22
23
24
25
26
27
28
29
30 @Deprecated
31 @XmlRootElement
32 @XmlAccessorType(XmlAccessType.FIELD)
33 public class Order extends MerchantTradeResult {
34
35 private static final long serialVersionUID = 5636828325595317079L;
36
37
38
39
40
41 @XmlElement(name = "trade_state")
42 @JSONField(name = "trade_state")
43 private String tradeState;
44
45
46
47 @XmlElement(name = "openid")
48 @JSONField(name = "openid")
49 private String openId;
50
51
52
53 @XmlElement(name = "is_subscribe")
54 @JSONField(name = "is_subscribe")
55 private String isSubscribe;
56
57
58
59
60
61 @XmlElement(name = "trade_type")
62 @JSONField(name = "trade_type")
63 private String tradeType;
64
65
66
67 @XmlElement(name = "bank_type")
68 @JSONField(name = "bank_type")
69 private String bankType;
70
71
72
73
74
75
76 @XmlElement(name = "cash_fee_type")
77 @JSONField(name = "cash_fee_type")
78 private String cashFeeType;
79
80
81
82 @XmlElement(name = "coupon_fee")
83 @JSONField(name = "coupon_fee")
84 private Integer couponFee;
85
86
87
88 @XmlElement(name = "coupon_count")
89 @JSONField(name = "coupon_count")
90 private Integer couponCount;
91
92
93
94 @ListsuffixResult
95 private List<OrderCouponInfo> couponList;
96
97
98
99 private String attach;
100
101
102
103 @XmlElement(name = "time_end")
104 @JSONField(name = "time_end")
105 private String timeEnd;
106
107
108
109 @XmlElement(name = "trade_state_desc")
110 @JSONField(name = "trade_state_desc")
111 private String tradeStateDesc;
112
113
114
115
116 @XmlElement(name = "sub_openid")
117 @JSONField(name = "sub_openid")
118 private String subOpenId;
119
120
121
122 @XmlElement(name = "sub_is_subscribe")
123 @JSONField(name = "sub_is_subscribe")
124 private String subIsSubscribe;
125
126 protected Order() {
127
128 }
129
130 @JSONField(serialize = false)
131 public TradeState getFormatTradeState() {
132 return tradeState != null ? TradeState
133 .valueOf(tradeState.toUpperCase()) : null;
134 }
135
136 public String getOpenId() {
137 return openId;
138 }
139
140 public String getIsSubscribe() {
141 return isSubscribe;
142 }
143
144 @JSONField(serialize = false)
145 public boolean getFormatIsSubscribe() {
146 return isSubscribe != null && isSubscribe.equalsIgnoreCase("y");
147 }
148
149 @JSONField(serialize = false)
150 public TradeType getFormatTradeType() {
151 return tradeType != null ? TradeType.valueOf(tradeType.toUpperCase())
152 : null;
153 }
154
155 public String getBankType() {
156 return bankType;
157 }
158
159 @JSONField(serialize = false)
160 public BankType getFormatBankType() {
161 return bankType != null ? BankType.valueOf(bankType.toUpperCase())
162 : null;
163 }
164
165 public Integer getCouponFee() {
166 return couponFee;
167 }
168
169
170
171
172
173
174 @JSONField(serialize = false)
175 public double getFormatCouponFee() {
176 return couponFee != null ? couponFee / 100d : 0d;
177 }
178
179 public Integer getCouponCount() {
180 return couponCount;
181 }
182
183 public String getTradeState() {
184 return tradeState;
185 }
186
187 public String getTradeType() {
188 return tradeType;
189 }
190
191 public String getAttach() {
192 return attach;
193 }
194
195 public String getTimeEnd() {
196 return timeEnd;
197 }
198
199 @JSONField(serialize = false)
200 public Date getFormatTimeEnd() {
201 return timeEnd != null ? DateUtil.parse2yyyyMMddHHmmss(timeEnd) : null;
202 }
203
204 public String getTradeStateDesc() {
205 return tradeStateDesc;
206 }
207
208 public List<OrderCouponInfo> getCouponList() {
209 return couponList;
210 }
211
212 public void setCouponList(List<OrderCouponInfo> couponList) {
213 this.couponList = couponList;
214 }
215
216 public String getSubOpenId() {
217 return subOpenId;
218 }
219
220 public String getSubIsSubscribe() {
221 return subIsSubscribe;
222 }
223
224 @JSONField(serialize = false)
225 public boolean getFormatSubIsSubscribe() {
226 return subIsSubscribe != null && subIsSubscribe.equalsIgnoreCase("y");
227 }
228
229 public String getCashFeeType() {
230 return cashFeeType;
231 }
232
233 @JSONField(serialize = false)
234 public CurrencyType getFormatCashFeeType() {
235 return cashFeeType != null ? CurrencyType.valueOf(cashFeeType
236 .toUpperCase()) : null;
237 }
238
239 @Override
240 public String toString() {
241 return "Order [tradeState=" + tradeState + ", openId=" + openId
242 + ", isSubscribe=" + isSubscribe + ", tradeType=" + tradeType
243 + ", bankType=" + bankType + ", cashFeeType=" + cashFeeType
244 + ", couponFee=" + couponFee + ", couponCount=" + couponCount
245 + ", couponList=" + couponList + ", attach=" + attach
246 + ", timeEnd=" + timeEnd + ", tradeStateDesc=" + tradeStateDesc
247 + ", subOpenId=" + subOpenId + ", subIsSubscribe="
248 + subIsSubscribe + ", " + super.toString() + "]";
249 }
250 }