commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
CustomerDraftModel.php
1<?php
2
3declare(strict_types=1);
10
23use DateTimeImmutable;
24use stdClass;
25
29final class CustomerDraftModel extends JsonObjectModel implements CustomerDraft
30{
35 protected $key;
36
41 protected $customerNumber;
42
47 protected $externalId;
48
53 protected $email;
54
59 protected $password;
60
65 protected $firstName;
66
71 protected $lastName;
72
77 protected $middleName;
78
83 protected $title;
84
90
95 protected $anonymousCart;
96
101 protected $anonymousId;
102
107 protected $dateOfBirth;
108
113 protected $companyName;
114
119 protected $vatId;
120
125 protected $addresses;
126
132
138
144
150
156
161 protected $customerGroup;
162
167 protected $custom;
168
173 protected $locale;
174
179 protected $salutation;
180
185 protected $stores;
186
192
193
197 public function __construct(
198 ?string $key = null,
199 ?string $customerNumber = null,
200 ?string $externalId = null,
201 ?string $email = null,
202 ?string $password = null,
203 ?string $firstName = null,
204 ?string $lastName = null,
205 ?string $middleName = null,
206 ?string $title = null,
207 ?string $anonymousCartId = null,
209 ?string $anonymousId = null,
210 ?DateTimeImmutable $dateOfBirth = null,
211 ?string $companyName = null,
212 ?string $vatId = null,
214 ?int $defaultShippingAddress = null,
215 ?array $shippingAddresses = null,
216 ?int $defaultBillingAddress = null,
217 ?array $billingAddresses = null,
218 ?bool $isEmailVerified = null,
221 ?string $locale = null,
222 ?string $salutation = null,
224 ?string $authenticationMode = null
225 ) {
226 $this->key = $key;
227 $this->customerNumber = $customerNumber;
228 $this->externalId = $externalId;
229 $this->email = $email;
230 $this->password = $password;
231 $this->firstName = $firstName;
232 $this->lastName = $lastName;
233 $this->middleName = $middleName;
234 $this->title = $title;
235 $this->anonymousCartId = $anonymousCartId;
236 $this->anonymousCart = $anonymousCart;
237 $this->anonymousId = $anonymousId;
238 $this->dateOfBirth = $dateOfBirth;
239 $this->companyName = $companyName;
240 $this->vatId = $vatId;
241 $this->addresses = $addresses;
242 $this->defaultShippingAddress = $defaultShippingAddress;
243 $this->shippingAddresses = $shippingAddresses;
244 $this->defaultBillingAddress = $defaultBillingAddress;
245 $this->billingAddresses = $billingAddresses;
246 $this->isEmailVerified = $isEmailVerified;
247 $this->customerGroup = $customerGroup;
248 $this->custom = $custom;
249 $this->locale = $locale;
250 $this->salutation = $salutation;
251 $this->stores = $stores;
252 $this->authenticationMode = $authenticationMode;
253 }
254
263 public function getKey()
264 {
265 if (is_null($this->key)) {
267 $data = $this->raw(self::FIELD_KEY);
268 if (is_null($data)) {
269 return null;
270 }
271 $this->key = (string) $data;
272 }
273
274 return $this->key;
275 }
276
285 public function getCustomerNumber()
286 {
287 if (is_null($this->customerNumber)) {
289 $data = $this->raw(self::FIELD_CUSTOMER_NUMBER);
290 if (is_null($data)) {
291 return null;
292 }
293 $this->customerNumber = (string) $data;
294 }
295
297 }
298
305 public function getExternalId()
306 {
307 if (is_null($this->externalId)) {
309 $data = $this->raw(self::FIELD_EXTERNAL_ID);
310 if (is_null($data)) {
311 return null;
312 }
313 $this->externalId = (string) $data;
314 }
315
316 return $this->externalId;
317 }
318
326 public function getEmail()
327 {
328 if (is_null($this->email)) {
330 $data = $this->raw(self::FIELD_EMAIL);
331 if (is_null($data)) {
332 return null;
333 }
334 $this->email = (string) $data;
335 }
336
337 return $this->email;
338 }
339
347 public function getPassword()
348 {
349 if (is_null($this->password)) {
351 $data = $this->raw(self::FIELD_PASSWORD);
352 if (is_null($data)) {
353 return null;
354 }
355 $this->password = (string) $data;
356 }
357
358 return $this->password;
359 }
360
367 public function getFirstName()
368 {
369 if (is_null($this->firstName)) {
371 $data = $this->raw(self::FIELD_FIRST_NAME);
372 if (is_null($data)) {
373 return null;
374 }
375 $this->firstName = (string) $data;
376 }
377
378 return $this->firstName;
379 }
380
387 public function getLastName()
388 {
389 if (is_null($this->lastName)) {
391 $data = $this->raw(self::FIELD_LAST_NAME);
392 if (is_null($data)) {
393 return null;
394 }
395 $this->lastName = (string) $data;
396 }
397
398 return $this->lastName;
399 }
400
407 public function getMiddleName()
408 {
409 if (is_null($this->middleName)) {
411 $data = $this->raw(self::FIELD_MIDDLE_NAME);
412 if (is_null($data)) {
413 return null;
414 }
415 $this->middleName = (string) $data;
416 }
417
418 return $this->middleName;
419 }
420
427 public function getTitle()
428 {
429 if (is_null($this->title)) {
431 $data = $this->raw(self::FIELD_TITLE);
432 if (is_null($data)) {
433 return null;
434 }
435 $this->title = (string) $data;
436 }
437
438 return $this->title;
439 }
440
447 public function getAnonymousCartId()
448 {
449 if (is_null($this->anonymousCartId)) {
451 $data = $this->raw(self::FIELD_ANONYMOUS_CART_ID);
452 if (is_null($data)) {
453 return null;
454 }
455 $this->anonymousCartId = (string) $data;
456 }
457
459 }
460
467 public function getAnonymousCart()
468 {
469 if (is_null($this->anonymousCart)) {
471 $data = $this->raw(self::FIELD_ANONYMOUS_CART);
472 if (is_null($data)) {
473 return null;
474 }
475
476 $this->anonymousCart = CartResourceIdentifierModel::of($data);
477 }
478
480 }
481
488 public function getAnonymousId()
489 {
490 if (is_null($this->anonymousId)) {
492 $data = $this->raw(self::FIELD_ANONYMOUS_ID);
493 if (is_null($data)) {
494 return null;
495 }
496 $this->anonymousId = (string) $data;
497 }
498
499 return $this->anonymousId;
500 }
501
508 public function getDateOfBirth()
509 {
510 if (is_null($this->dateOfBirth)) {
512 $data = $this->raw(self::FIELD_DATE_OF_BIRTH);
513 if (is_null($data)) {
514 return null;
515 }
516 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATE_FORMAT, $data);
517 if (false === $data) {
518 return null;
519 }
520 $this->dateOfBirth = $data;
521 }
522
523 return $this->dateOfBirth;
524 }
525
532 public function getCompanyName()
533 {
534 if (is_null($this->companyName)) {
536 $data = $this->raw(self::FIELD_COMPANY_NAME);
537 if (is_null($data)) {
538 return null;
539 }
540 $this->companyName = (string) $data;
541 }
542
543 return $this->companyName;
544 }
545
552 public function getVatId()
553 {
554 if (is_null($this->vatId)) {
556 $data = $this->raw(self::FIELD_VAT_ID);
557 if (is_null($data)) {
558 return null;
559 }
560 $this->vatId = (string) $data;
561 }
562
563 return $this->vatId;
564 }
565
572 public function getAddresses()
573 {
574 if (is_null($this->addresses)) {
576 $data = $this->raw(self::FIELD_ADDRESSES);
577 if (is_null($data)) {
578 return null;
579 }
580 $this->addresses = BaseAddressCollection::fromArray($data);
581 }
582
583 return $this->addresses;
584 }
585
594 {
595 if (is_null($this->defaultShippingAddress)) {
597 $data = $this->raw(self::FIELD_DEFAULT_SHIPPING_ADDRESS);
598 if (is_null($data)) {
599 return null;
600 }
601 $this->defaultShippingAddress = (int) $data;
602 }
603
605 }
606
614 public function getShippingAddresses()
615 {
616 if (is_null($this->shippingAddresses)) {
618 $data = $this->raw(self::FIELD_SHIPPING_ADDRESSES);
619 if (is_null($data)) {
620 return null;
621 }
622 $this->shippingAddresses = $data;
623 }
624
626 }
627
635 public function getDefaultBillingAddress()
636 {
637 if (is_null($this->defaultBillingAddress)) {
639 $data = $this->raw(self::FIELD_DEFAULT_BILLING_ADDRESS);
640 if (is_null($data)) {
641 return null;
642 }
643 $this->defaultBillingAddress = (int) $data;
644 }
645
647 }
648
656 public function getBillingAddresses()
657 {
658 if (is_null($this->billingAddresses)) {
660 $data = $this->raw(self::FIELD_BILLING_ADDRESSES);
661 if (is_null($data)) {
662 return null;
663 }
664 $this->billingAddresses = $data;
665 }
666
668 }
669
677 public function getIsEmailVerified()
678 {
679 if (is_null($this->isEmailVerified)) {
681 $data = $this->raw(self::FIELD_IS_EMAIL_VERIFIED);
682 if (is_null($data)) {
683 return null;
684 }
685 $this->isEmailVerified = (bool) $data;
686 }
687
689 }
690
697 public function getCustomerGroup()
698 {
699 if (is_null($this->customerGroup)) {
701 $data = $this->raw(self::FIELD_CUSTOMER_GROUP);
702 if (is_null($data)) {
703 return null;
704 }
705
706 $this->customerGroup = CustomerGroupResourceIdentifierModel::of($data);
707 }
708
710 }
711
718 public function getCustom()
719 {
720 if (is_null($this->custom)) {
722 $data = $this->raw(self::FIELD_CUSTOM);
723 if (is_null($data)) {
724 return null;
725 }
726
727 $this->custom = CustomFieldsDraftModel::of($data);
728 }
729
730 return $this->custom;
731 }
732
740 public function getLocale()
741 {
742 if (is_null($this->locale)) {
744 $data = $this->raw(self::FIELD_LOCALE);
745 if (is_null($data)) {
746 return null;
747 }
748 $this->locale = (string) $data;
749 }
750
751 return $this->locale;
752 }
753
760 public function getSalutation()
761 {
762 if (is_null($this->salutation)) {
764 $data = $this->raw(self::FIELD_SALUTATION);
765 if (is_null($data)) {
766 return null;
767 }
768 $this->salutation = (string) $data;
769 }
770
771 return $this->salutation;
772 }
773
784 public function getStores()
785 {
786 if (is_null($this->stores)) {
788 $data = $this->raw(self::FIELD_STORES);
789 if (is_null($data)) {
790 return null;
791 }
792 $this->stores = StoreResourceIdentifierCollection::fromArray($data);
793 }
794
795 return $this->stores;
796 }
797
807 public function getAuthenticationMode()
808 {
809 if (is_null($this->authenticationMode)) {
811 $data = $this->raw(self::FIELD_AUTHENTICATION_MODE);
812 if (is_null($data)) {
813 return null;
814 }
815 $this->authenticationMode = (string) $data;
816 }
817
819 }
820
821
825 public function setKey(?string $key): void
826 {
827 $this->key = $key;
828 }
829
833 public function setCustomerNumber(?string $customerNumber): void
834 {
835 $this->customerNumber = $customerNumber;
836 }
837
841 public function setExternalId(?string $externalId): void
842 {
843 $this->externalId = $externalId;
844 }
845
849 public function setEmail(?string $email): void
850 {
851 $this->email = $email;
852 }
853
857 public function setPassword(?string $password): void
858 {
859 $this->password = $password;
860 }
861
865 public function setFirstName(?string $firstName): void
866 {
867 $this->firstName = $firstName;
868 }
869
873 public function setLastName(?string $lastName): void
874 {
875 $this->lastName = $lastName;
876 }
877
881 public function setMiddleName(?string $middleName): void
882 {
883 $this->middleName = $middleName;
884 }
885
889 public function setTitle(?string $title): void
890 {
891 $this->title = $title;
892 }
893
897 public function setAnonymousCartId(?string $anonymousCartId): void
898 {
899 $this->anonymousCartId = $anonymousCartId;
900 }
901
906 {
907 $this->anonymousCart = $anonymousCart;
908 }
909
913 public function setAnonymousId(?string $anonymousId): void
914 {
915 $this->anonymousId = $anonymousId;
916 }
917
921 public function setDateOfBirth(?DateTimeImmutable $dateOfBirth): void
922 {
923 $this->dateOfBirth = $dateOfBirth;
924 }
925
929 public function setCompanyName(?string $companyName): void
930 {
931 $this->companyName = $companyName;
932 }
933
937 public function setVatId(?string $vatId): void
938 {
939 $this->vatId = $vatId;
940 }
941
946 {
947 $this->addresses = $addresses;
948 }
949
954 {
955 $this->defaultShippingAddress = $defaultShippingAddress;
956 }
957
961 public function setShippingAddresses(?array $shippingAddresses): void
962 {
963 $this->shippingAddresses = $shippingAddresses;
964 }
965
970 {
971 $this->defaultBillingAddress = $defaultBillingAddress;
972 }
973
977 public function setBillingAddresses(?array $billingAddresses): void
978 {
979 $this->billingAddresses = $billingAddresses;
980 }
981
985 public function setIsEmailVerified(?bool $isEmailVerified): void
986 {
987 $this->isEmailVerified = $isEmailVerified;
988 }
989
994 {
995 $this->customerGroup = $customerGroup;
996 }
997
1001 public function setCustom(?CustomFieldsDraft $custom): void
1002 {
1003 $this->custom = $custom;
1004 }
1005
1009 public function setLocale(?string $locale): void
1010 {
1011 $this->locale = $locale;
1012 }
1013
1017 public function setSalutation(?string $salutation): void
1018 {
1019 $this->salutation = $salutation;
1020 }
1021
1026 {
1027 $this->stores = $stores;
1028 }
1029
1033 public function setAuthenticationMode(?string $authenticationMode): void
1034 {
1035 $this->authenticationMode = $authenticationMode;
1036 }
1037
1038
1039 #[\ReturnTypeWillChange]
1040 public function jsonSerialize()
1041 {
1042 $data = $this->toArray();
1043 if (isset($data[CustomerDraft::FIELD_DATE_OF_BIRTH]) && $data[CustomerDraft::FIELD_DATE_OF_BIRTH] instanceof \DateTimeImmutable) {
1045 }
1046 return (object) $data;
1047 }
1048}
setCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup)
__construct(?string $key=null, ?string $customerNumber=null, ?string $externalId=null, ?string $email=null, ?string $password=null, ?string $firstName=null, ?string $lastName=null, ?string $middleName=null, ?string $title=null, ?string $anonymousCartId=null, ?CartResourceIdentifier $anonymousCart=null, ?string $anonymousId=null, ?DateTimeImmutable $dateOfBirth=null, ?string $companyName=null, ?string $vatId=null, ?BaseAddressCollection $addresses=null, ?int $defaultShippingAddress=null, ?array $shippingAddresses=null, ?int $defaultBillingAddress=null, ?array $billingAddresses=null, ?bool $isEmailVerified=null, ?CustomerGroupResourceIdentifier $customerGroup=null, ?CustomFieldsDraft $custom=null, ?string $locale=null, ?string $salutation=null, ?StoreResourceIdentifierCollection $stores=null, ?string $authenticationMode=null)
setAnonymousCart(?CartResourceIdentifier $anonymousCart)
setStores(?StoreResourceIdentifierCollection $stores)