View Javadoc
1   package com.foxinmy.weixin4j.pay.payment.mch;
2   
3   import com.alibaba.fastjson.annotation.JSONField;
4   import com.foxinmy.weixin4j.http.weixin.XmlResult;
5   import com.foxinmy.weixin4j.pay.type.SignType;
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  
12  /**
13   * 调用商户平台接口返回的公用字段
14   *
15   * @className MerchantResult
16   * @author jinyu(foxinmy@gmail.com)
17   * @date 2014年10月21日
18   * @since JDK 1.6
19   * @see
20   */
21  @XmlRootElement
22  @XmlAccessorType(XmlAccessType.FIELD)
23  public class MerchantResult extends XmlResult {
24  
25  	private static final long serialVersionUID = -8430005768959715444L;
26  
27  	/**
28  	 * 微信分配的公众账号 ID商户号 非空
29  	 */
30  	@XmlElement(name = "appid")
31  	@JSONField(name = "appid")
32  	private String appId;
33  	/**
34  	 * 微信支付分配的商户号 非空
35  	 */
36  	@XmlElement(name = "mch_id")
37  	@JSONField(name = "mch_id")
38  	private String mchId;
39  	/**
40  	 * 微信分配的子商户公众账号ID 非必须
41  	 */
42  	@XmlElement(name = "sub_appid")
43  	@JSONField(name = "sub_appid")
44  	private String subAppId;
45  	/**
46  	 * 微信支付分配的子商户号 非必须
47  	 */
48  	@XmlElement(name = "sub_mch_id")
49  	@JSONField(name = "sub_mch_id")
50  	private String subMchId;
51  	/**
52  	 * 随机字符串 非空
53  	 */
54  	@XmlElement(name = "nonce_str")
55  	@JSONField(name = "nonce_str")
56  	private String nonceStr;
57  	/**
58  	 * 签名 <font color="red">调用者无需关心</font>
59  	 */
60  	private String sign;
61  	/**
62  	 * 签名类型 默认MD5
63  	 */
64  	@XmlElement(name = "sign_type")
65  	@JSONField(name = "sign_type")
66  	private String signType;
67  	/**
68  	 * 微信支付分配的终端设备号 可能为空
69  	 */
70  	@XmlElement(name = "device_info")
71  	@JSONField(name = "device_info")
72  	private String deviceInfo;
73  	/**
74  	 * 是否需要继续调用接口 Y- 需要,N-不需要
75  	 */
76  	private String recall;
77  
78  	protected MerchantResult() {
79  		// jaxb required
80  	}
81  
82  	public MerchantResult(String returnCode, String returnMsg) {
83  		super(returnCode, returnMsg);
84  	}
85  
86  	public String getAppId() {
87  		return appId;
88  	}
89  
90  	public void setAppId(String appId) {
91  		this.appId = appId;
92  	}
93  
94  	public String getMchId() {
95  		return mchId;
96  	}
97  
98  	public void setMchId(String mchId) {
99  		this.mchId = mchId;
100 	}
101 
102 	public String getSubAppId() {
103 		return subAppId;
104 	}
105 
106 	public void setSubAppId(String subAppId) {
107 		this.subAppId = subAppId;
108 	}
109 
110 	public String getSubMchId() {
111 		return subMchId;
112 	}
113 
114 	public void setSubMchId(String subMchId) {
115 		this.subMchId = subMchId;
116 	}
117 
118 	public String getNonceStr() {
119 		return nonceStr;
120 	}
121 
122 	public void setNonceStr(String nonceStr) {
123 		this.nonceStr = nonceStr;
124 	}
125 
126 	public String getSign() {
127 		return sign;
128 	}
129 
130 	public void setSign(String sign) {
131 		this.sign = sign;
132 	}
133 
134 	public String getSignType() {
135 		return signType;
136 	}
137 
138 	public void setSignType(String signType) {
139 		this.signType = signType;
140 	}
141 
142 	public String getDeviceInfo() {
143 		return deviceInfo;
144 	}
145 
146 	public void setDeviceInfo(String deviceInfo) {
147 		this.deviceInfo = deviceInfo;
148 	}
149 
150 	public String getRecall() {
151 		return recall;
152 	}
153 
154 	public void setRecall(String recall) {
155 		this.recall = recall;
156 	}
157 
158 	@JSONField(serialize = false)
159 	public boolean getFormatRecall() {
160 		return recall != null && recall.equalsIgnoreCase("y");
161 	}
162 
163 	@Override
164 	public String toString() {
165 		return "appId=" + appId + ", mchId=" + mchId + ", subAppId=" + subAppId
166 				+ ", subMchId=" + subMchId + ", nonceStr=" + nonceStr
167 				+ ", sign=" + sign + ", deviceInfo=" + deviceInfo + ", recall="
168 				+ getFormatRecall() + ", " + super.toString();
169 	}
170 }