|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Magium\Magento\Identities; |
|
4
|
|
|
|
|
5
|
|
|
use Magium\Identities\AddressInterface; |
|
6
|
|
|
use Magium\Identities\EmailInterface; |
|
7
|
|
|
use Magium\Identities\NameInterface; |
|
8
|
|
|
use Magium\Util\EmailGenerator\Generator; |
|
9
|
|
|
use Magium\Util\EmailGenerator\GeneratorAware; |
|
10
|
|
|
|
|
11
|
|
|
class Customer extends AbstractEntity implements GeneratorAware, NameInterface, EmailInterface, AddressInterface |
|
12
|
|
|
{ |
|
13
|
|
|
const IDENTITY = 'Customer'; |
|
14
|
|
|
|
|
15
|
|
|
public $emailAddress = '[email protected]'; |
|
16
|
|
|
|
|
17
|
|
|
public $billingFirstName = 'Kevin'; |
|
18
|
|
|
public $billingLastName = 'Schroeder'; |
|
19
|
|
|
public $billingCompany = ''; |
|
20
|
|
|
public $billingAddress = '10451 Jefferson Blvd'; |
|
21
|
|
|
public $billingAddress2 = ''; |
|
22
|
|
|
public $billingCity = 'Culver City'; |
|
23
|
|
|
public $billingRegionId = 'California'; |
|
24
|
|
|
public $billingPostCode = '90232'; |
|
25
|
|
|
public $billingCountryId = 'US'; |
|
26
|
|
|
public $billingTelephone = '123-123-1234'; |
|
27
|
|
|
public $billingFax = ''; |
|
28
|
|
|
|
|
29
|
|
|
public $shippingFirstName = 'Kevin'; |
|
30
|
|
|
public $shippingLastName = 'Schroeder'; |
|
31
|
|
|
public $shippingCompany = ''; |
|
32
|
|
|
public $shippingAddress = '10451 Jefferson Blvd'; |
|
33
|
|
|
public $shippingAddress2 = ''; |
|
34
|
|
|
public $shippingCity = 'Culver City'; |
|
35
|
|
|
public $shippingRegionId = 'California'; |
|
36
|
|
|
public $shippingPostCode = '90232'; |
|
37
|
|
|
public $shippingCountryId = 'US'; |
|
38
|
|
|
public $shippingTelephone = '123-123-1234'; |
|
39
|
|
|
public $shippingFax = ''; |
|
40
|
|
|
|
|
41
|
|
|
protected $uniqueEmailAddressGenerated = false; |
|
42
|
|
|
protected $generator; |
|
43
|
|
|
|
|
44
|
|
|
public function setGenerator(Generator $generator) |
|
45
|
|
|
{ |
|
46
|
|
|
$this->generator = $generator; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function getCompany() |
|
50
|
|
|
{ |
|
51
|
|
|
return $this->getBillingCompany(); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function getAddress() |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->getBillingAddress(); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function getAddress2() |
|
60
|
|
|
{ |
|
61
|
|
|
return $this->getBillingAddress2(); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function getCity() |
|
65
|
|
|
{ |
|
66
|
|
|
return $this->getBillingCity(); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function getRegionId() |
|
70
|
|
|
{ |
|
71
|
|
|
return $this->getBillingRegionId(); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
public function getPostCode() |
|
75
|
|
|
{ |
|
76
|
|
|
return $this->getBillingPostCode(); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
public function getCountryId() |
|
80
|
|
|
{ |
|
81
|
|
|
return $this->getBillingCountryId(); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
public function setCompany($value) |
|
85
|
|
|
{ |
|
86
|
|
|
$this->setBillingCompany($value); |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
public function setAddress($value) |
|
90
|
|
|
{ |
|
91
|
|
|
$this->setBillingAddress($value); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
public function setAddress2($value) |
|
95
|
|
|
{ |
|
96
|
|
|
$this->setBillingAddress2($value); |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
public function setCity($value) |
|
100
|
|
|
{ |
|
101
|
|
|
$this->setBillingCity($value); |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
public function setRegionId($value) |
|
105
|
|
|
{ |
|
106
|
|
|
$this->setBillingRegionId($value); |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
public function setPostCode($value) |
|
110
|
|
|
{ |
|
111
|
|
|
$this->setBillingPostCode($value); |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
public function setCountryId($value) |
|
115
|
|
|
{ |
|
116
|
|
|
$this->setBillingCountryId($value); |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
public function getFirstName() |
|
120
|
|
|
{ |
|
121
|
|
|
return $this->getBillingFirstName(); |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
public function getLastName() |
|
125
|
|
|
{ |
|
126
|
|
|
return $this->getBillingLastName(); |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
public function setFirstName($value) |
|
130
|
|
|
{ |
|
131
|
|
|
$this->setBillingFirstName($value); |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
public function setLastName($value) |
|
135
|
|
|
{ |
|
136
|
|
|
$this->setBillingLastName($value); |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
|
|
140
|
|
|
public function generateUniqueEmailAddress($domain = 'example.com') |
|
141
|
|
|
{ |
|
142
|
|
|
if ($this->generator instanceof NameInterface) { |
|
143
|
|
|
$this->generator->setFirstName($this->getFirstName()); |
|
144
|
|
|
$this->generator->setLastName($this->getLastName()); |
|
145
|
|
|
} |
|
146
|
|
|
if ($this->generator instanceof EmailInterface) { |
|
147
|
|
|
$this->generator->setEmailAddress($this->getEmailAddress()); |
|
148
|
|
|
} |
|
149
|
|
|
$this->uniqueEmailAddressGenerated = true; |
|
150
|
|
|
$this->emailAddress = $this->generator->generate($domain); |
|
151
|
|
|
return $this->emailAddress; |
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
|
|
/** |
|
155
|
|
|
* @return boolean |
|
156
|
|
|
*/ |
|
157
|
|
|
public function isUniqueEmailAddressGenerated() |
|
158
|
|
|
{ |
|
159
|
|
|
return $this->uniqueEmailAddressGenerated; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
/** |
|
163
|
|
|
* @param boolean $uniqueEmailAddressGenerated |
|
164
|
|
|
*/ |
|
165
|
|
|
public function setUniqueEmailAddressGenerated($uniqueEmailAddressGenerated) |
|
166
|
|
|
{ |
|
167
|
|
|
$this->uniqueEmailAddressGenerated = $uniqueEmailAddressGenerated; |
|
168
|
|
|
} |
|
169
|
|
|
|
|
170
|
|
|
/** |
|
171
|
|
|
* @return string |
|
172
|
|
|
*/ |
|
173
|
|
|
public function getBillingFirstName() |
|
174
|
|
|
{ |
|
175
|
|
|
return $this->billingFirstName; |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* @param string $billingFirstName |
|
180
|
|
|
*/ |
|
181
|
|
|
public function setBillingFirstName($billingFirstName) |
|
182
|
|
|
{ |
|
183
|
|
|
$this->billingFirstName = $billingFirstName; |
|
184
|
|
|
} |
|
185
|
|
|
|
|
186
|
|
|
/** |
|
187
|
|
|
* @return string |
|
188
|
|
|
*/ |
|
189
|
|
|
public function getBillingLastName() |
|
190
|
|
|
{ |
|
191
|
|
|
return $this->billingLastName; |
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
/** |
|
195
|
|
|
* @param string $billingLastName |
|
196
|
|
|
*/ |
|
197
|
|
|
public function setBillingLastName($billingLastName) |
|
198
|
|
|
{ |
|
199
|
|
|
$this->billingLastName = $billingLastName; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
/** |
|
203
|
|
|
* @return string |
|
204
|
|
|
*/ |
|
205
|
|
|
public function getBillingCompany() |
|
206
|
|
|
{ |
|
207
|
|
|
return $this->billingCompany; |
|
208
|
|
|
} |
|
209
|
|
|
|
|
210
|
|
|
/** |
|
211
|
|
|
* @param string $billingCompany |
|
212
|
|
|
*/ |
|
213
|
|
|
public function setBillingCompany($billingCompany) |
|
214
|
|
|
{ |
|
215
|
|
|
$this->billingCompany = $billingCompany; |
|
216
|
|
|
} |
|
217
|
|
|
|
|
218
|
|
|
/** |
|
219
|
|
|
* @return string |
|
220
|
|
|
*/ |
|
221
|
|
|
public function getEmailAddress() |
|
222
|
|
|
{ |
|
223
|
|
|
return $this->emailAddress; |
|
224
|
|
|
} |
|
225
|
|
|
|
|
226
|
|
|
/** |
|
227
|
|
|
* @param string $emailAddress |
|
228
|
|
|
*/ |
|
229
|
|
|
public function setEmailAddress($emailAddress) |
|
230
|
|
|
{ |
|
231
|
|
|
$this->emailAddress = $emailAddress; |
|
232
|
|
|
} |
|
233
|
|
|
|
|
234
|
|
|
|
|
235
|
|
|
|
|
236
|
|
|
/** |
|
237
|
|
|
* @return string |
|
238
|
|
|
*/ |
|
239
|
|
|
public function getBillingAddress() |
|
240
|
|
|
{ |
|
241
|
|
|
return $this->billingAddress; |
|
242
|
|
|
} |
|
243
|
|
|
|
|
244
|
|
|
/** |
|
245
|
|
|
* @param string $billingAddress |
|
246
|
|
|
*/ |
|
247
|
|
|
public function setBillingAddress($billingAddress) |
|
248
|
|
|
{ |
|
249
|
|
|
$this->billingAddress = $billingAddress; |
|
250
|
|
|
} |
|
251
|
|
|
|
|
252
|
|
|
/** |
|
253
|
|
|
* @return string |
|
254
|
|
|
*/ |
|
255
|
|
|
public function getBillingAddress2() |
|
256
|
|
|
{ |
|
257
|
|
|
return $this->billingAddress2; |
|
258
|
|
|
} |
|
259
|
|
|
|
|
260
|
|
|
/** |
|
261
|
|
|
* @param string $billingAddress2 |
|
262
|
|
|
*/ |
|
263
|
|
|
public function setBillingAddress2($billingAddress2) |
|
264
|
|
|
{ |
|
265
|
|
|
$this->billingAddress2 = $billingAddress2; |
|
266
|
|
|
} |
|
267
|
|
|
|
|
268
|
|
|
/** |
|
269
|
|
|
* @return string |
|
270
|
|
|
*/ |
|
271
|
|
|
public function getBillingCity() |
|
272
|
|
|
{ |
|
273
|
|
|
return $this->billingCity; |
|
274
|
|
|
} |
|
275
|
|
|
|
|
276
|
|
|
/** |
|
277
|
|
|
* @param string $billingCity |
|
278
|
|
|
*/ |
|
279
|
|
|
public function setBillingCity($billingCity) |
|
280
|
|
|
{ |
|
281
|
|
|
$this->billingCity = $billingCity; |
|
282
|
|
|
} |
|
283
|
|
|
|
|
284
|
|
|
/** |
|
285
|
|
|
* @return string |
|
286
|
|
|
*/ |
|
287
|
|
|
public function getBillingRegionId() |
|
288
|
|
|
{ |
|
289
|
|
|
return $this->billingRegionId; |
|
290
|
|
|
} |
|
291
|
|
|
|
|
292
|
|
|
/** |
|
293
|
|
|
* @param string $billingRegionId |
|
294
|
|
|
*/ |
|
295
|
|
|
public function setBillingRegionId($billingRegionId) |
|
296
|
|
|
{ |
|
297
|
|
|
$this->billingRegionId = $billingRegionId; |
|
298
|
|
|
} |
|
299
|
|
|
|
|
300
|
|
|
/** |
|
301
|
|
|
* @return string |
|
302
|
|
|
*/ |
|
303
|
|
|
public function getBillingPostCode() |
|
304
|
|
|
{ |
|
305
|
|
|
return $this->billingPostCode; |
|
306
|
|
|
} |
|
307
|
|
|
|
|
308
|
|
|
/** |
|
309
|
|
|
* @param string $billingPostCode |
|
310
|
|
|
*/ |
|
311
|
|
|
public function setBillingPostCode($billingPostCode) |
|
312
|
|
|
{ |
|
313
|
|
|
$this->billingPostCode = $billingPostCode; |
|
314
|
|
|
} |
|
315
|
|
|
|
|
316
|
|
|
/** |
|
317
|
|
|
* @return string |
|
318
|
|
|
*/ |
|
319
|
|
|
public function getBillingCountryId() |
|
320
|
|
|
{ |
|
321
|
|
|
return $this->billingCountryId; |
|
322
|
|
|
} |
|
323
|
|
|
|
|
324
|
|
|
/** |
|
325
|
|
|
* @param string $billingCountryId |
|
326
|
|
|
*/ |
|
327
|
|
|
public function setBillingCountryId($billingCountryId) |
|
328
|
|
|
{ |
|
329
|
|
|
$this->billingCountryId = $billingCountryId; |
|
330
|
|
|
} |
|
331
|
|
|
|
|
332
|
|
|
/** |
|
333
|
|
|
* @return string |
|
334
|
|
|
*/ |
|
335
|
|
|
public function getBillingTelephone() |
|
336
|
|
|
{ |
|
337
|
|
|
return $this->billingTelephone; |
|
338
|
|
|
} |
|
339
|
|
|
|
|
340
|
|
|
/** |
|
341
|
|
|
* @param string $billingTelephone |
|
342
|
|
|
*/ |
|
343
|
|
|
public function setBillingTelephone($billingTelephone) |
|
344
|
|
|
{ |
|
345
|
|
|
$this->billingTelephone = $billingTelephone; |
|
346
|
|
|
} |
|
347
|
|
|
|
|
348
|
|
|
/** |
|
349
|
|
|
* @return string |
|
350
|
|
|
*/ |
|
351
|
|
|
public function getBillingFax() |
|
352
|
|
|
{ |
|
353
|
|
|
return $this->billingFax; |
|
354
|
|
|
} |
|
355
|
|
|
|
|
356
|
|
|
/** |
|
357
|
|
|
* @param string $billingFax |
|
358
|
|
|
*/ |
|
359
|
|
|
public function setBillingFax($billingFax) |
|
360
|
|
|
{ |
|
361
|
|
|
$this->billingFax = $billingFax; |
|
362
|
|
|
} |
|
363
|
|
|
|
|
364
|
|
|
/** |
|
365
|
|
|
* @return string |
|
366
|
|
|
*/ |
|
367
|
|
|
public function getShippingFirstName() |
|
368
|
|
|
{ |
|
369
|
|
|
return $this->shippingFirstName; |
|
370
|
|
|
} |
|
371
|
|
|
|
|
372
|
|
|
/** |
|
373
|
|
|
* @param string $shippingFirstName |
|
374
|
|
|
*/ |
|
375
|
|
|
public function setShippingFirstName($shippingFirstName) |
|
376
|
|
|
{ |
|
377
|
|
|
$this->shippingFirstName = $shippingFirstName; |
|
378
|
|
|
} |
|
379
|
|
|
|
|
380
|
|
|
/** |
|
381
|
|
|
* @return string |
|
382
|
|
|
*/ |
|
383
|
|
|
public function getShippingLastName() |
|
384
|
|
|
{ |
|
385
|
|
|
return $this->shippingLastName; |
|
386
|
|
|
} |
|
387
|
|
|
|
|
388
|
|
|
/** |
|
389
|
|
|
* @param string $shippingLastName |
|
390
|
|
|
*/ |
|
391
|
|
|
public function setShippingLastName($shippingLastName) |
|
392
|
|
|
{ |
|
393
|
|
|
$this->shippingLastName = $shippingLastName; |
|
394
|
|
|
} |
|
395
|
|
|
|
|
396
|
|
|
/** |
|
397
|
|
|
* @return string |
|
398
|
|
|
*/ |
|
399
|
|
|
public function getShippingCompany() |
|
400
|
|
|
{ |
|
401
|
|
|
return $this->shippingCompany; |
|
402
|
|
|
} |
|
403
|
|
|
|
|
404
|
|
|
/** |
|
405
|
|
|
* @param string $shippingCompany |
|
406
|
|
|
*/ |
|
407
|
|
|
public function setShippingCompany($shippingCompany) |
|
408
|
|
|
{ |
|
409
|
|
|
$this->shippingCompany = $shippingCompany; |
|
410
|
|
|
} |
|
411
|
|
|
|
|
412
|
|
|
|
|
413
|
|
|
/** |
|
414
|
|
|
* @return string |
|
415
|
|
|
*/ |
|
416
|
|
|
public function getShippingAddress() |
|
417
|
|
|
{ |
|
418
|
|
|
return $this->shippingAddress; |
|
419
|
|
|
} |
|
420
|
|
|
|
|
421
|
|
|
/** |
|
422
|
|
|
* @param string $shippingAddress |
|
423
|
|
|
*/ |
|
424
|
|
|
public function setShippingAddress($shippingAddress) |
|
425
|
|
|
{ |
|
426
|
|
|
$this->shippingAddress = $shippingAddress; |
|
427
|
|
|
} |
|
428
|
|
|
|
|
429
|
|
|
/** |
|
430
|
|
|
* @return string |
|
431
|
|
|
*/ |
|
432
|
|
|
public function getShippingAddress2() |
|
433
|
|
|
{ |
|
434
|
|
|
return $this->shippingAddress2; |
|
435
|
|
|
} |
|
436
|
|
|
|
|
437
|
|
|
/** |
|
438
|
|
|
* @param string $shippingAddress2 |
|
439
|
|
|
*/ |
|
440
|
|
|
public function setShippingAddress2($shippingAddress2) |
|
441
|
|
|
{ |
|
442
|
|
|
$this->shippingAddress2 = $shippingAddress2; |
|
443
|
|
|
} |
|
444
|
|
|
|
|
445
|
|
|
/** |
|
446
|
|
|
* @return string |
|
447
|
|
|
*/ |
|
448
|
|
|
public function getShippingCity() |
|
449
|
|
|
{ |
|
450
|
|
|
return $this->shippingCity; |
|
451
|
|
|
} |
|
452
|
|
|
|
|
453
|
|
|
/** |
|
454
|
|
|
* @param string $shippingCity |
|
455
|
|
|
*/ |
|
456
|
|
|
public function setShippingCity($shippingCity) |
|
457
|
|
|
{ |
|
458
|
|
|
$this->shippingCity = $shippingCity; |
|
459
|
|
|
} |
|
460
|
|
|
|
|
461
|
|
|
/** |
|
462
|
|
|
* @return string |
|
463
|
|
|
*/ |
|
464
|
|
|
public function getShippingRegionId() |
|
465
|
|
|
{ |
|
466
|
|
|
return $this->shippingRegionId; |
|
467
|
|
|
} |
|
468
|
|
|
|
|
469
|
|
|
/** |
|
470
|
|
|
* @param string $shippingRegionId |
|
471
|
|
|
*/ |
|
472
|
|
|
public function setShippingRegionId($shippingRegionId) |
|
473
|
|
|
{ |
|
474
|
|
|
$this->shippingRegionId = $shippingRegionId; |
|
475
|
|
|
} |
|
476
|
|
|
|
|
477
|
|
|
/** |
|
478
|
|
|
* @return string |
|
479
|
|
|
*/ |
|
480
|
|
|
public function getShippingPostCode() |
|
481
|
|
|
{ |
|
482
|
|
|
return $this->shippingPostCode; |
|
483
|
|
|
} |
|
484
|
|
|
|
|
485
|
|
|
/** |
|
486
|
|
|
* @param string $shippingPostCode |
|
487
|
|
|
*/ |
|
488
|
|
|
public function setShippingPostCode($shippingPostCode) |
|
489
|
|
|
{ |
|
490
|
|
|
$this->shippingPostCode = $shippingPostCode; |
|
491
|
|
|
} |
|
492
|
|
|
|
|
493
|
|
|
/** |
|
494
|
|
|
* @return string |
|
495
|
|
|
*/ |
|
496
|
|
|
public function getShippingCountryId() |
|
497
|
|
|
{ |
|
498
|
|
|
return $this->shippingCountryId; |
|
499
|
|
|
} |
|
500
|
|
|
|
|
501
|
|
|
/** |
|
502
|
|
|
* @param string $shippingCountryId |
|
503
|
|
|
*/ |
|
504
|
|
|
public function setShippingCountryId($shippingCountryId) |
|
505
|
|
|
{ |
|
506
|
|
|
$this->shippingCountryId = $shippingCountryId; |
|
507
|
|
|
} |
|
508
|
|
|
|
|
509
|
|
|
/** |
|
510
|
|
|
* @return string |
|
511
|
|
|
*/ |
|
512
|
|
|
public function getShippingTelephone() |
|
513
|
|
|
{ |
|
514
|
|
|
return $this->shippingTelephone; |
|
515
|
|
|
} |
|
516
|
|
|
|
|
517
|
|
|
/** |
|
518
|
|
|
* @param string $shippingTelephone |
|
519
|
|
|
*/ |
|
520
|
|
|
public function setShippingTelephone($shippingTelephone) |
|
521
|
|
|
{ |
|
522
|
|
|
$this->shippingTelephone = $shippingTelephone; |
|
523
|
|
|
} |
|
524
|
|
|
|
|
525
|
|
|
/** |
|
526
|
|
|
* @return string |
|
527
|
|
|
*/ |
|
528
|
|
|
public function getShippingFax() |
|
529
|
|
|
{ |
|
530
|
|
|
return $this->shippingFax; |
|
531
|
|
|
} |
|
532
|
|
|
|
|
533
|
|
|
/** |
|
534
|
|
|
* @param string $shippingFax |
|
535
|
|
|
*/ |
|
536
|
|
|
public function setShippingFax($shippingFax) |
|
537
|
|
|
{ |
|
538
|
|
|
$this->shippingFax = $shippingFax; |
|
539
|
|
|
} |
|
540
|
|
|
|
|
541
|
|
|
|
|
542
|
|
|
|
|
543
|
|
|
} |