commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
CustomerImportModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
22 use DateTimeImmutable;
23 use stdClass;
24 
28 final class CustomerImportModel extends JsonObjectModel implements CustomerImport
29 {
34  protected $key;
35 
40  protected $customerNumber;
41 
46  protected $email;
47 
52  protected $password;
53 
58  protected $stores;
59 
64  protected $firstName;
65 
70  protected $lastName;
71 
76  protected $middleName;
77 
82  protected $title;
83 
88  protected $salutation;
89 
94  protected $externalId;
95 
100  protected $dateOfBirth;
101 
106  protected $companyName;
107 
112  protected $vatId;
113 
118  protected $isEmailVerified;
119 
124  protected $customerGroup;
125 
130  protected $addresses;
131 
137 
142  protected $billingAddresses;
143 
149 
155 
160  protected $locale;
161 
166  protected $custom;
167 
173 
174 
178  public function __construct(
179  ?string $key = null,
180  ?string $customerNumber = null,
181  ?string $email = null,
182  ?string $password = null,
184  ?string $firstName = null,
185  ?string $lastName = null,
186  ?string $middleName = null,
187  ?string $title = null,
188  ?string $salutation = null,
189  ?string $externalId = null,
190  ?DateTimeImmutable $dateOfBirth = null,
191  ?string $companyName = null,
192  ?string $vatId = null,
193  ?bool $isEmailVerified = null,
196  ?int $defaultBillingAddress = null,
197  ?array $billingAddresses = null,
198  ?int $defaultShippingAddress = null,
199  ?array $shippingAddresses = null,
200  ?string $locale = null,
201  ?Custom $custom = null,
202  ?string $authenticationMode = null
203  ) {
204  $this->key = $key;
205  $this->customerNumber = $customerNumber;
206  $this->email = $email;
207  $this->password = $password;
208  $this->stores = $stores;
209  $this->firstName = $firstName;
210  $this->lastName = $lastName;
211  $this->middleName = $middleName;
212  $this->title = $title;
213  $this->salutation = $salutation;
214  $this->externalId = $externalId;
215  $this->dateOfBirth = $dateOfBirth;
216  $this->companyName = $companyName;
217  $this->vatId = $vatId;
218  $this->isEmailVerified = $isEmailVerified;
219  $this->customerGroup = $customerGroup;
220  $this->addresses = $addresses;
221  $this->defaultBillingAddress = $defaultBillingAddress;
222  $this->billingAddresses = $billingAddresses;
223  $this->defaultShippingAddress = $defaultShippingAddress;
224  $this->shippingAddresses = $shippingAddresses;
225  $this->locale = $locale;
226  $this->custom = $custom;
227  $this->authenticationMode = $authenticationMode;
228  }
229 
236  public function getKey()
237  {
238  if (is_null($this->key)) {
240  $data = $this->raw(self::FIELD_KEY);
241  if (is_null($data)) {
242  return null;
243  }
244  $this->key = (string) $data;
245  }
246 
247  return $this->key;
248  }
249 
256  public function getCustomerNumber()
257  {
258  if (is_null($this->customerNumber)) {
260  $data = $this->raw(self::FIELD_CUSTOMER_NUMBER);
261  if (is_null($data)) {
262  return null;
263  }
264  $this->customerNumber = (string) $data;
265  }
266 
267  return $this->customerNumber;
268  }
269 
276  public function getEmail()
277  {
278  if (is_null($this->email)) {
280  $data = $this->raw(self::FIELD_EMAIL);
281  if (is_null($data)) {
282  return null;
283  }
284  $this->email = (string) $data;
285  }
286 
287  return $this->email;
288  }
289 
296  public function getPassword()
297  {
298  if (is_null($this->password)) {
300  $data = $this->raw(self::FIELD_PASSWORD);
301  if (is_null($data)) {
302  return null;
303  }
304  $this->password = (string) $data;
305  }
306 
307  return $this->password;
308  }
309 
316  public function getStores()
317  {
318  if (is_null($this->stores)) {
320  $data = $this->raw(self::FIELD_STORES);
321  if (is_null($data)) {
322  return null;
323  }
324  $this->stores = StoreKeyReferenceCollection::fromArray($data);
325  }
326 
327  return $this->stores;
328  }
329 
336  public function getFirstName()
337  {
338  if (is_null($this->firstName)) {
340  $data = $this->raw(self::FIELD_FIRST_NAME);
341  if (is_null($data)) {
342  return null;
343  }
344  $this->firstName = (string) $data;
345  }
346 
347  return $this->firstName;
348  }
349 
356  public function getLastName()
357  {
358  if (is_null($this->lastName)) {
360  $data = $this->raw(self::FIELD_LAST_NAME);
361  if (is_null($data)) {
362  return null;
363  }
364  $this->lastName = (string) $data;
365  }
366 
367  return $this->lastName;
368  }
369 
376  public function getMiddleName()
377  {
378  if (is_null($this->middleName)) {
380  $data = $this->raw(self::FIELD_MIDDLE_NAME);
381  if (is_null($data)) {
382  return null;
383  }
384  $this->middleName = (string) $data;
385  }
386 
387  return $this->middleName;
388  }
389 
396  public function getTitle()
397  {
398  if (is_null($this->title)) {
400  $data = $this->raw(self::FIELD_TITLE);
401  if (is_null($data)) {
402  return null;
403  }
404  $this->title = (string) $data;
405  }
406 
407  return $this->title;
408  }
409 
416  public function getSalutation()
417  {
418  if (is_null($this->salutation)) {
420  $data = $this->raw(self::FIELD_SALUTATION);
421  if (is_null($data)) {
422  return null;
423  }
424  $this->salutation = (string) $data;
425  }
426 
427  return $this->salutation;
428  }
429 
436  public function getExternalId()
437  {
438  if (is_null($this->externalId)) {
440  $data = $this->raw(self::FIELD_EXTERNAL_ID);
441  if (is_null($data)) {
442  return null;
443  }
444  $this->externalId = (string) $data;
445  }
446 
447  return $this->externalId;
448  }
449 
456  public function getDateOfBirth()
457  {
458  if (is_null($this->dateOfBirth)) {
460  $data = $this->raw(self::FIELD_DATE_OF_BIRTH);
461  if (is_null($data)) {
462  return null;
463  }
464  $data = DateTimeImmutable::createFromFormat(MapperFactory::DATE_FORMAT, $data);
465  if (false === $data) {
466  return null;
467  }
468  $this->dateOfBirth = $data;
469  }
470 
471  return $this->dateOfBirth;
472  }
473 
480  public function getCompanyName()
481  {
482  if (is_null($this->companyName)) {
484  $data = $this->raw(self::FIELD_COMPANY_NAME);
485  if (is_null($data)) {
486  return null;
487  }
488  $this->companyName = (string) $data;
489  }
490 
491  return $this->companyName;
492  }
493 
500  public function getVatId()
501  {
502  if (is_null($this->vatId)) {
504  $data = $this->raw(self::FIELD_VAT_ID);
505  if (is_null($data)) {
506  return null;
507  }
508  $this->vatId = (string) $data;
509  }
510 
511  return $this->vatId;
512  }
513 
520  public function getIsEmailVerified()
521  {
522  if (is_null($this->isEmailVerified)) {
524  $data = $this->raw(self::FIELD_IS_EMAIL_VERIFIED);
525  if (is_null($data)) {
526  return null;
527  }
528  $this->isEmailVerified = (bool) $data;
529  }
530 
531  return $this->isEmailVerified;
532  }
533 
541  public function getCustomerGroup()
542  {
543  if (is_null($this->customerGroup)) {
545  $data = $this->raw(self::FIELD_CUSTOMER_GROUP);
546  if (is_null($data)) {
547  return null;
548  }
549 
550  $this->customerGroup = CustomerGroupKeyReferenceModel::of($data);
551  }
552 
553  return $this->customerGroup;
554  }
555 
562  public function getAddresses()
563  {
564  if (is_null($this->addresses)) {
566  $data = $this->raw(self::FIELD_ADDRESSES);
567  if (is_null($data)) {
568  return null;
569  }
570  $this->addresses = CustomerAddressCollection::fromArray($data);
571  }
572 
573  return $this->addresses;
574  }
575 
582  public function getDefaultBillingAddress()
583  {
584  if (is_null($this->defaultBillingAddress)) {
586  $data = $this->raw(self::FIELD_DEFAULT_BILLING_ADDRESS);
587  if (is_null($data)) {
588  return null;
589  }
590  $this->defaultBillingAddress = (int) $data;
591  }
592 
594  }
595 
602  public function getBillingAddresses()
603  {
604  if (is_null($this->billingAddresses)) {
606  $data = $this->raw(self::FIELD_BILLING_ADDRESSES);
607  if (is_null($data)) {
608  return null;
609  }
610  $this->billingAddresses = $data;
611  }
612 
614  }
615 
622  public function getDefaultShippingAddress()
623  {
624  if (is_null($this->defaultShippingAddress)) {
626  $data = $this->raw(self::FIELD_DEFAULT_SHIPPING_ADDRESS);
627  if (is_null($data)) {
628  return null;
629  }
630  $this->defaultShippingAddress = (int) $data;
631  }
632 
634  }
635 
642  public function getShippingAddresses()
643  {
644  if (is_null($this->shippingAddresses)) {
646  $data = $this->raw(self::FIELD_SHIPPING_ADDRESSES);
647  if (is_null($data)) {
648  return null;
649  }
650  $this->shippingAddresses = $data;
651  }
652 
654  }
655 
662  public function getLocale()
663  {
664  if (is_null($this->locale)) {
666  $data = $this->raw(self::FIELD_LOCALE);
667  if (is_null($data)) {
668  return null;
669  }
670  $this->locale = (string) $data;
671  }
672 
673  return $this->locale;
674  }
675 
682  public function getCustom()
683  {
684  if (is_null($this->custom)) {
686  $data = $this->raw(self::FIELD_CUSTOM);
687  if (is_null($data)) {
688  return null;
689  }
690 
691  $this->custom = CustomModel::of($data);
692  }
693 
694  return $this->custom;
695  }
696 
706  public function getAuthenticationMode()
707  {
708  if (is_null($this->authenticationMode)) {
710  $data = $this->raw(self::FIELD_AUTHENTICATION_MODE);
711  if (is_null($data)) {
712  return null;
713  }
714  $this->authenticationMode = (string) $data;
715  }
716 
718  }
719 
720 
724  public function setKey(?string $key): void
725  {
726  $this->key = $key;
727  }
728 
732  public function setCustomerNumber(?string $customerNumber): void
733  {
734  $this->customerNumber = $customerNumber;
735  }
736 
740  public function setEmail(?string $email): void
741  {
742  $this->email = $email;
743  }
744 
748  public function setPassword(?string $password): void
749  {
750  $this->password = $password;
751  }
752 
757  {
758  $this->stores = $stores;
759  }
760 
764  public function setFirstName(?string $firstName): void
765  {
766  $this->firstName = $firstName;
767  }
768 
772  public function setLastName(?string $lastName): void
773  {
774  $this->lastName = $lastName;
775  }
776 
780  public function setMiddleName(?string $middleName): void
781  {
782  $this->middleName = $middleName;
783  }
784 
788  public function setTitle(?string $title): void
789  {
790  $this->title = $title;
791  }
792 
796  public function setSalutation(?string $salutation): void
797  {
798  $this->salutation = $salutation;
799  }
800 
804  public function setExternalId(?string $externalId): void
805  {
806  $this->externalId = $externalId;
807  }
808 
812  public function setDateOfBirth(?DateTimeImmutable $dateOfBirth): void
813  {
814  $this->dateOfBirth = $dateOfBirth;
815  }
816 
820  public function setCompanyName(?string $companyName): void
821  {
822  $this->companyName = $companyName;
823  }
824 
828  public function setVatId(?string $vatId): void
829  {
830  $this->vatId = $vatId;
831  }
832 
836  public function setIsEmailVerified(?bool $isEmailVerified): void
837  {
838  $this->isEmailVerified = $isEmailVerified;
839  }
840 
845  {
846  $this->customerGroup = $customerGroup;
847  }
848 
853  {
854  $this->addresses = $addresses;
855  }
856 
861  {
862  $this->defaultBillingAddress = $defaultBillingAddress;
863  }
864 
868  public function setBillingAddresses(?array $billingAddresses): void
869  {
870  $this->billingAddresses = $billingAddresses;
871  }
872 
877  {
878  $this->defaultShippingAddress = $defaultShippingAddress;
879  }
880 
884  public function setShippingAddresses(?array $shippingAddresses): void
885  {
886  $this->shippingAddresses = $shippingAddresses;
887  }
888 
892  public function setLocale(?string $locale): void
893  {
894  $this->locale = $locale;
895  }
896 
900  public function setCustom(?Custom $custom): void
901  {
902  $this->custom = $custom;
903  }
904 
908  public function setAuthenticationMode(?string $authenticationMode): void
909  {
910  $this->authenticationMode = $authenticationMode;
911  }
912 
913 
914  #[\ReturnTypeWillChange]
915  public function jsonSerialize()
916  {
917  $data = $this->toArray();
918  if (isset($data[CustomerImport::FIELD_DATE_OF_BIRTH]) && $data[CustomerImport::FIELD_DATE_OF_BIRTH] instanceof \DateTimeImmutable) {
920  }
921  return (object) $data;
922  }
923 }
setCustomerGroup(?CustomerGroupKeyReference $customerGroup)
__construct(?string $key=null, ?string $customerNumber=null, ?string $email=null, ?string $password=null, ?StoreKeyReferenceCollection $stores=null, ?string $firstName=null, ?string $lastName=null, ?string $middleName=null, ?string $title=null, ?string $salutation=null, ?string $externalId=null, ?DateTimeImmutable $dateOfBirth=null, ?string $companyName=null, ?string $vatId=null, ?bool $isEmailVerified=null, ?CustomerGroupKeyReference $customerGroup=null, ?CustomerAddressCollection $addresses=null, ?int $defaultBillingAddress=null, ?array $billingAddresses=null, ?int $defaultShippingAddress=null, ?array $shippingAddresses=null, ?string $locale=null, ?Custom $custom=null, ?string $authenticationMode=null)