View Javadoc
1   package com.foxinmy.weixin4j.pay.payment;
2   
3   import com.alibaba.fastjson.annotation.JSONField;
4   import com.foxinmy.weixin4j.pay.type.SignType;
5   
6   import javax.xml.bind.annotation.*;
7   import java.io.Serializable;
8   
9   /**
10   * 基本信息
11   * 
12   * @className PayBaseInfo
13   * @author jinyu(foxinmy@gmail.com)
14   * @date 2014年11月5日
15   * @since JDK 1.6
16   * @see
17   */
18  @XmlRootElement
19  @XmlAccessorType(XmlAccessType.FIELD)
20  public class PayBaseInfo implements Serializable {
21  
22  	private static final long serialVersionUID = 1843024880782466990L;
23  
24  	/**
25  	 * 公众号ID
26  	 */
27  	@JSONField(name = "appId")
28  	@XmlElement(name = "AppId")
29  	private String appId;
30  	/**
31  	 * 时间戳
32  	 */
33  	@JSONField(name = "timeStamp")
34  	@XmlElement(name = "TimeStamp")
35  	private String timeStamp;
36  	/**
37  	 * 随机字符串
38  	 */
39  	@JSONField(name = "nonceStr")
40  	@XmlElement(name = "NonceStr")
41  	private String nonceStr;
42  	/**
43  	 * 签名结果
44  	 */
45  	@JSONField(name = "paySign")
46  	@XmlElement(name = "AppSignature")
47  	private String paySign;
48  	/**
49  	 * 签名方式
50  	 */
51  	@JSONField(name = "signType")
52  	@XmlElement(name = "SignMethod")
53  	private String signType;
54  
55  	public String getAppId() {
56  		return appId;
57  	}
58  
59  	public void setAppId(String appId) {
60  		this.appId = appId;
61  	}
62  
63  	public String getTimeStamp() {
64  		return timeStamp;
65  	}
66  
67  	public void setTimeStamp(String timeStamp) {
68  		this.timeStamp = timeStamp;
69  	}
70  
71  	public String getNonceStr() {
72  		return nonceStr;
73  	}
74  
75  	public void setNonceStr(String nonceStr) {
76  		this.nonceStr = nonceStr;
77  	}
78  
79  	public String getPaySign() {
80  		return paySign;
81  	}
82  
83  	public void setPaySign(String paySign) {
84  		this.paySign = paySign;
85  	}
86  
87  	public String getSignType() {
88  		return signType;
89  	}
90  
91  	@XmlTransient
92  	@JSONField(serialize = false)
93  	public SignType getFormatSignType() {
94  		return signType != null ? SignType.valueOf(signType.toUpperCase())
95  				: null;
96  	}
97  
98  	public void setSignType(SignType signType) {
99  		this.signType = signType != null ? signType.name() : null;
100 	}
101 
102 	public PayBaseInfo() {
103 	}
104 
105 	public PayBaseInfo(String appId, String timestamp, String noncestr) {
106 		this.appId = appId;
107 		this.timeStamp = timestamp;
108 		this.nonceStr = noncestr;
109 	}
110 
111 	@Override
112 	public String toString() {
113 		return "appId=" + appId + ", timeStamp=" + timeStamp + ", nonceStr="
114 				+ nonceStr + ", paySign=" + paySign + ", signType=" + signType;
115 	}
116 }