src/Entity/System/Customer.php line 35

Open in your IDE?
  1. <?php
  2. namespace App\Entity\System;
  3. use App\Factory\ControlPanel\Wishlist\WishListFactory;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  8. use Symfony\Component\Security\Core\User\UserInterface;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. /**
  11. * Customer
  12. *
  13. * @ORM\Entity(repositoryClass="App\Repository\System\CustomerRepository")
  14. *
  15. * @ORM\Table(name="ps_customer",
  16. * indexes={
  17. *
  18. * @ORM\Index(name="ps_customer_hubspot_contact_id_index", columns={"hubspot_contact_id"}),
  19. * @ORM\Index(name="date_add", columns={"date_add"}),
  20. * @ORM\Index(name="ps_customer_linkedin_account_id_index", columns={"linkedin_account_id"}),
  21. * @ORM\Index(name="customer_login", columns={"email", "passwd"}),
  22. * @ORM\Index(name="id_customer_passwd", columns={"id_customer", "passwd"}),
  23. * @ORM\Index(name="ps_customer_hubspot_company_id_index", columns={"hubspot_company_id"}),
  24. * @ORM\Index(name="active", columns={"active"}),
  25. * @ORM\Index(name="ps_customer_google_account_id_index", columns={"google_account_id"}),
  26. * @ORM\Index(name="customer_email", columns={"email"}),
  27. * @ORM\Index(name="stripe_reference", columns={"stripe_reference"}),
  28. * @ORM\Index(name="ps_customer_fraud_index", columns={"moroso"})
  29. * }
  30. * )
  31. */
  32. class Customer implements UserInterface, PasswordAuthenticatedUserInterface
  33. {
  34. public const DEFAULT_SYS_USER_ID = 1523;
  35. public const IDS_USERS_SYS = [self::DEFAULT_SYS_USER_ID, 131588, 131590, 245190];
  36. public const PARTIAL_CREATION_STEP_1_ID = 2;
  37. public const PARTIAL_CREATION_STEP_2_ID = 1;
  38. public const PARTIAL_CREATION_STEP_COMPLETE_ID = 0;
  39. public const WORKHUMAN_CUSTOMER_IDS = [232487, 235957, 235968, 235969, 235972, 235973, 235974, 235976, 235977, 235978, 235980, 235986, 235989, 235993, 235994, 235996, 277077, 425892, 425896, 454066, 454504, 454508, 454511, 454513, 454515, 635273, 669050];
  40. public const WORKHUMAN_PRICE_FACTOR = 1.01;
  41. public const PREFIX_DROP = 'baja_';
  42. public const NINE_CUSTOMER_ID = 132688;
  43. public const CUSTOMER_DISABLE_CONTROL_FLAG = '_baja';
  44. public const CUSTOMER_PERCENTAGE_COST_PRICES_INDEXED_BY_CUSTOMER_ID = [self::NINE_CUSTOMER_ID => 0.0];
  45. public const EQUIVALENCE_SURCHARGE_2_NAME = 'REC_EQ_2';
  46. public const EQUIVALENCE_SURCHARGE_2_VALUE = 0.0026;
  47. public const EQUIVALENCE_SURCHARGE_4_NAME = 'REC_EQ_4';
  48. public const EQUIVALENCE_SURCHARGE_4_VALUE = 0.005;
  49. public const EQUIVALENCE_SURCHARGE_5_NAME = 'REC_EQ_5';
  50. public const EQUIVALENCE_SURCHARGE_5_VALUE = 0.006;
  51. public const EQUIVALENCE_SURCHARGE_7_NAME = 'REC_EQ_7';
  52. public const EQUIVALENCE_SURCHARGE_7_VALUE = 0.01;
  53. public const EQUIVALENCE_SURCHARGE_10_NAME = 'REC_EQ_10';
  54. public const EQUIVALENCE_SURCHARGE_10_VALUE = 0.014;
  55. public const EQUIVALENCE_SURCHARGE_21_NAME = 'REC_EQ_21';
  56. public const EQUIVALENCE_SURCHARGE_21_VALUE = 0.052;
  57. public const EQUIVALENCE_SURCHARGE_PERCENTAGE_INDEXED_BY_NAME = [
  58. self::EQUIVALENCE_SURCHARGE_2_NAME => self::EQUIVALENCE_SURCHARGE_2_VALUE,
  59. self::EQUIVALENCE_SURCHARGE_4_NAME => self::EQUIVALENCE_SURCHARGE_4_VALUE,
  60. self::EQUIVALENCE_SURCHARGE_5_NAME => self::EQUIVALENCE_SURCHARGE_5_VALUE,
  61. self::EQUIVALENCE_SURCHARGE_7_NAME => self::EQUIVALENCE_SURCHARGE_7_VALUE,
  62. self::EQUIVALENCE_SURCHARGE_10_NAME => self::EQUIVALENCE_SURCHARGE_10_VALUE,
  63. self::EQUIVALENCE_SURCHARGE_21_NAME => self::EQUIVALENCE_SURCHARGE_21_VALUE,
  64. ];
  65. /**
  66. * @var int
  67. *
  68. * @ORM\Id()
  69. *
  70. * @ORM\GeneratedValue()
  71. *
  72. * @ORM\Column(type="integer", name="id_customer")
  73. */
  74. private $id;
  75. /**
  76. * @var Group
  77. *
  78. * @ORM\ManyToOne(targetEntity="App\Entity\System\Group", inversedBy="customers")
  79. *
  80. * @ORM\JoinColumn(name="id_group", referencedColumnName="id_group", nullable=false)
  81. */
  82. private $group;
  83. /**
  84. * @var Language
  85. *
  86. * @ORM\ManyToOne(targetEntity="App\Entity\System\Language")
  87. *
  88. * @ORM\JoinColumn(name="id_lang", referencedColumnName="id_lang", nullable=false)
  89. */
  90. private $language;
  91. /**
  92. * @var string
  93. *
  94. * @ORM\Column(type="string", length=100, nullable=false)
  95. */
  96. private $name;
  97. /**
  98. * @var string|null
  99. *
  100. * @ORM\Column(type="string", length=32, nullable=true)
  101. */
  102. private $surnames;
  103. /**
  104. * @var string
  105. *
  106. * @Assert\Email
  107. *
  108. * @ORM\Column(type="string", length=128, unique=true)
  109. */
  110. private $email;
  111. /**
  112. * @var string
  113. *
  114. * @ORM\Column(type="string", length=100)
  115. */
  116. private $passwd;
  117. /**
  118. * @var float
  119. *
  120. * @ORM\Column(type="float", nullable=false)
  121. */
  122. private $purse;
  123. /**
  124. * @var \DateTime
  125. *
  126. * @ORM\Column(type="datetime", options={"default" : "CURRENT_TIMESTAMP"})
  127. */
  128. private $lastPasswdGen;
  129. /**
  130. * @var bool
  131. *
  132. * @ORM\Column(type="boolean", options={"default" : 0})
  133. */
  134. private $multifactorAuthEnabled;
  135. /**
  136. * @var int|null
  137. * Number of hours that orders owned by this customer
  138. * must be delayed until confirmed by ERP
  139. *
  140. * @ORM\Column(type="integer", nullable=true)
  141. */
  142. private $orderConfirmationDelay;
  143. /**
  144. * @var bool
  145. *
  146. * @ORM\Column(type="boolean", options={"default" : 0})
  147. */
  148. private $active;
  149. /**
  150. * @var bool
  151. *
  152. * @ORM\Column(type="boolean", options={"default" : 0})
  153. */
  154. private $dropshipping;
  155. /**
  156. * @var \DateTime
  157. *
  158. * @ORM\Column(type="datetime")
  159. */
  160. private $dateAdd;
  161. /**
  162. * @var \DateTime
  163. *
  164. * @ORM\Column(type="datetime")
  165. */
  166. private $dateUpd;
  167. /**
  168. * @var string|null
  169. *
  170. * @ORM\Column(type="text", nullable=true)
  171. */
  172. private $comment;
  173. /**
  174. * @var \DateTime|null
  175. *
  176. * @ORM\Column(type="datetime", nullable=true)
  177. */
  178. private $dateBasicFree;
  179. /**
  180. * @deprecated
  181. *
  182. * @var string|null
  183. *
  184. * @ORM\Column(type="string", length=30, nullable=true, options={"default" : "0"})
  185. */
  186. private $paypalBillingAgreement;
  187. /**
  188. * @var string|null
  189. *
  190. * @ORM\Column(type="string", length=255, nullable=true))
  191. */
  192. private $stripeReference;
  193. /**
  194. * @var \DateTime|null
  195. *
  196. * @ORM\Column(type="datetime", nullable=true)
  197. */
  198. private $datePack;
  199. /**
  200. * @var string|null
  201. *
  202. * @ORM\Column(type="string", length=2, nullable=true)
  203. */
  204. private $csvLang;
  205. /**
  206. * @var string|null
  207. *
  208. * @ORM\Column(type="string", length=50, nullable=true)
  209. */
  210. private $dropshippingName;
  211. /**
  212. * @var string|null
  213. *
  214. * @ORM\Column(type="string", length=100, nullable=true)
  215. */
  216. private $emailPaypal;
  217. /**
  218. * @var bool
  219. *
  220. * @ORM\Column(type="boolean", name="moroso", options={"default" : 0})
  221. */
  222. private $defaulter;
  223. /**
  224. * @var bool
  225. *
  226. * @ORM\Column(type="boolean", options={"default" : 0})
  227. */
  228. private $fraudster;
  229. /**
  230. * @var string|null
  231. *
  232. * @ORM\Column(type="string", length=25, nullable=true)
  233. */
  234. private $payerIdPaypal;
  235. /**
  236. * @var bool|null
  237. *
  238. * @ORM\Column(type="boolean", nullable=true)
  239. */
  240. private $excluirVies;
  241. /**
  242. * @var \DateTime|null
  243. *
  244. * @ORM\Column(type="datetime", nullable=true)
  245. */
  246. private $dateExcluirIva;
  247. /**
  248. * @var bool|null
  249. *
  250. * @ORM\Column(type="boolean", options={"default" : 0}, nullable=true)
  251. */
  252. private $forcePasswordUpdate;
  253. /**
  254. * @var \DateTime|null
  255. *
  256. * @ORM\Column(type="datetime", nullable=true)
  257. */
  258. private $readPolicyCookies;
  259. /**
  260. * @var bool
  261. *
  262. * @ORM\Column(type="boolean", options={"default" : 0}, nullable=false)
  263. */
  264. private $packByPurse;
  265. /**
  266. * @var int
  267. *
  268. * @ORM\Column(type="integer", length=1)
  269. */
  270. private $partialCreation;
  271. /**
  272. * @var bool|null
  273. *
  274. * @ORM\Column(type="boolean", options={"default" : 0}, nullable=true)
  275. */
  276. private $purchaseNotAllowed;
  277. /**
  278. * @var bool|null
  279. *
  280. * @ORM\Column(type="boolean", options={"default" : 0}, nullable=true)
  281. */
  282. private $packBankwirePayment;
  283. /**
  284. * @var Collection<int, Order>&iterable<Order>
  285. *
  286. * @ORM\OneToMany(targetEntity="App\Entity\System\Order", mappedBy="customer")
  287. */
  288. private $orders;
  289. /**
  290. * @var Collection<int, SubscriptionLine>&iterable<SubscriptionLine>
  291. *
  292. * @ORM\OneToMany(targetEntity="App\Entity\System\SubscriptionLine", mappedBy="customer")
  293. */
  294. private $subscriptionLines;
  295. /**
  296. * @var Collection<int, ServiceCustomer>&iterable<ServiceCustomer>
  297. *
  298. * @ORM\OneToMany(targetEntity="App\Entity\System\ServiceCustomer", mappedBy="customer", cascade={"persist"})
  299. */
  300. private $serviceCustomer;
  301. /**
  302. * @var Collection<int, CustomerApi>&iterable<CustomerApi>
  303. *
  304. * @ORM\OneToMany(targetEntity="App\Entity\System\CustomerApi", mappedBy="customer", cascade={"persist"})
  305. */
  306. private $customerApi;
  307. /**
  308. * @var Collection<int, CustomerLog>&iterable<CustomerLog>
  309. *
  310. * @ORM\OneToMany(targetEntity="App\Entity\System\CustomerLog", mappedBy="customer", cascade={"persist"})
  311. */
  312. private $customerLog;
  313. /**
  314. * @var Collection<int, Ftp>&iterable<Ftp>
  315. *
  316. * @ORM\OneToMany(targetEntity="App\Entity\System\Ftp", mappedBy="customer")
  317. */
  318. private $ftp;
  319. /**
  320. * @var Collection<int, SynchronisedShopConfiguration>&iterable<SynchronisedShopConfiguration>
  321. *
  322. * @ORM\OneToMany(targetEntity="App\Entity\System\SynchronisedShopConfiguration", mappedBy="customer")
  323. */
  324. private $syncronisedShopConfiguration;
  325. /**
  326. * @var Collection<int, CustomerMigration>&iterable<CustomerMigration>
  327. *
  328. * @ORM\OneToMany(targetEntity="App\Entity\System\CustomerMigration", mappedBy="customer")
  329. */
  330. private $customerMigration;
  331. /**
  332. * @var Pack
  333. *
  334. * @ORM\ManyToOne(targetEntity="App\Entity\System\Pack")
  335. *
  336. * @ORM\JoinColumn(name="id_pack", referencedColumnName="id_pack", nullable=false)
  337. */
  338. private $pack;
  339. /**
  340. * @var Collection<int, Role>&iterable<Role>
  341. *
  342. * @ORM\ManyToMany(targetEntity="App\Entity\System\Role", inversedBy="customers")
  343. *
  344. * @ORM\JoinTable(name="customer_role",
  345. * joinColumns={@ORM\JoinColumn(name="id_customer", referencedColumnName="id_customer")},
  346. * inverseJoinColumns={@ORM\JoinColumn(name="id_role", referencedColumnName="id_role")}
  347. * )
  348. */
  349. private $roles;
  350. /**
  351. * @var Collection<int, CustomerCatalog>&iterable<CustomerCatalog>
  352. *
  353. * @ORM\OneToMany(targetEntity="App\Entity\System\CustomerCatalog", mappedBy="customer", cascade={"persist"}, indexBy="catalog_id")
  354. */
  355. private $customerCatalogs;
  356. /**
  357. * @var Collection<int, AdditionalInfoAnswer>&iterable<AdditionalInfoAnswer>
  358. *
  359. * @ORM\ManyToMany(targetEntity="App\Entity\System\AdditionalInfoAnswer", inversedBy="customers")
  360. *
  361. * @ORM\JoinTable(
  362. * name="customer_additional_info_answer",
  363. * inverseJoinColumns={@ORM\JoinColumn(name="answer_id", referencedColumnName="id")},
  364. * joinColumns={@ORM\JoinColumn(name="customer_id", referencedColumnName="id_customer")}
  365. * )
  366. */
  367. private $additionalInfoAnswers;
  368. /**
  369. * @var string|null
  370. *
  371. * @ORM\Column(type="string", length=64, nullable=true)
  372. */
  373. private $adyenPaymentId;
  374. /**
  375. * @var Collection<int, Wishlist>&iterable<Wishlist>
  376. *
  377. * @ORM\OneToMany(targetEntity="App\Entity\System\Wishlist", mappedBy="customer", cascade={"persist"})
  378. */
  379. private $wishlists;
  380. /**
  381. * @var string|null
  382. *
  383. * @ORM\Column(type="string", length=50, nullable=true)
  384. */
  385. private $googleAccountId;
  386. /**
  387. * @var string|null
  388. *
  389. * @ORM\Column(type="string", length=50, nullable=true)
  390. */
  391. private $linkedinAccountId;
  392. /**
  393. * @ORM\Column(type="string", nullable=true)
  394. */
  395. private ?string $hubspotCompanyId = null;
  396. /**
  397. * @ORM\Column(type="string", nullable=true)
  398. */
  399. private ?string $hubspotContactId = null;
  400. /**
  401. * @var \DateTime|null
  402. *
  403. * @ORM\Column(type="datetime", nullable=true)
  404. */
  405. private ?\DateTime $lastAccess = null;
  406. /**
  407. * @ORM\Column(type="string", length=255, nullable=true)
  408. */
  409. private ?string $stripeDefaultPaymentMethodReference;
  410. /**
  411. * @ORM\OneToOne(targetEntity="App\Entity\System\CustomerInvoiceAddress", mappedBy="customer")
  412. */
  413. private ?CustomerInvoiceAddress $customerInvoiceAddress = null;
  414. /**
  415. * @var Collection<int, CustomerPaymentMethod>&iterable<CustomerPaymentMethod>
  416. *
  417. * @ORM\OneToMany(targetEntity="App\Entity\System\CustomerPaymentMethod", mappedBy="customer")
  418. */
  419. private $customerPaymentMethods;
  420. /**
  421. * @ORM\OneToOne(targetEntity="App\Entity\System\CustomerEncrypted", cascade={"persist", "remove"})
  422. *
  423. * @ORM\JoinColumn(name="customer_encrypted", referencedColumnName="id")
  424. */
  425. private ?CustomerEncrypted $customerEncrypted = null;
  426. private ?string $plainStripeReference = null;
  427. private ?string $plainStripeDefaultPaymentMethodReference = null;
  428. /**
  429. * Customer constructor.
  430. *
  431. * @throws \Exception
  432. */
  433. public function __construct()
  434. {
  435. $this->lastPasswdGen = new \DateTime();
  436. $this->active = false;
  437. $this->dropshipping = false;
  438. $this->defaulter = false;
  439. $this->fraudster = false;
  440. $this->orders = new ArrayCollection();
  441. $this->subscriptionLines = new ArrayCollection();
  442. $this->serviceCustomer = new ArrayCollection();
  443. $this->customerApi = new ArrayCollection();
  444. $this->customerLog = new ArrayCollection();
  445. $this->customerMigration = new ArrayCollection();
  446. $this->syncronisedShopConfiguration = new ArrayCollection();
  447. $this->ftp = new ArrayCollection();
  448. $this->roles = new ArrayCollection();
  449. $this->customerCatalogs = new ArrayCollection();
  450. $this->additionalInfoAnswers = new ArrayCollection();
  451. $this->wishlists = new ArrayCollection();
  452. $this->dateAdd = new \DateTime();
  453. $this->multifactorAuthEnabled = true;
  454. $this->forcePasswordUpdate = false;
  455. $this->purchaseNotAllowed = false;
  456. $this->packByPurse = false;
  457. $this->customerPaymentMethods = new ArrayCollection();
  458. }
  459. public static function createEmptyCustomer(string $email, string $password, Group $group, Role $role, Language $language, \DateTime $currentDateTime): Customer
  460. {
  461. $customer = new self();
  462. $customer->email = $email;
  463. $customer->passwd = $password;
  464. $customer->language = $language;
  465. $customer->active = true;
  466. $customer->purse = 0;
  467. $customer->dateAdd = $currentDateTime;
  468. $customer->dateUpd = $currentDateTime;
  469. $customer->dateExcluirIva = null;
  470. $customer->packByPurse = false;
  471. $customer->group = $group;
  472. $customer->name = '';
  473. $customer->partialCreation = self::PARTIAL_CREATION_STEP_1_ID;
  474. $customer->multifactorAuthEnabled = true;
  475. $customer->roles = new ArrayCollection([$role]);
  476. $customer->wishlists = new ArrayCollection([WishListFactory::createDefault($customer, $customer->getLanguage()->getId())]);
  477. return $customer;
  478. }
  479. public function getPassword(): string
  480. {
  481. return $this->getPasswd();
  482. }
  483. public function getSalt(): ?string
  484. {
  485. return null;
  486. }
  487. public function getUsername(): string
  488. {
  489. return $this->email;
  490. }
  491. public function eraseCredentials(): void
  492. {
  493. }
  494. public function getId(): int
  495. {
  496. return $this->id;
  497. }
  498. public function getUserIdentifier(): string
  499. {
  500. return (string)$this->id;
  501. }
  502. public function setId(int $id): Customer
  503. {
  504. $this->id = $id;
  505. return $this;
  506. }
  507. public function getGroup(): Group
  508. {
  509. return $this->group;
  510. }
  511. public function setGroup(Group $group): Customer
  512. {
  513. $this->group = $group;
  514. return $this;
  515. }
  516. public function getLanguage(): Language
  517. {
  518. return $this->language;
  519. }
  520. public function setLanguage(Language $language): Customer
  521. {
  522. $this->language = $language;
  523. return $this;
  524. }
  525. public function getName(): string
  526. {
  527. return $this->name;
  528. }
  529. public function setName(string $name): Customer
  530. {
  531. $this->name = $name;
  532. return $this;
  533. }
  534. public function getSurnames(): ?string
  535. {
  536. return $this->surnames;
  537. }
  538. public function getLastname(): ?string
  539. {
  540. return $this->surnames;
  541. }
  542. public function setSurnames(?string $surnames): Customer
  543. {
  544. $this->surnames = $surnames;
  545. return $this;
  546. }
  547. public function getEmail(): string
  548. {
  549. return $this->email;
  550. }
  551. public function setEmail(string $email): Customer
  552. {
  553. $this->email = $email;
  554. return $this;
  555. }
  556. public function getPasswd(): string
  557. {
  558. return $this->passwd;
  559. }
  560. public function setPasswd(string $passwd): Customer
  561. {
  562. $this->passwd = $passwd;
  563. return $this;
  564. }
  565. public function getPurse(): float
  566. {
  567. return $this->purse;
  568. }
  569. public function setPurse(float $purse): Customer
  570. {
  571. $this->purse = $purse;
  572. return $this;
  573. }
  574. public function getLastPasswdGen(): \DateTime
  575. {
  576. return $this->lastPasswdGen;
  577. }
  578. public function setLastPasswdGen(\DateTime $lastPasswdGen): Customer
  579. {
  580. $this->lastPasswdGen = $lastPasswdGen;
  581. return $this;
  582. }
  583. public function isActive(): bool
  584. {
  585. return $this->active;
  586. }
  587. public function isEnabled(): bool
  588. {
  589. return $this->active;
  590. }
  591. public function setActive(bool $active): Customer
  592. {
  593. $this->active = $active;
  594. return $this;
  595. }
  596. public function isDropshipping(): bool
  597. {
  598. return $this->dropshipping;
  599. }
  600. public function setDropshipping(bool $dropshipping): Customer
  601. {
  602. $this->dropshipping = $dropshipping;
  603. return $this;
  604. }
  605. public function getDateAdd(): \DateTime
  606. {
  607. return $this->dateAdd;
  608. }
  609. public function setDateAdd(\DateTime $dateAdd): Customer
  610. {
  611. $this->dateAdd = $dateAdd;
  612. return $this;
  613. }
  614. public function getDateUpd(): \DateTime
  615. {
  616. return $this->dateUpd;
  617. }
  618. public function setDateUpd(\DateTime $dateUpd): Customer
  619. {
  620. $this->dateUpd = $dateUpd;
  621. return $this;
  622. }
  623. public function getComment(): ?string
  624. {
  625. return $this->comment;
  626. }
  627. public function setComment(?string $comment): Customer
  628. {
  629. $this->comment = $comment;
  630. return $this;
  631. }
  632. public function getDateBasicFree(): ?\DateTime
  633. {
  634. return $this->dateBasicFree;
  635. }
  636. public function setDateBasicFree(?\DateTime $dateBasicFree): Customer
  637. {
  638. $this->dateBasicFree = $dateBasicFree;
  639. return $this;
  640. }
  641. /**
  642. * @deprecated
  643. */
  644. public function getPaypalBillingAgreement(): ?string
  645. {
  646. if ($this->paypalBillingAgreement === '0' || $this->paypalBillingAgreement === '') {
  647. return null;
  648. }
  649. return $this->paypalBillingAgreement;
  650. }
  651. /**
  652. * @deprecated
  653. */
  654. public function setPaypalBillingAgreement(?string $paypalBillingAgreement): Customer
  655. {
  656. $this->paypalBillingAgreement = $paypalBillingAgreement;
  657. return $this;
  658. }
  659. public function getDatePack(): ?\DateTime
  660. {
  661. return $this->datePack;
  662. }
  663. public function setDatePack(?\DateTime $datePack): Customer
  664. {
  665. $this->datePack = $datePack;
  666. return $this;
  667. }
  668. public function getCsvLang(): ?string
  669. {
  670. return $this->csvLang;
  671. }
  672. public function setCsvLang(?string $csvLang): Customer
  673. {
  674. $this->csvLang = $csvLang;
  675. return $this;
  676. }
  677. public function getDropshippingName(): ?string
  678. {
  679. return $this->dropshippingName;
  680. }
  681. public function setDropshippingName(?string $dropshippingName): Customer
  682. {
  683. $this->dropshippingName = $dropshippingName;
  684. return $this;
  685. }
  686. public function getEmailPaypal(): ?string
  687. {
  688. return $this->emailPaypal;
  689. }
  690. public function setEmailPaypal(?string $emailPaypal): Customer
  691. {
  692. $this->emailPaypal = $emailPaypal;
  693. return $this;
  694. }
  695. public function isDefaulter(): bool
  696. {
  697. return $this->defaulter;
  698. }
  699. public function setDefaulter(bool $defaulter): Customer
  700. {
  701. $this->defaulter = $defaulter;
  702. return $this;
  703. }
  704. public function isFraudster(): bool
  705. {
  706. return $this->fraudster;
  707. }
  708. public function setFraudster(bool $fraudster): Customer
  709. {
  710. $this->fraudster = $fraudster;
  711. return $this;
  712. }
  713. public function getPayerIdPaypal(): ?string
  714. {
  715. return $this->payerIdPaypal;
  716. }
  717. public function setPayerIdPaypal(?string $payerIdPaypal): Customer
  718. {
  719. $this->payerIdPaypal = $payerIdPaypal;
  720. return $this;
  721. }
  722. public function getExcluirVies(): ?bool
  723. {
  724. return $this->excluirVies;
  725. }
  726. public function setExcluirVies(?bool $excluirVies): Customer
  727. {
  728. $this->excluirVies = $excluirVies;
  729. return $this;
  730. }
  731. public function getDateExcluirIva(): ?\DateTime
  732. {
  733. return $this->dateExcluirIva;
  734. }
  735. public function setDateExcluirIva(?\DateTime $dateExcluirIva): Customer
  736. {
  737. $this->dateExcluirIva = $dateExcluirIva;
  738. return $this;
  739. }
  740. public function getReadPolicyCookies(): ?\DateTime
  741. {
  742. return $this->readPolicyCookies;
  743. }
  744. public function setReadPolicyCookies(?\DateTime $readPolicyCookies): Customer
  745. {
  746. $this->readPolicyCookies = $readPolicyCookies;
  747. return $this;
  748. }
  749. public function getPackByPurse(): bool
  750. {
  751. return $this->packByPurse;
  752. }
  753. public function setPackByPurse(bool $packByPurse): Customer
  754. {
  755. $this->packByPurse = $packByPurse;
  756. return $this;
  757. }
  758. public function getPartialCreation(): int
  759. {
  760. return $this->partialCreation;
  761. }
  762. public function setPartialCreation(int $partialCreation): Customer
  763. {
  764. $this->partialCreation = $partialCreation;
  765. return $this;
  766. }
  767. /**
  768. * @return Collection<int, Order>&iterable<Order>
  769. */
  770. public function getOrders()
  771. {
  772. throw new \LogicException();
  773. }
  774. public function getPurchaseNotAllowed(): ?bool
  775. {
  776. return $this->purchaseNotAllowed;
  777. }
  778. public function setPurchaseNotAllowed(?bool $purchaseNotAllowed): self
  779. {
  780. $this->purchaseNotAllowed = $purchaseNotAllowed;
  781. return $this;
  782. }
  783. /**
  784. * @return Collection<int, SubscriptionLine>&iterable<SubscriptionLine>
  785. */
  786. public function getSubscriptionLines()
  787. {
  788. return $this->subscriptionLines;
  789. }
  790. /**
  791. * @param Collection<int, SubscriptionLine>&iterable<SubscriptionLine> $subscriptionLines
  792. *
  793. * @return Customer
  794. */
  795. public function setSubscriptionLines($subscriptionLines)
  796. {
  797. $this->subscriptionLines = $subscriptionLines;
  798. return $this;
  799. }
  800. /**
  801. * @return Collection<int, ServiceCustomer>&iterable<ServiceCustomer>
  802. */
  803. public function getServiceCustomer()
  804. {
  805. return $this->serviceCustomer;
  806. }
  807. /**
  808. * @param Collection<int, ServiceCustomer>&iterable<ServiceCustomer> $serviceCustomer
  809. */
  810. public function setServiceCustomer($serviceCustomer): Customer
  811. {
  812. $this->serviceCustomer = $serviceCustomer;
  813. return $this;
  814. }
  815. /**
  816. * @return Collection<int, CustomerApi>&iterable<CustomerApi>
  817. */
  818. public function getCustomerApi()
  819. {
  820. return $this->customerApi;
  821. }
  822. /**
  823. * @param Collection<int, CustomerApi>&iterable<CustomerApi> $customerApi
  824. */
  825. public function setCustomerApi($customerApi): Customer
  826. {
  827. $this->customerApi = $customerApi;
  828. return $this;
  829. }
  830. /**
  831. * @return Collection<int, CustomerLog>&iterable<CustomerLog>
  832. */
  833. public function getCustomerLog()
  834. {
  835. return $this->customerLog;
  836. }
  837. /**
  838. * @param Collection<int, CustomerLog>&iterable<CustomerLog> $customerLog
  839. */
  840. public function setCustomerLog($customerLog): Customer
  841. {
  842. $this->customerLog = $customerLog;
  843. return $this;
  844. }
  845. /**
  846. * @return Collection<int, Ftp>&iterable<Ftp>
  847. */
  848. public function getFtp()
  849. {
  850. return $this->ftp;
  851. }
  852. /**
  853. * @param Collection<int, Ftp>&iterable<Ftp> $ftp
  854. */
  855. public function setFtp($ftp): Customer
  856. {
  857. $this->ftp = $ftp;
  858. return $this;
  859. }
  860. /**
  861. * @return Collection<int, SynchronisedShopConfiguration>&iterable<SynchronisedShopConfiguration>
  862. */
  863. public function getSyncronisedShopConfiguration()
  864. {
  865. return $this->syncronisedShopConfiguration;
  866. }
  867. /**
  868. * @param Collection<int, SynchronisedShopConfiguration>&iterable<SynchronisedShopConfiguration> $syncronisedShopConfiguration
  869. */
  870. public function setSyncronisedShopConfiguration($syncronisedShopConfiguration): Customer
  871. {
  872. $this->syncronisedShopConfiguration = $syncronisedShopConfiguration;
  873. return $this;
  874. }
  875. /**
  876. * @return Collection<int, CustomerMigration>&iterable<CustomerMigration>
  877. */
  878. public function getCustomerMigration()
  879. {
  880. return $this->customerMigration;
  881. }
  882. /**
  883. * @param Collection<int, CustomerMigration>&iterable<CustomerMigration> $customerMigration
  884. */
  885. public function setCustomerMigration($customerMigration): Customer
  886. {
  887. $this->customerMigration = $customerMigration;
  888. return $this;
  889. }
  890. public function getRoles(): array
  891. {
  892. $roles = [];
  893. foreach ($this->roles as $role) {
  894. $roleName = $role->getName();
  895. if (!$role->isEmployee() && !in_array($roleName, $roles, true)) {
  896. $roles[$role->getId()] = $role->getName();
  897. }
  898. }
  899. return $roles;
  900. }
  901. public function hasRole(string $roleName): bool
  902. {
  903. return \in_array(\strtoupper($roleName), $this->getRoles(), true);
  904. }
  905. /**
  906. * @return Collection<int, Role>&iterable<Role>
  907. */
  908. public function getRoleCollection()
  909. {
  910. return $this->roles;
  911. }
  912. /**
  913. * @param Collection<int, Role>&iterable<Role> $roles
  914. */
  915. public function setRoleCollection($roles): Customer
  916. {
  917. $this->roles = $roles;
  918. return $this;
  919. }
  920. public function hasMultifactorAuthEnabled(): bool
  921. {
  922. return $this->multifactorAuthEnabled;
  923. }
  924. /**
  925. * Resets paypal-related fields
  926. */
  927. public function resetBillingAgreement(): void
  928. {
  929. $this->setPaypalBillingAgreement(null);
  930. $this->setEmailPaypal('');
  931. $this->setPayerIdPaypal('');
  932. }
  933. public function setPackValuesFromOldCustomer(Customer $oldCustomer): void
  934. {
  935. $this->group = $oldCustomer->getGroup();
  936. $this->pack = $oldCustomer->getPack();
  937. $this->datePack = $oldCustomer->getDatePack();
  938. $this->payerIdPaypal = $oldCustomer->getPayerIdPaypal();
  939. $this->emailPaypal = $oldCustomer->getEmailPaypal();
  940. }
  941. public function setValuesAfterMigration(Group $groupReference): void
  942. {
  943. $this->group = $groupReference;
  944. $this->datePack = null;
  945. $this->purchaseNotAllowed = true;
  946. }
  947. /**
  948. * @return Collection<int, CustomerCatalog>&iterable<CustomerCatalog>
  949. */
  950. public function getCustomerCatalogs()
  951. {
  952. return $this->customerCatalogs;
  953. }
  954. /**
  955. * @param Collection<int, CustomerCatalog>&iterable<CustomerCatalog> $customerCatalogs
  956. */
  957. public function setCustomerCatalogs($customerCatalogs): self
  958. {
  959. $this->customerCatalogs = $customerCatalogs;
  960. return $this;
  961. }
  962. public function getFullName(): string
  963. {
  964. return $this->name.' '.$this->surnames;
  965. }
  966. public function setMultifactorAuthEnabled(bool $multifactorAuthEnabled): void
  967. {
  968. $this->multifactorAuthEnabled = $multifactorAuthEnabled;
  969. }
  970. public function removeAllAnswers(): void
  971. {
  972. $this->additionalInfoAnswers->clear();
  973. }
  974. public function addAnswers(array $answers): void
  975. {
  976. /** @var AdditionalInfoAnswer|null $answer */
  977. foreach ($answers as $answer) {
  978. if ($answer && !$this->additionalInfoAnswers->contains($answer)) {
  979. $this->additionalInfoAnswers->add($answer);
  980. }
  981. }
  982. }
  983. public function getAdyenPaymentId(): ?string
  984. {
  985. return $this->adyenPaymentId;
  986. }
  987. public function setAdyenPaymentId(?string $adyenPaymentId): self
  988. {
  989. $this->adyenPaymentId = $adyenPaymentId;
  990. return $this;
  991. }
  992. /**
  993. * @return Collection<int, Wishlist>&iterable<Wishlist>
  994. */
  995. public function getWishlists()
  996. {
  997. return $this->wishlists;
  998. }
  999. public function checkInactive(): bool
  1000. {
  1001. return str_starts_with($this->email, self::PREFIX_DROP);
  1002. }
  1003. public function getGoogleAccountId(): ?string
  1004. {
  1005. return $this->googleAccountId;
  1006. }
  1007. public function setGoogleAccountId(?string $googleAccountId): Customer
  1008. {
  1009. $this->googleAccountId = $googleAccountId;
  1010. return $this;
  1011. }
  1012. public function getLinkedinAccountId(): ?string
  1013. {
  1014. return $this->linkedinAccountId;
  1015. }
  1016. public function setLinkedinAccountId(?string $linkedinAccountId): Customer
  1017. {
  1018. $this->linkedinAccountId = $linkedinAccountId;
  1019. return $this;
  1020. }
  1021. public function getPackBankwirePayment(): ?bool
  1022. {
  1023. return $this->packBankwirePayment;
  1024. }
  1025. public function setPackBankwirePayment(bool $packBankwirePayment): Customer
  1026. {
  1027. $this->packBankwirePayment = $packBankwirePayment;
  1028. return $this;
  1029. }
  1030. public function getForcePasswordUpdate(): ?bool
  1031. {
  1032. return $this->forcePasswordUpdate;
  1033. }
  1034. public function setForcePasswordUpdate(?bool $forcePasswordUpdate): void
  1035. {
  1036. $this->forcePasswordUpdate = $forcePasswordUpdate;
  1037. }
  1038. public function getHubspotCompanyId(): ?string
  1039. {
  1040. return $this->hubspotCompanyId;
  1041. }
  1042. public function setHubspotCompanyId(string $hubspotCompanyId): Customer
  1043. {
  1044. $this->hubspotCompanyId = $hubspotCompanyId;
  1045. return $this;
  1046. }
  1047. public function getHubspotContactId(): ?string
  1048. {
  1049. return $this->hubspotContactId;
  1050. }
  1051. public function setHubspotContactId(?string $hubspotContactId): Customer
  1052. {
  1053. $this->hubspotContactId = $hubspotContactId;
  1054. return $this;
  1055. }
  1056. public function getOrderConfirmationDelay(): ?int
  1057. {
  1058. if (null === $this->orderConfirmationDelay) {
  1059. return null;
  1060. }
  1061. if (0 === $this->orderConfirmationDelay) { // set by legacy model
  1062. return null;
  1063. }
  1064. return $this->orderConfirmationDelay;
  1065. }
  1066. public function setOrderConfirmationDelay(?int $orderConfirmationDelay): void
  1067. {
  1068. $this->orderConfirmationDelay = $orderConfirmationDelay;
  1069. }
  1070. public function getLastAccess(): ?\DateTime
  1071. {
  1072. return $this->lastAccess;
  1073. }
  1074. public function setLastAccess(?\DateTime $lastAccess): Customer
  1075. {
  1076. $this->lastAccess = $lastAccess;
  1077. return $this;
  1078. }
  1079. public function __toString(): string
  1080. {
  1081. return $this->name.' '.$this->surnames;
  1082. }
  1083. public function getStripeReference(): ?string
  1084. {
  1085. return $this->stripeReference;
  1086. }
  1087. public function setStripeReference(?string $stripeReference): Customer
  1088. {
  1089. $this->stripeReference = $stripeReference;
  1090. return $this;
  1091. }
  1092. public function getPlainStripeReference(): ?string
  1093. {
  1094. return $this->plainStripeReference;
  1095. }
  1096. public function setPlainStripeReference(?string $plainStripeReference): Customer
  1097. {
  1098. $this->plainStripeReference = $plainStripeReference;
  1099. return $this;
  1100. }
  1101. public function getStripeDefaultPaymentMethodReference(): ?string
  1102. {
  1103. return $this->stripeDefaultPaymentMethodReference;
  1104. }
  1105. public function setStripeDefaultPaymentMethodReference(?string $stripeDefaultPaymentMethodReference): Customer
  1106. {
  1107. $this->stripeDefaultPaymentMethodReference = $stripeDefaultPaymentMethodReference;
  1108. return $this;
  1109. }
  1110. public function getPlainStripeDefaultPaymentMethodReference(): ?string
  1111. {
  1112. return $this->plainStripeDefaultPaymentMethodReference;
  1113. }
  1114. public function setPlainStripeDefaultPaymentMethodReference(?string $stripeDefaultPaymentMethodReference): Customer
  1115. {
  1116. $this->plainStripeDefaultPaymentMethodReference = $stripeDefaultPaymentMethodReference;
  1117. return $this;
  1118. }
  1119. public function getCustomerInvoiceAddress(): ?CustomerInvoiceAddress
  1120. {
  1121. return $this->customerInvoiceAddress;
  1122. }
  1123. public function setCustomerInvoiceAddress(CustomerInvoiceAddress $customerInvoiceAddress): Customer
  1124. {
  1125. $this->customerInvoiceAddress = $customerInvoiceAddress;
  1126. return $this;
  1127. }
  1128. public function getPack(): Pack
  1129. {
  1130. return $this->pack;
  1131. }
  1132. public function setPack(Pack $pack): Customer
  1133. {
  1134. $this->pack = $pack;
  1135. return $this;
  1136. }
  1137. public function getCustomerEncrypted(): ?CustomerEncrypted
  1138. {
  1139. return $this->customerEncrypted;
  1140. }
  1141. public function setCustomerEncrypted(?CustomerEncrypted $customerEncrypted): Customer
  1142. {
  1143. $this->customerEncrypted = $customerEncrypted;
  1144. return $this;
  1145. }
  1146. }