View Javadoc
1   package com.foxinmy.weixin4j.payment.mch;
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.type.mch.CorpPaymentCheckNameType;
12  import com.foxinmy.weixin4j.util.DateUtil;
13  
14  /**
15   * 企业付款记录
16   * 
17   * @className CorpPaymentRecord
18   * @author jinyu(foxinmy@gmail.com)
19   * @date 2015年6月23日
20   * @since JDK 1.6
21   * @see
22   * @deprecated 迁移到子模块weixin4j-pay
23   */
24  @Deprecated
25  @XmlRootElement
26  @XmlAccessorType(XmlAccessType.FIELD)
27  public class CorpPaymentRecord extends MerchantResult {
28  
29  	private static final long serialVersionUID = -1926873539419750498L;
30  
31  	/**
32  	 * 微信订单订单号
33  	 */
34  	@JSONField(name = "detail_id")
35  	@XmlElement(name = "detail_id")
36  	private String transactionId;
37  	/**
38  	 * 商户订单号
39  	 */
40  	@JSONField(name = "partner_trade_no")
41  	@XmlElement(name = "partner_trade_no")
42  	private String outTradeNo;
43  	/**
44  	 * 交易状态 SUCCESS:转账成功 FAILED:转账失败
45  	 */
46  	@JSONField(name = "status")
47  	@XmlElement(name = "status")
48  	private String transactionStatus;
49  	/**
50  	 * 如果失败则应该有原因
51  	 */
52  	@JSONField(name = "reason")
53  	@XmlElement(name = "reason")
54  	private String failureReason;
55  	/**
56  	 * 收款用户openid
57  	 */
58  	@JSONField(name = "openid")
59  	@XmlElement(name = "openid")
60  	private String openId;
61  	/**
62  	 * 收款用户姓名
63  	 */
64  	@JSONField(name = "transfer_name")
65  	@XmlElement(name = "transfer_name")
66  	private String transferName;
67  	/**
68  	 * 付款金额(单位为分)
69  	 */
70  	@JSONField(name = "payment_amount")
71  	@XmlElement(name = "payment_amount")
72  	private int paymentAmount;
73  	/**
74  	 * 转账时间
75  	 */
76  	@JSONField(name = "transfer_time")
77  	@XmlElement(name = "transfer_time")
78  	private String transferTime;
79  	/**
80  	 * 校验用户姓名选项
81  	 * 
82  	 * @see com.foxinmy.weixin4j.type.mch.CorpPaymentCheckNameType.type.MPPaymentCheckNameType
83  	 */
84  	@XmlElement(name = "check_name")
85  	@JSONField(name = "check_name")
86  	private String checkNameType;
87  	/**
88  	 * 企业付款描述信息
89  	 */
90  	@XmlElement(name = "desc")
91  	private String desc;
92  	/**
93  	 * 实名验证结果 PASS:通过 FAILED:不通过
94  	 */
95  	@JSONField(name = "check_name_result")
96  	@XmlElement(name = "check_name_result")
97  	private String checkNameResult;
98  
99  	protected CorpPaymentRecord() {
100 		// jaxb required
101 	}
102 
103 	public String getTransactionId() {
104 		return transactionId;
105 	}
106 
107 	public String getOutTradeNo() {
108 		return outTradeNo;
109 	}
110 
111 	public String getTransactionStatus() {
112 		return transactionStatus;
113 	}
114 
115 	/**
116 	 * 格式化交易状态
117 	 * 
118 	 * @return
119 	 */
120 	@JSONField(serialize = false)
121 	public boolean getFormatTransactionStatus() {
122 		return "success".equalsIgnoreCase(transactionStatus);
123 	}
124 
125 	public String getFailureReason() {
126 		return failureReason;
127 	}
128 
129 	public String getOpenId() {
130 		return openId;
131 	}
132 
133 	public String getTransferName() {
134 		return transferName;
135 	}
136 
137 	public int getPaymentAmount() {
138 		return paymentAmount;
139 	}
140 
141 	/**
142 	 * <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
143 	 * 
144 	 * @return 元单位
145 	 */
146 	@JSONField(serialize = false)
147 	public double getFormatPaymentAmount() {
148 		return paymentAmount / 100d;
149 	}
150 
151 	public String getTransferTime() {
152 		return transferTime;
153 	}
154 
155 	/**
156 	 * 格式化转账时间
157 	 * 
158 	 * @return
159 	 */
160 	@JSONField(serialize = false)
161 	public Date getFormatTransferTime() {
162 		return transferTime != null ? DateUtil
163 				.parse2yyyyMMddHHmmss(transferTime) : null;
164 	}
165 
166 	public String getCheckNameType() {
167 		return checkNameType;
168 	}
169 
170 	@JSONField(serialize = false)
171 	public CorpPaymentCheckNameType getFormatCheckNameType() {
172 		return checkNameType != null ? CorpPaymentCheckNameType
173 				.valueOf(checkNameType) : null;
174 	}
175 
176 	public String getDesc() {
177 		return desc;
178 	}
179 
180 	public String getCheckNameResult() {
181 		return checkNameResult;
182 	}
183 
184 	/**
185 	 * 格式化交易状态
186 	 * 
187 	 * @return
188 	 */
189 	@JSONField(serialize = false)
190 	public boolean getFormatCheckNameResult() {
191 		return "pass".equalsIgnoreCase(checkNameResult);
192 	}
193 
194 	@Override
195 	public String toString() {
196 		return "CorpPaymentRecord [transactionId=" + transactionId
197 				+ ", outTradeNo=" + outTradeNo + ", transactionStatus="
198 				+ getFormatTransactionStatus() + ", failureReason="
199 				+ failureReason + ", openId=" + openId + ", transferName="
200 				+ transferName + ", paymentAmount=" + getFormatPaymentAmount()
201 				+ ", transferTime=" + transferTime + ", checkNameType="
202 				+ checkNameType + ", desc=" + desc + ", checkNameResult="
203 				+ getFormatCheckNameResult() + ", " + super.toString() + "]";
204 	}
205 }