src/Entity/System/Customer.php line 36

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