1 package com.foxinmy.weixin4j.model.card;
2
3 import com.alibaba.fastjson.annotation.JSONField;
4 import com.foxinmy.weixin4j.type.card.CardType;
5 import com.foxinmy.weixin4j.type.card.FieldNameType;
6
7
8
9
10
11
12 public class MemberCard extends CardCoupon {
13
14
15
16
17
18 @JSONField(name = "background_pic_url")
19 private String backgroundPicUrl;
20
21
22
23
24 @JSONField(name = "prerogative")
25 private String prerogative;
26
27
28
29 @JSONField(name = "auto_activate")
30 private boolean autoActivate;
31
32
33
34 @JSONField(name = "wx_activate")
35 private boolean wxActivate;
36
37
38
39 @JSONField(name = "activate_url")
40 private String activateUrl;
41
42
43
44
45 @JSONField(name = "supply_bonus")
46 private boolean supplyBonus;
47
48
49
50 @JSONField(name = "bonus_url")
51 private String bonusUrl;
52
53
54
55 @JSONField(name = "supply_balance")
56 private boolean supplyBalance;
57
58
59
60 @JSONField(name = "balance_url")
61 private String balanceUrl;
62
63
64
65
66 @JSONField(name = "custom_field1")
67 private MemCardCustomField customField1;
68
69
70
71 @JSONField(name = "custom_field2")
72 private MemCardCustomField customField2;
73
74
75
76 @JSONField(name = "custom_field3")
77 private MemCardCustomField customField3;
78
79
80
81
82 @JSONField(name = "bonus_rules")
83 private String bonusRules;
84
85
86
87 @JSONField(name = "balance_rules")
88 private String balanceRules;
89
90
91
92 @JSONField(name = "bonus_cleared")
93 private String bonusCleared;
94
95
96
97 @JSONField(name = "custom_cell1")
98 private MemCardCustomField customCell1;
99
100
101
102
103 private int discount;
104
105 @JSONField(name = "bonus_rule")
106 private MemCardBonusRule bonusRule;
107
108
109
110
111
112
113
114 protected MemberCard(CouponBaseInfo couponBaseInfo, Builder builder) {
115 super(couponBaseInfo);
116 this.activateUrl = builder.activateUrl;
117 this.backgroundPicUrl = builder.backgroundPicUrl;
118 this.prerogative = builder.prerogative;
119 this.autoActivate = builder.autoActivate;
120 this.wxActivate = builder.wxActivate;
121 this.activateUrl = builder.activateUrl;
122 this.supplyBonus = builder.supplyBonus;
123 this.bonusUrl = builder.bonusUrl;
124 this.supplyBalance = builder.supplyBalance;
125 this.balanceUrl = builder.balanceUrl;
126 this.customField1 = builder.customField1;
127 this.customField2 = builder.customField2;
128 this.customField3 = builder.customField3;
129 this.bonusRules = builder.bonusRules;
130 this.balanceRules = builder.balanceRules;
131 this.bonusCleared = builder.bonusCleared;
132 this.customCell1 = builder.customCell1;
133 this.discount = builder.discount;
134 this.bonusRule = builder.bonusRule;
135 }
136
137 @JSONField(serialize = false)
138 @Override
139 public CardType getCardType() {
140 return CardType.MEMBER_CARD;
141 }
142
143 public String getBackgroundPicUrl() {
144 return backgroundPicUrl;
145 }
146
147 public String getPrerogative() {
148 return prerogative;
149 }
150
151 public boolean isAutoActivate() {
152 return autoActivate;
153 }
154
155 public boolean isWxActivate() {
156 return wxActivate;
157 }
158
159 public String getActivateUrl() {
160 return activateUrl;
161 }
162
163 public boolean isSupplyBonus() {
164 return supplyBonus;
165 }
166
167 public String getBonusUrl() {
168 return bonusUrl;
169 }
170
171 public boolean getSupplyBalance() {
172 return supplyBalance;
173 }
174
175 public String getBalanceUrl() {
176 return balanceUrl;
177 }
178
179 public MemCardCustomField getCustomField1() {
180 return customField1;
181 }
182
183 public MemCardCustomField getCustomField2() {
184 return customField2;
185 }
186
187 public MemCardCustomField getCustomField3() {
188 return customField3;
189 }
190
191 public String getBonusRules() {
192 return bonusRules;
193 }
194
195 public String getBalanceRules() {
196 return balanceRules;
197 }
198
199 public String getBonusCleared() {
200 return bonusCleared;
201 }
202
203 public MemCardCustomField getCustomCell1() {
204 return customCell1;
205 }
206
207 public int getDiscount() {
208 return discount;
209 }
210
211 public MemCardBonusRule getBonusRule() {
212 return bonusRule;
213 }
214
215
216 public static final class Builder {
217
218
219
220
221
222 private String backgroundPicUrl;
223
224
225
226
227 private String prerogative;
228
229
230
231 private boolean autoActivate;
232
233
234
235 private boolean wxActivate;
236
237
238
239 private String activateUrl;
240
241
242
243
244 private boolean supplyBonus;
245
246
247
248 private String bonusUrl;
249
250
251
252 private boolean supplyBalance;
253
254
255
256 private String balanceUrl;
257
258
259
260 private MemCardCustomField customField1;
261
262
263
264 private MemCardCustomField customField2;
265
266
267
268 private MemCardCustomField customField3;
269
270
271
272 private String bonusRules;
273
274
275
276 private String balanceRules;
277
278
279
280 private String bonusCleared;
281
282
283
284 private MemCardCustomField customCell1;
285
286
287
288 private int discount;
289
290
291
292 private MemCardBonusRule bonusRule;
293
294
295 public Builder backgroundPicUrl(String backgroundPicUrl) {
296 this.backgroundPicUrl = backgroundPicUrl;
297 return this;
298 }
299
300 public Builder prerogative(String prerogative) {
301 this.prerogative = prerogative;
302 return this;
303 }
304
305 public Builder activateWithAuto(boolean autoActivate) {
306 this.autoActivate = autoActivate;
307 this.activateUrl = null;
308 this.wxActivate = false;
309 return this;
310 }
311
312 public Builder activateWithWx(boolean wxActivate) {
313 this.wxActivate = wxActivate;
314 this.autoActivate = false;
315 this.activateUrl = null;
316 return this;
317 }
318
319 public Builder activateUrl(String activateUrl) {
320 this.activateUrl = activateUrl;
321 this.autoActivate = false;
322 this.wxActivate = false;
323 return this;
324 }
325
326 public Builder supplyBonus(boolean supplyBonus) {
327 this.supplyBonus = supplyBonus;
328 return this;
329 }
330
331 public Builder bonusUrl(String bonusUrl) {
332 this.bonusUrl = bonusUrl;
333 return this;
334 }
335
336 public Builder supplyBalance(boolean supplyBalance) {
337 this.supplyBalance = supplyBalance;
338 return this;
339 }
340
341 public Builder balanceUrl(String balanceUrl) {
342 this.balanceUrl = balanceUrl;
343 return this;
344 }
345
346 public Builder customField1(FieldNameType type, String name, String url) {
347 this.customField1 = new MemCardCustomField(type, name, url);
348 return this;
349 }
350
351 public Builder customField2(FieldNameType type, String name, String url) {
352 this.customField2 = new MemCardCustomField(type, name, url);
353 return this;
354 }
355
356 public Builder customField3(FieldNameType type, String name, String url) {
357 this.customField3 = new MemCardCustomField(type, name, url);
358 return this;
359 }
360
361 public Builder bonusRules(String bonusRules) {
362 this.bonusRules = bonusRules;
363 return this;
364 }
365
366 public Builder balanceRules(String balanceRules) {
367 this.balanceRules = balanceRules;
368 return this;
369 }
370
371 public Builder bonusCleared(String bonusCleared) {
372 this.bonusCleared = bonusCleared;
373 return this;
374 }
375
376 public Builder customCell1(String name, String url, String tips) {
377 this.customCell1 = new MemCardCustomField(name, url, tips);
378 return this;
379 }
380
381 public Builder discount(int discount) {
382 this.discount = discount;
383 return this;
384 }
385
386 public Builder bonusRule(MemCardBonusRule bonusRule) {
387 this.bonusRule = bonusRule;
388 return this;
389 }
390 }
391 }