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