1 package com.foxinmy.weixin4j.pay.model;
2
3 import com.alibaba.fastjson.annotation.JSONCreator;
4 import com.alibaba.fastjson.annotation.JSONField;
5 import com.foxinmy.weixin4j.model.WeixinAccount;
6 import com.foxinmy.weixin4j.util.StringUtil;
7
8
9
10
11
12
13
14
15
16
17 public class WeixinPayAccount extends WeixinAccount {
18
19 private static final long serialVersionUID = -2791256176906048632L;
20
21
22
23 private final String paySignKey;
24
25
26
27 private final String mchId;
28
29
30
31 private String certificateKey;
32
33
34
35 private String certificateFile;
36
37
38
39 private String deviceInfo;
40
41
42
43 private String partnerId;
44
45
46
47
48 private String subId;
49
50
51
52 private String subMchId;
53
54
55
56
57
58
59
60
61
62
63
64 public WeixinPayAccount(String id, String paySignKey, String mchId) {
65 this(id, paySignKey, mchId, mchId, "classpath:ca.p12");
66 }
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82 public WeixinPayAccount(String id, String paySignKey, String mchId, String certificateKey, String certificateFile) {
83 this(id, null, paySignKey, mchId, certificateKey, certificateFile, null, null, null, null);
84 }
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110 @JSONCreator
111 public WeixinPayAccount(@JSONField(name = "id") String id, @JSONField(name = "secret") String secret,
112 @JSONField(name = "paySignKey") String paySignKey, @JSONField(name = "mchId") String mchId,
113 @JSONField(name = "certificateKey") String certificateKey,
114 @JSONField(name = "certificateFile") String certificateFile,
115 @JSONField(name = "deviceInfo") String deviceInfo, @JSONField(name = "partnerId") String partnerId,
116 @JSONField(name = "subId") String subId, @JSONField(name = "subMchId") String subMchId) {
117 super(id, secret);
118 this.paySignKey = paySignKey;
119 this.mchId = mchId;
120 this.certificateKey = certificateKey;
121 this.certificateFile = certificateFile;
122 this.deviceInfo = deviceInfo;
123 this.partnerId = partnerId;
124 this.subId = subId;
125 this.subMchId = subMchId;
126 }
127
128 public String getPaySignKey() {
129 return paySignKey;
130 }
131
132 public String getMchId() {
133 return mchId;
134 }
135
136 public String getDeviceInfo() {
137 return deviceInfo;
138 }
139
140 public String getCertificateKey() {
141 return StringUtil.isBlank(certificateKey) ? mchId : certificateKey;
142 }
143
144 public String getPartnerId() {
145 return partnerId;
146 }
147
148 public String getSubId() {
149 return subId;
150 }
151
152 public String getSubMchId() {
153 return subMchId;
154 }
155
156 public void setCertificateKey(String certificateKey) {
157 this.certificateKey = certificateKey;
158 }
159
160 public String getCertificateFile() {
161 return certificateFile;
162 }
163
164 public void setCertificateFile(String certificateFile) {
165 this.certificateFile = certificateFile;
166 }
167
168 public void setDeviceInfo(String deviceInfo) {
169 this.deviceInfo = deviceInfo;
170 }
171
172 public void setPartnerId(String partnerId) {
173 this.partnerId = partnerId;
174 }
175
176 public void setSubId(String subId) {
177 this.subId = subId;
178 }
179
180 public void setSubMchId(String subMchId) {
181 this.subMchId = subMchId;
182 }
183
184 @Override
185 public String toString() {
186 return "WeixinPayAccount [" + super.toString() + ", paySignKey=" + paySignKey + ", mchId=" + mchId
187 + ", certificateKey=" + certificateKey + ",certificateFile =" + certificateFile + ", deviceInfo="
188 + deviceInfo + ", partnerId=" + partnerId + ", subId=" + subId + ", subMchId=" + subMchId + "]";
189 }
190 }