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