View Javadoc
1   package com.foxinmy.weixin4j.pay.payment.mch;
2   
3   import com.alibaba.fastjson.annotation.JSONField;
4   import com.foxinmy.weixin4j.pay.payment.coupon.RefundCouponInfo;
5   import com.foxinmy.weixin4j.pay.type.mch.CouponType;
6   import com.foxinmy.weixin4j.pay.type.mch.RefundChannel;
7   import com.foxinmy.weixin4j.pay.type.mch.RefundStatus;
8   import com.foxinmy.weixin4j.util.DateUtil;
9   import com.foxinmy.weixin4j.xml.ListsuffixResult;
10  
11  import javax.xml.bind.annotation.XmlAccessType;
12  import javax.xml.bind.annotation.XmlAccessorType;
13  import javax.xml.bind.annotation.XmlElement;
14  import javax.xml.bind.annotation.XmlRootElement;
15  import java.io.Serializable;
16  import java.util.Date;
17  import java.util.List;
18  
19  /**
20   * 退款详细
21   * 
22   * @className RefundDetail
23   * @author jinyu(foxinmy@gmail.com)
24   * @date 2016年7月21日
25   * @since JDK 1.6
26   */
27  @XmlRootElement
28  @XmlAccessorType(XmlAccessType.FIELD)
29  public class RefundDetail implements Serializable {
30  	private static final long serialVersionUID = 1402738803019986864L;
31  
32  	protected RefundDetail() {
33  		// jaxb required
34  	}
35  
36  	/**
37  	 * 商户退款单号
38  	 */
39  	@XmlElement(name = "out_refund_no")
40  	@JSONField(name = "out_refund_no")
41  	private String outRefundNo;
42  	/**
43  	 * 微信退款单号
44  	 */
45  	@XmlElement(name = "refund_id")
46  	@JSONField(name = "refund_id")
47  	private String refundId;
48  	/**
49  	 * 退款渠道:ORIGINAL—原路退款,默认 BALANCE—退回到余额
50  	 */
51  	@XmlElement(name = "refund_channel")
52  	@JSONField(name = "refund_channel")
53  	private String refundChannel;
54  	/**
55  	 * 退款总金额,单位为分,可以做部分退款
56  	 */
57  	@XmlElement(name = "refund_fee")
58  	@JSONField(name = "refund_fee")
59  	private int refundFee;
60  	/**
61  	 * 退款状态
62  	 */
63  	@XmlElement(name = "refund_status")
64  	@JSONField(name = "refund_status")
65  	private String refundStatus;
66  	/**
67  	 * 退款金额:退款金额=申请退款金额-非充值代金券退款金额,退款金额<=申请退款金额
68  	 */
69  	@XmlElement(name = "settlement_refund_fee")
70  	@JSONField(name = "settlement_refund_fee")
71  	private Integer settlementRefundFee;
72  	/**
73  	 * 代金券退款金额:代金券退款金额<=退款金额,退款金额-代金券或立减优惠退款金额为现金,
74  	 */
75  	@XmlElement(name = "coupon_refund_fee")
76  	@JSONField(name = "coupon_refund_fee")
77  	private Integer couponRefundFee;
78  	/**
79  	 * 代金券或立减优惠使用数量
80  	 */
81  	@XmlElement(name = "coupon_refund_count")
82  	@JSONField(name = "coupon_refund_count")
83  	private Integer couponRefundCount;
84  	/**
85  	 * 代金券类型
86  	 * 
87  	 * @see CouponType
88  	 */
89  	@XmlElement(name = "coupon_type")
90  	@JSONField(name = "coupon_type")
91  	private String couponType;
92  	/**
93  	 * 退款入账账户:取当前退款单的退款入账方 1)退回银行卡: {银行名称}{卡类型}{卡尾号} 2)退回支付用户零钱: 支付用户零钱
94  	 */
95  	@XmlElement(name = "refund_recv_accout")
96  	@JSONField(name = "refund_recv_accout")
97  	private String refundRecvAccout;
98  	/**
99  	 * 退款成功时间,当退款状态为退款成功时有返回
100 	 */
101 	@XmlElement(name = "refund_success_time")
102 	@JSONField(name = "refund_success_time")
103 	private String refundSuccessTime;
104 	/**
105 	 * 退款代金券信息
106 	 *
107 	 * @see RefundCouponInfo
108 	 */
109 	@ListsuffixResult
110 	private List<RefundCouponInfo> couponList;
111 
112 	public String getOutRefundNo() {
113 		return outRefundNo;
114 	}
115 
116 	public void setOutRefundNo(String outRefundNo) {
117 		this.outRefundNo = outRefundNo;
118 	}
119 
120 	public String getRefundId() {
121 		return refundId;
122 	}
123 
124 	public void setRefundId(String refundId) {
125 		this.refundId = refundId;
126 	}
127 
128 	public String getRefundChannel() {
129 		return refundChannel;
130 	}
131 
132 	public void setRefundChannel(String refundChannel) {
133 		this.refundChannel = refundChannel;
134 	}
135 
136 	@JSONField(serialize = false)
137 	public RefundChannel getFormatRefundChannel() {
138 		return refundChannel != null ? RefundChannel.valueOf(refundChannel
139 				.toUpperCase()) : null;
140 	}
141 
142 	public int getRefundFee() {
143 		return refundFee;
144 	}
145 
146 	public void setRefundFee(int refundFee) {
147 		this.refundFee = refundFee;
148 	}
149 
150 	public String getRefundStatus() {
151 		return refundStatus;
152 	}
153 
154 	public void setRefundStatus(String refundStatus) {
155 		this.refundStatus = refundStatus;
156 	}
157 
158 	@JSONField(serialize = false)
159 	public RefundStatus getFormatRefundStatus() {
160 		return refundStatus != null ? RefundStatus.valueOf(refundStatus
161 				.toUpperCase()) : null;
162 	}
163 
164 	public List<RefundCouponInfo> getCouponList() {
165 		return couponList;
166 	}
167 
168 	public void setCouponList(List<RefundCouponInfo> couponList) {
169 		this.couponList = couponList;
170 	}
171 
172 	public Integer getSettlementRefundFee() {
173 		return settlementRefundFee;
174 	}
175 
176 	public void setSettlementRefundFee(Integer settlementRefundFee) {
177 		this.settlementRefundFee = settlementRefundFee;
178 	}
179 
180 	/**
181 	 * <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
182 	 * 
183 	 * @return 元单位
184 	 */
185 	@JSONField(serialize = false)
186 	public double getFormatSettlementRefundFee() {
187 		return settlementRefundFee != null ? settlementRefundFee / 100d : 0d;
188 	}
189 
190 	public Integer getCouponRefundFee() {
191 		return couponRefundFee;
192 	}
193 
194 	public void setCouponRefundFee(Integer couponRefundFee) {
195 		this.couponRefundFee = couponRefundFee;
196 	}
197 
198 	/**
199 	 * <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
200 	 * 
201 	 * @return 元单位
202 	 */
203 	@JSONField(serialize = false)
204 	public double getFormatCouponRefundFee() {
205 		return couponRefundFee != null ? couponRefundFee / 100d : 0d;
206 	}
207 
208 	public Integer getCouponRefundCount() {
209 		return couponRefundCount;
210 	}
211 
212 	public void setCouponRefundCount(Integer couponRefundCount) {
213 		this.couponRefundCount = couponRefundCount;
214 	}
215 
216 	public String getCouponType() {
217 		return couponType;
218 	}
219 
220 	public void setCouponType(String couponType) {
221 		this.couponType = couponType;
222 	}
223 
224 	@JSONField(serialize = false)
225 	public CouponType getFormatCouponType() {
226 		return couponType != null ? CouponType
227 				.valueOf(couponType.toUpperCase()) : null;
228 	}
229 
230 	public String getRefundRecvAccout() {
231 		return refundRecvAccout;
232 	}
233 
234 	public void setRefundRecvAccout(String refundRecvAccout) {
235 		this.refundRecvAccout = refundRecvAccout;
236 	}
237 
238 	public String getRefundSuccessTime() {
239 		return refundSuccessTime;
240 	}
241 
242 	public void setRefundSuccessTime(String refundSuccessTime) {
243 		this.refundSuccessTime = refundSuccessTime;
244 	}
245 	
246 	@JSONField(serialize = false)
247 	public Date getFormatRefundSuccessTime() {
248 		return refundSuccessTime != null ? DateUtil.parse2yyyyMMddHHmmss(refundSuccessTime) : null;
249 	}
250 
251 	@Override
252 	public String toString() {
253 		return "RefundDetail [outRefundNo=" + outRefundNo + ", refundId="
254 				+ refundId + ", refundChannel=" + refundChannel
255 				+ ", refundFee=" + refundFee + ", refundStatus=" + refundStatus
256 				+ ", settlementRefundFee=" + settlementRefundFee
257 				+ ", couponRefundFee=" + couponRefundFee
258 				+ ", couponRefundCount=" + couponRefundCount + ", couponType="
259 				+ couponType + ", refundRecvAccout=" + refundRecvAccout
260 				+ ", couponList=" + couponList + "]";
261 	}
262 }