View Javadoc
1   package com.foxinmy.weixin4j.pay.payment.mch;
2   
3   import com.alibaba.fastjson.annotation.JSONField;
4   import com.foxinmy.weixin4j.pay.type.mch.RefundChannel;
5   import com.foxinmy.weixin4j.xml.ListsuffixResult;
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.List;
12  
13  /**
14   * 退款申请结果
15   * 
16   * @className RefundResult
17   * @author jinyu(foxinmy@gmail.com)
18   * @date 2014年11月6日
19   * @since JDK 1.6
20   * @see
21   */
22  @XmlRootElement
23  @XmlAccessorType(XmlAccessType.FIELD)
24  public class RefundResult extends MerchantTradeResult {
25  
26  	private static final long serialVersionUID = -3687863914168618620L;
27  
28  	/**
29  	 * 商户退款单号
30  	 */
31  	@XmlElement(name = "out_refund_no")
32  	@JSONField(name = "out_refund_no")
33  	private String outRefundNo;
34  	/**
35  	 * 微信退款单号
36  	 */
37  	@XmlElement(name = "refund_id")
38  	@JSONField(name = "refund_id")
39  	private String refundId;
40  	/**
41  	 * 退款渠道:ORIGINAL—原路退款,默认 BALANCE—退回到余额
42  	 */
43  	@XmlElement(name = "refund_channel")
44  	@JSONField(name = "refund_channel")
45  	private String refundChannel;
46  	/**
47  	 * 退款总金额,单位为分,可以做部分退款
48  	 */
49  	@XmlElement(name = "refund_fee")
50  	@JSONField(name = "refund_fee")
51  	private int refundFee;
52  	/**
53  	 * 现金退款金额
54  	 */
55  	@XmlElement(name = "cash_refund_fee")
56  	@JSONField(name = "cash_refund_fee")
57  	private Integer cashRefundFee;
58  	/**
59  	 * 退款详情
60  	 * 
61  	 * @see RefundDetail
62  	 */
63  	@ListsuffixResult({ ".*(_\\d)$" })
64  	private List<RefundDetail> refundList;
65  
66  	protected RefundResult() {
67  		// jaxb required
68  	}
69  
70  	public String getOutRefundNo() {
71  		return outRefundNo;
72  	}
73  
74  	public void setOutRefundNo(String outRefundNo) {
75  		this.outRefundNo = outRefundNo;
76  	}
77  
78  	public String getRefundId() {
79  		return refundId;
80  	}
81  
82  	public void setRefundId(String refundId) {
83  		this.refundId = refundId;
84  	}
85  
86  	public String getRefundChannel() {
87  		return refundChannel;
88  	}
89  
90  	public void setRefundChannel(String refundChannel) {
91  		this.refundChannel = refundChannel;
92  	}
93  
94  	@JSONField(serialize = false)
95  	public RefundChannel getFormatRefundChannel() {
96  		return refundChannel != null ? RefundChannel.valueOf(refundChannel
97  				.toUpperCase()) : null;
98  	}
99  
100 	public int getRefundFee() {
101 		return refundFee;
102 	}
103 
104 	public void setRefundFee(int refundFee) {
105 		this.refundFee = refundFee;
106 	}
107 
108 	/**
109 	 * <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
110 	 * 
111 	 * @return 元单位
112 	 */
113 	@JSONField(serialize = false)
114 	public double getFormatRefundFee() {
115 		return refundFee / 100d;
116 	}
117 
118 	public Integer getCashRefundFee() {
119 		return cashRefundFee;
120 	}
121 
122 	public void setCashRefundFee(Integer cashRefundFee) {
123 		this.cashRefundFee = cashRefundFee;
124 	}
125 
126 	/**
127 	 * <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
128 	 * 
129 	 * @return 元单位
130 	 */
131 	@JSONField(serialize = false)
132 	public double getFormatCashRefundFee() {
133 		return cashRefundFee != null ? cashRefundFee.intValue() / 100d : 0d;
134 	}
135 
136 	public List<RefundDetail> getRefundList() {
137 		return refundList;
138 	}
139 
140 	public void setRefundList(List<RefundDetail> refundList) {
141 		this.refundList = refundList;
142 	}
143 
144 	@Override
145 	public String toString() {
146 		return "RefundResult [" + super.toString() + ", outRefundNo="
147 				+ outRefundNo + ", refundId=" + refundId + ", refundChannel="
148 				+ refundChannel + ", refundFee=" + refundFee
149 				+ ", cashRefundFee=" + cashRefundFee + ", refundList="
150 				+ refundList + "]";
151 	}
152 }