src/Module/Checkout/Model/AnonymousCustomer.php line 17

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Module\Checkout\Model;
  4. use Commercetools\Core\Model\Common\Address;
  5. use Denios\Data\Sap\BusinessPartner;
  6. use Denios\SharedConstant\CustomerGroup\GroupKey;
  7. /**
  8. * Class AnonymousCustomer
  9. *
  10. * @author André Varelmann <andre.varelmann@bestit-online.de>
  11. * @package App\Module\Checkout\Model
  12. */
  13. class AnonymousCustomer implements DeniosCustomerInterface
  14. {
  15. private string $anonymousId;
  16. private string $currency;
  17. private ?Address $billingAddress;
  18. private ?Address $shippingAddress;
  19. private ?string $customerGroup;
  20. private ?string $email;
  21. private ?string $salutation;
  22. private ?string $firstName;
  23. private ?string $lastName;
  24. private ?string $vatId;
  25. /**
  26. * AnonymousCustomer constructor.
  27. *
  28. * @param string $anonymousId
  29. * @param string $currency
  30. * @param Address|null $billingAddress
  31. * @param Address|null $shippingAddress
  32. * @param string|null $customerGroup
  33. * @param string|null $email
  34. * @param string|null $salutation
  35. * @param string|null $firstName
  36. * @param string|null $lastName
  37. * @param string|null $vatId
  38. */
  39. public function __construct(
  40. string $anonymousId,
  41. string $currency,
  42. ?Address $billingAddress,
  43. ?Address $shippingAddress,
  44. ?string $customerGroup,
  45. ?string $email,
  46. ?string $salutation,
  47. ?string $firstName,
  48. ?string $lastName,
  49. ?string $vatId
  50. ) {
  51. $this->anonymousId = $anonymousId;
  52. $this->currency = $currency;
  53. $this->billingAddress = $billingAddress;
  54. $this->shippingAddress = $shippingAddress;
  55. $this->customerGroup = $customerGroup;
  56. $this->email = $email;
  57. $this->salutation = $salutation;
  58. $this->firstName = $firstName;
  59. $this->lastName = $lastName;
  60. $this->vatId = $vatId;
  61. }
  62. /**
  63. * @return string
  64. */
  65. public function getId(): string
  66. {
  67. return $this->anonymousId;
  68. }
  69. /**
  70. * @return Address|null
  71. */
  72. public function getDefaultBillingAddress(): ?Address
  73. {
  74. return $this->billingAddress;
  75. }
  76. /**
  77. * @return Address|null
  78. */
  79. public function getDefaultShippingAddress(): ?Address
  80. {
  81. return $this->shippingAddress;
  82. }
  83. /**
  84. * @return array
  85. */
  86. public function getShippingAddresses(): array
  87. {
  88. return $this->shippingAddress !== null ? [$this->shippingAddress] : [];
  89. }
  90. /**
  91. * @return array
  92. */
  93. public function getBillingAddresses(): array
  94. {
  95. return $this->billingAddress !== null ? [$this->billingAddress] : [];
  96. }
  97. /**
  98. * @return string
  99. */
  100. public function getCurrency(): string
  101. {
  102. return $this->currency;
  103. }
  104. /**
  105. * @return string|null
  106. */
  107. public function getCustomerGroup(): ?string
  108. {
  109. return $this->customerGroup;
  110. }
  111. /**
  112. * @return string|null
  113. */
  114. public function getEmail(): ?string
  115. {
  116. return $this->email;
  117. }
  118. /**
  119. * @return string|null
  120. */
  121. public function getSalutation(): ?string
  122. {
  123. return $this->salutation;
  124. }
  125. /**
  126. * @return string|null
  127. */
  128. public function getFirstName(): ?string
  129. {
  130. return $this->firstName;
  131. }
  132. /**
  133. * @return string|null
  134. */
  135. public function getLastName(): ?string
  136. {
  137. return $this->lastName;
  138. }
  139. /**
  140. * @return string|null
  141. */
  142. public function getVatId(): ?string
  143. {
  144. return $this->vatId;
  145. }
  146. /**
  147. * @return string|null
  148. */
  149. public function getCompanyNumber(): ?string
  150. {
  151. return null;
  152. }
  153. /**
  154. * @return BusinessPartner|null
  155. */
  156. public function getBusinessPartner(): ?BusinessPartner
  157. {
  158. return null;
  159. }
  160. /**
  161. * @return string|null
  162. */
  163. public function getPreferredPaymentType(): ?string
  164. {
  165. return null;
  166. }
  167. }