1 package com.foxinmy.weixin4j.mp.oldpayment;
2
3 import java.util.Date;
4
5 import javax.xml.bind.annotation.XmlAccessType;
6 import javax.xml.bind.annotation.XmlAccessorType;
7 import javax.xml.bind.annotation.XmlElement;
8 import javax.xml.bind.annotation.XmlRootElement;
9
10 import com.alibaba.fastjson.annotation.JSONField;
11 import com.foxinmy.weixin4j.payment.PayPackage;
12 import com.foxinmy.weixin4j.util.DateUtil;
13
14
15
16
17
18
19
20
21
22
23 @XmlRootElement
24 @XmlAccessorType(XmlAccessType.FIELD)
25 public class PayPackageV2 extends PayPackage {
26
27 private static final long serialVersionUID = 5557542103637795834L;
28
29
30
31
32 @XmlElement(name = "bank_type")
33 @JSONField(name = "bank_type")
34 private String bankType;
35
36
37
38 private String partner;
39
40
41
42 @XmlElement(name = "fee_type")
43 @JSONField(name = "fee_type")
44 private String feeType;
45
46
47
48 @XmlElement(name = "transport_fee")
49 @JSONField(name = "transport_fee")
50 private Integer transportFee;
51
52
53
54 @XmlElement(name = "product_fee")
55 @JSONField(name = "product_fee")
56 private Integer productFee;
57
58
59
60 @XmlElement(name = "input_charset")
61 @JSONField(name = "input_charset")
62 private String inputCharset;
63
64 protected PayPackageV2() {
65
66 }
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84 public PayPackageV2(String partner, String body, String outTradeNo,
85 double totalFee, String notifyUrl, String createIp) {
86 this(partner, body, outTradeNo, totalFee, notifyUrl, createIp, null,
87 null, null, 0d, 0d, null);
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
113
114
115
116
117
118 public PayPackageV2(String partner, String body, String outTradeNo,
119 double totalFee, String notifyUrl, String createIp, String attach,
120 Date timeStart, Date timeExpire, double transportFee,
121 double productFee, String goodsTag) {
122 setBody(body);
123 setOutTradeNo(outTradeNo);
124 setTotalFee(totalFee);
125 setNotifyUrl(notifyUrl);
126 setCreateIp(createIp);
127 setAttach(attach);
128 setTimeStart(timeStart);
129 setTimeExpire(timeExpire);
130 setGoodsTag(goodsTag);
131 this.bankType = "WX";
132 this.feeType = "1";
133 this.inputCharset = "UTF-8";
134 this.partner = partner;
135 this.transportFee = transportFee > 0d ? DateUtil
136 .formatYuan2Fen(transportFee) : null;
137 this.productFee = productFee > 0 ? DateUtil.formatYuan2Fen(productFee)
138 : null;
139 }
140
141 public String getBankType() {
142 return bankType;
143 }
144
145 public String getPartner() {
146 return partner;
147 }
148
149 public void setPartner(String partner) {
150 this.partner = partner;
151 }
152
153 public String getFeeType() {
154 return feeType;
155 }
156
157 public Integer getTransportFee() {
158 return transportFee;
159 }
160
161
162
163
164
165
166 @JSONField(serialize = false)
167 public double getFormatTransportFee() {
168 return transportFee != null ? transportFee / 100d : 0d;
169 }
170
171
172
173
174
175
176
177 public void setTransportFee(double transportFee) {
178 this.transportFee = DateUtil.formatYuan2Fen(transportFee);
179 }
180
181 public Integer getProductFee() {
182 return productFee;
183 }
184
185
186
187
188
189
190 @JSONField(serialize = false)
191 public double getFormatProductFee() {
192 return productFee != null ? productFee / 100d : 0d;
193 }
194
195
196
197
198
199
200
201 public void setProductFee(double productFee) {
202 this.productFee = DateUtil.formatYuan2Fen(productFee);
203 }
204
205 public String getInputCharset() {
206 return inputCharset;
207 }
208
209 @Override
210 public String toString() {
211 return "PayPackageV2 [bankType=" + bankType + ", partner=" + partner
212 + ", feeType=" + feeType + ", transportFee=" + transportFee
213 + ", productFee=" + productFee + ", inputCharset="
214 + inputCharset + ", " + super.toString() + "]";
215 }
216 }