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.CurrencyType;
5   
6   import javax.xml.bind.annotation.XmlElement;
7   
8   /**
9    * 商户平台交易结果
10   * 
11   * @className MerchantTradeResult
12   * @author jinyu(foxinmy@gmail.com)
13   * @date 2016年7月21日
14   * @since JDK 1.7
15   * @see
16   */
17  public class MerchantTradeResult extends MerchantResult {
18  
19  	private static final long serialVersionUID = 4205906286092873877L;
20  	/**
21  	 * 微信支付订单号
22  	 */
23  	@XmlElement(name = "transaction_id")
24  	@JSONField(name = "transaction_id")
25  	private String transactionId;
26  	/**
27  	 * 商户订单号
28  	 */
29  	@XmlElement(name = "out_trade_no")
30  	@JSONField(name = "out_trade_no")
31  	private String outTradeNo;
32  	/**
33  	 * 订单总金额,单位为分
34  	 */
35  	@XmlElement(name = "total_fee")
36  	@JSONField(name = "total_fee")
37  	private Integer totalFee;
38  	/**
39  	 * 应结订单金额,单位为分:应结订单金额=订单金额-非充值代金券金额,应结订单金额<=订单金额。
40  	 */
41  	@XmlElement(name = "settlement_total_fee")
42  	@JSONField(name = "settlement_total_fee")
43  	private Integer settlementTotalFee;
44  	/**
45  	 * 货币类型,符合 ISO 4217 标准的三位字母代码,默认人民币:CNY
46  	 * 
47  	 * @see com.foxinmy.weixin4j.pay.type.CurrencyType
48  	 */
49  	@XmlElement(name = "fee_type")
50  	@JSONField(name = "fee_type")
51  	private String feeType;
52  	/**
53  	 * 现金支付金额
54  	 */
55  	@XmlElement(name = "cash_fee")
56  	@JSONField(name = "cash_fee")
57  	private Integer cashFee;
58  
59  	public Integer getCashFee() {
60  		return cashFee;
61  	}
62  
63  	public void setCashFee(Integer cashFee) {
64  		this.cashFee = cashFee;
65  	}
66  
67  	/**
68  	 * <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
69  	 * 
70  	 * @return 元单位
71  	 */
72  	@JSONField(serialize = false)
73  	public double getFormatCashFee() {
74  		return cashFee != null ? cashFee / 100d : 0d;
75  	}
76  
77  	public Integer getTotalFee() {
78  		return totalFee;
79  	}
80  
81  	public void setTotalFee(Integer totalFee) {
82  		this.totalFee = totalFee;
83  	}
84  
85  	/**
86  	 * <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
87  	 * 
88  	 * @return 元单位
89  	 */
90  	@JSONField(serialize = false)
91  	public double getFormatTotalFee() {
92  		return totalFee != null ? totalFee / 100d : 0d;
93  	}
94  
95  	@JSONField(serialize = false)
96  	public CurrencyType getFormatFeeType() {
97  		return feeType != null ? CurrencyType.valueOf(feeType.toUpperCase())
98  				: null;
99  	}
100 
101 	public String getFeeType() {
102 		return feeType;
103 	}
104 
105 	public void setFeeType(String feeType) {
106 		this.feeType = feeType;
107 	}
108 
109 	public String getTransactionId() {
110 		return transactionId;
111 	}
112 
113 	public void setTransactionId(String transactionId) {
114 		this.transactionId = transactionId;
115 	}
116 
117 	public String getOutTradeNo() {
118 		return outTradeNo;
119 	}
120 
121 	public void setOutTradeNo(String outTradeNo) {
122 		this.outTradeNo = outTradeNo;
123 	}
124 
125 	public Integer getSettlementTotalFee() {
126 		return settlementTotalFee;
127 	}
128 
129 	public void setSettlementTotalFee(Integer settlementTotalFee) {
130 		this.settlementTotalFee = settlementTotalFee;
131 	}
132 
133 	/**
134 	 * <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
135 	 * 
136 	 * @return 元单位
137 	 */
138 	@JSONField(serialize = false)
139 	public double getFormatSettlementTotalFee() {
140 		return settlementTotalFee != null ? settlementTotalFee / 100d : 0d;
141 	}
142 
143 	@Override
144 	public String toString() {
145 		return "transactionId=" + transactionId + ", outTradeNo=" + outTradeNo
146 				+ ", totalFee=" + totalFee + ", cashFee=" + cashFee
147 				+ ", feeType=" + feeType + ", settlementTotalFee="
148 				+ settlementTotalFee + ", " + super.toString();
149 	}
150 }