-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathCustomer.java
More file actions
262 lines (199 loc) · 6.42 KB
/
Customer.java
File metadata and controls
262 lines (199 loc) · 6.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
package com.riskified.models;
import java.util.*;
import com.riskified.validations.*;
public class Customer implements IValidated {
private String email;
private String firstName;
private String lastName;
private Date createdAt;
private Date updatedAt;
private String id;
private String groupId;
private String groupName;
private String note;
private Integer ordersCount;
private Boolean verifiedEmail;
private Boolean acceptsMarketing;
private String lastOrderId;
private String lastOrderName;
private String state;
private Float totalSpent;
private String tags;
private Address defaultAddress;
private List<SocialDetails> social;
private Gender gender; // male or female
private Address address;
private String accountType;
private Integer linkedAccounts;
private String documentId;
private String documentType;
private String phone;
private Boolean verifiedPhone;
private Date verifiedPhoneAt;
private String userName;
public Customer() {
}
public Customer(String email, String firstName, String lastName) {
this.email = email;
this.firstName = firstName;
this.lastName = lastName;
}
public Customer(String email, String firstName, String lastName, String id, Date createdAt, Boolean verifiedEmail, Integer ordersCount) {
this.email = email;
this.firstName = firstName;
this.lastName = lastName;
this.id = id;
this.createdAt = createdAt;
this.verifiedEmail = verifiedEmail;
this.ordersCount = ordersCount;
this.setSocial(new ArrayList<SocialDetails>());
}
public void validate(Validation validationType) throws FieldBadFormatException {
if (validationType == Validation.ALL) {
Validate.notNullOrEmpty(this, this.email, "Email");
Validate.notNullOrEmpty(this, this.firstName, "First Name");
Validate.notNullOrEmpty(this, this.lastName, "Last Name");
//Validate.notNullOrEmpty(this, this.id, "Id");
//Validate.notNull(this, this.createdAt, "Created At");
Validate.notNull(this, this.verifiedEmail, "Verified Email");
}
if (this.email != null) {
Validate.emailAddress(this, email, "Email");
}
if (this.social != null) {
for (SocialDetails socialDetails : this.social) {
socialDetails.validate(validationType);
}
}
}
public String getEmail() {
return email;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getGroupId() {
return groupId;
}
public void setGroupId(String groupId) {
this.groupId = groupId;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public Integer getOrdersCount() {
return ordersCount;
}
public void setVerifiedEmail(Boolean verifiedEmail) {
this.verifiedEmail = verifiedEmail;
}
public Boolean getVerifiedEmail() {
return verifiedEmail;
}
public Boolean getAcceptsMarketing() {
return acceptsMarketing;
}
public void setAcceptsMarketing(Boolean acceptsMarketing) {
this.acceptsMarketing = acceptsMarketing;
}
public String getLastOrderId() {
return lastOrderId;
}
public void setLastOrderId(String lastOrderId) {
this.lastOrderId = lastOrderId;
}
public String getLastOrderName() {
return lastOrderName;
}
public void setLastOrderName(String lastOrderName) {
this.lastOrderName = lastOrderName;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public Float getTotalSpent() {
return totalSpent;
}
public void setTotalSpent(Float totalSpent) {
this.totalSpent = totalSpent;
}
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
public Address getDefaultAddress() {
return defaultAddress;
}
public void setDefaultAddress(Address defaultAddress) {
this.defaultAddress = defaultAddress;
}
public List<SocialDetails> getSocial() {
return social;
}
public void setSocial(List<SocialDetails> social) {
this.social = social;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public String getAccountType() {
return accountType;
}
public void setAccountType(String accountType) {
this.accountType = accountType;
}
public Integer getLinkedAccounts() {
return linkedAccounts;
}
public void setLinkedAccounts(Integer linkedAccounts) { this.linkedAccounts = linkedAccounts; }
public String getDocumentId() { return documentId; }
public void setDocumentId(String documentId) { this.documentId = documentId; }
public String getDocumentType() { return documentType; }
public void setDocumentType(String documentType) { this.documentType = documentType; }
public String getPhone() { return phone; }
public void setPhone(String phone) { this.phone = phone; }
public Boolean getVerifiedPhone() { return verifiedPhone; }
public void setVerifiedPhone(Boolean verifiedPhone) { this.verifiedPhone = verifiedPhone; }
public Date getVerifiedPhoneAt() { return verifiedPhoneAt; }
public void setVerifiedPhoneAt(Date verifiedPhoneAt) { this.verifiedPhoneAt = verifiedPhoneAt; }
public String getUserName() { return userName; }
public void setUserName(String userName) { this.userName = userName; }
}