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