View Javadoc
1   package com.foxinmy.weixin4j.mp.oldpayment;
2   
3   import java.io.Serializable;
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.SignType;
12  
13  /**
14   * 调用V2.x接口返回的公用字段
15   * 
16   * @className ApiResultV2
17   * @author jinyu(foxinmy@gmail.com)
18   * @date 2014年12月30日
19   * @since JDK 1.6
20   * @see
21   */
22  @XmlRootElement
23  @XmlAccessorType(XmlAccessType.FIELD)
24  public class ApiResultV2 implements Serializable {
25  
26  	private static final long serialVersionUID = -2876899595643466203L;
27  	/**
28  	 * 是查询结果状态码,0 表明成功,其他表明错误;
29  	 */
30  	@JSONField(name = "retcode")
31  	@XmlElement(name = "retcode")
32  	private Integer retCode;
33  	/**
34  	 * 是查询结果出错信息;
35  	 */
36  	@JSONField(name = "retmsg")
37  	@XmlElement(name = "retmsg")
38  	private String retMsg;
39  	/**
40  	 * 是返回信息中的编码方式;
41  	 */
42  	@JSONField(name = "input_charset")
43  	@XmlElement(name = "input_charset")
44  	private String inputCharset;
45  	/**
46  	 * 是财付通商户号,即前文的 partnerid;
47  	 */
48  	private String partner;
49  	/**
50  	 * 多密钥支持的密钥序号,默认 1
51  	 */
52  	@XmlElement(name = "sign_key_index")
53  	@JSONField(name = "sign_key_index")
54  	private Integer signKeyIndex;
55  	/**
56  	 * 签名 <font color="red">调用者无需关注</font>
57  	 */
58  	private String sign;
59  	/**
60  	 * 签名类型,取值:MD5、RSA
61  	 */
62  	@JSONField(name = "sign_type")
63  	@XmlElement(name = "sign_type")
64  	private String signType;
65  
66  	protected ApiResultV2() {
67  		// jaxb required
68  	}
69  
70  	public Integer getRetCode() {
71  		return retCode;
72  	}
73  
74  	public void setRetCode(int retCode) {
75  		this.retCode = retCode;
76  	}
77  
78  	public String getRetMsg() {
79  		return this.retMsg;
80  	}
81  
82  	public void setRetMsg(String retMsg) {
83  		this.retMsg = retMsg;
84  	}
85  
86  	public String getInputCharset() {
87  		return inputCharset;
88  	}
89  
90  	public void setInputCharset(String inputCharset) {
91  		this.inputCharset = inputCharset;
92  	}
93  
94  	public String getPartner() {
95  		return partner;
96  	}
97  
98  	public void setPartner(String partner) {
99  		this.partner = partner;
100 	}
101 
102 	public String getSign() {
103 		return sign;
104 	}
105 
106 	public void setSign(String sign) {
107 		this.sign = sign;
108 	}
109 
110 	public String getSignType() {
111 		return signType;
112 	}
113 
114 	@JSONField(serialize = false)
115 	public SignType getFormatSignType() {
116 		return signType != null ? SignType.valueOf(signType) : null;
117 	}
118 
119 	public void setSignType(String signType) {
120 		this.signType = signType;
121 	}
122 
123 	public Integer getSignKeyIndex() {
124 		return signKeyIndex;
125 	}
126 
127 	public void setSignKeyIndex(Integer signKeyIndex) {
128 		this.signKeyIndex = signKeyIndex;
129 	}
130 
131 	@Override
132 	public String toString() {
133 		return "retCode=" + retCode + ", retMsg=" + retMsg + ", inputCharset="
134 				+ inputCharset + ", partner=" + partner + ", sign=" + sign
135 				+ ", signType=" + signType + ", signKeyIndex=" + signKeyIndex;
136 	}
137 }