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