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.SubCardType;
6
7
8
9
10
11
12
13
14
15 public class VoucherCard extends CardCoupon {
16
17
18
19
20 @JSONField(name = "sub_card_type")
21 private final String subCardType;
22
23
24
25 @JSONField(name = "background_pic_url")
26 private String backgroundPicUrl;
27
28
29
30 @JSONField(name = "supply_bonus")
31 private boolean supplyBonus;
32
33
34
35 @JSONField(name = "supply_balance")
36 private boolean supplyBalance;
37
38
39
40 @JSONField(name = "custom_field1")
41 private MemCardCustomField customField1;
42
43
44
45 @JSONField(name = "custom_field2")
46 private MemCardCustomField customField2;
47
48
49
50 @JSONField(name = "custom_field3")
51 private MemCardCustomField customField3;
52
53
54
55 @JSONField(name = "auto_activate")
56 private boolean autoActivate;
57
58 public String getSubCardType() {
59 return subCardType;
60 }
61
62 public String getBackgroundPicUrl() {
63 return backgroundPicUrl;
64 }
65
66 public boolean isSupplyBonus() {
67 return supplyBonus;
68 }
69
70 public boolean isSupplyBalance() {
71 return supplyBalance;
72 }
73
74 public MemCardCustomField getCustomField1() {
75 return customField1;
76 }
77
78 public MemCardCustomField getCustomField2() {
79 return customField2;
80 }
81
82 public MemCardCustomField getCustomField3() {
83 return customField3;
84 }
85
86 public boolean isAutoActivate() {
87 return autoActivate;
88 }
89
90 public VoucherCard(CouponBaseInfo baseInfo, GiftCard.Builder builder){
91 super(baseInfo);
92 this.subCardType = SubCardType.VOUCHER.name();
93 this.autoActivate = builder.isAutoActivate();
94 this.backgroundPicUrl = builder.getBackgroundPicUrl();
95 this.customField1 = builder.getCustomField1();
96 this.customField2 = builder.getCustomField2();
97 this.customField3 = builder.getCustomField3();
98 this.supplyBalance = false;
99 this.supplyBonus = builder.isSupplyBonus();;
100 }
101
102 @JSONField(serialize = false)
103 @Override
104 public CardType getCardType() {
105 return CardType.GENERAL_CARD;
106 }
107
108 @Override
109 public String toString() {
110 return "VoucherCardCoupon [" +
111 "subCardType='" + subCardType + '\'' +
112 ", backgroundPicUrl='" + backgroundPicUrl + '\'' +
113 ", supplyBonus=" + supplyBonus +
114 ", supplyBalance=" + supplyBalance +
115 ", customField1=" + customField1 +
116 ", customField2=" + customField2 +
117 ", customField3=" + customField3 +
118 ", autoActivate=" + autoActivate +
119 ", " + super.toString() +
120 ']';
121 }
122 }