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 UserInterfacePasswordAuthenticatedUserInterface
  33. {
  34.     public const DEFAULT_SYS_USER_ID 1523;
  35.     public const IDS_USERS_SYS = [self::DEFAULT_SYS_USER_ID131588131590245190];
  36.     public const PARTIAL_CREATION_STEP_0 2;
  37.     public const ACCOUNT_COMPLETE 0;
  38.     public const WORKHUMAN_CUSTOMER_IDS = [232487235957235968235969235972235973235974235976235977235978235980235986235989235993235994235996277077425892425896454066454504454508454511454513454515635273669050];
  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.      * @ORM\Id()
  66.      *
  67.      * @ORM\GeneratedValue()
  68.      *
  69.      * @ORM\Column(type="integer", name="id_customer")
  70.      */
  71.     private $id;
  72.     /**
  73.      * @var Group|null
  74.      *
  75.      * @ORM\ManyToOne(targetEntity="App\Entity\System\Group", inversedBy="customers")
  76.      *
  77.      * @ORM\JoinColumn(name="id_group", referencedColumnName="id_group", nullable=false)
  78.      */
  79.     private $group;
  80.     /**
  81.      * @var Language|null
  82.      *
  83.      * @ORM\ManyToOne(targetEntity="App\Entity\System\Language")
  84.      *
  85.      * @ORM\JoinColumn(name="id_lang", referencedColumnName="id_lang", nullable=false)
  86.      */
  87.     private $language;
  88.     /**
  89.      * @var string|null
  90.      *
  91.      * @ORM\Column(type="string", length=100, nullable=false)
  92.      */
  93.     private $name;
  94.     /**
  95.      * @var string|null
  96.      *
  97.      * @ORM\Column(type="string", length=32, nullable=true)
  98.      */
  99.     private $surnames;
  100.     /**
  101.      * @var string
  102.      *
  103.      * @Assert\Email
  104.      *
  105.      * @ORM\Column(type="string", length=128)
  106.      */
  107.     private $email;
  108.     /**
  109.      * @var string
  110.      *
  111.      * @ORM\Column(type="string", length=100)
  112.      */
  113.     private $passwd;
  114.     /**
  115.      * @var int
  116.      *
  117.      * @ORM\Column(type="integer", length=11, nullable=false)
  118.      */
  119.     private $idPack;
  120.     /**
  121.      * @var float
  122.      *
  123.      * @ORM\Column(type="float", nullable=false)
  124.      */
  125.     private $purse;
  126.     /**
  127.      * @var \DateTime
  128.      *
  129.      * @ORM\Column(type="datetime", options={"default" : "CURRENT_TIMESTAMP"})
  130.      */
  131.     private $lastPasswdGen;
  132.     /**
  133.      * @var bool
  134.      *
  135.      * @ORM\Column(type="boolean", options={"default" : 0})
  136.      */
  137.     private $multifactorAuthEnabled;
  138.     /**
  139.      * @var int|null
  140.      *               Number of hours that orders owned by this customer
  141.      *               must be delayed until confirmed by ERP
  142.      *
  143.      * @ORM\Column(type="integer", nullable=true)
  144.      */
  145.     private $orderConfirmationDelay;
  146.     /**
  147.      * @var bool
  148.      *
  149.      * @ORM\Column(type="boolean", options={"default" : 0})
  150.      */
  151.     private $active;
  152.     /**
  153.      * @var bool
  154.      *
  155.      * @ORM\Column(type="boolean", options={"default" : 0})
  156.      */
  157.     private $dropshipping;
  158.     /**
  159.      * @var \DateTime
  160.      *
  161.      * @ORM\Column(type="datetime")
  162.      */
  163.     private $dateAdd;
  164.     /**
  165.      * @var \DateTime
  166.      *
  167.      * @ORM\Column(type="datetime")
  168.      */
  169.     private $dateUpd;
  170.     /**
  171.      * @var string|null
  172.      *
  173.      * @ORM\Column(type="text", nullable=true)
  174.      */
  175.     private $comment;
  176.     /**
  177.      * @ORM\Column(type="datetime", nullable=true)
  178.      */
  179.     private $dateCsv;
  180.     /**
  181.      * @var \DateTime|null
  182.      *
  183.      * @ORM\Column(type="datetime", nullable=true)
  184.      */
  185.     private $dateBasicFree;
  186.     /**
  187.      * @var string|null
  188.      *
  189.      * @ORM\Column(type="string", length=30, nullable=true, options={"default" : "0"})
  190.      */
  191.     private $paypalBillingAgreement;
  192.     /**
  193.      * @var string|null
  194.      *
  195.      * @ORM\Column(type="string", length=255, nullable=true))
  196.      */
  197.     private $stripeReference;
  198.     /**
  199.      * @var \DateTime|null
  200.      *
  201.      * @ORM\Column(type="datetime", nullable=true)
  202.      */
  203.     private $datePack;
  204.     /**
  205.      * @var string|null
  206.      *
  207.      * @ORM\Column(type="string", length=2, nullable=true)
  208.      */
  209.     private $csvLang;
  210.     /**
  211.      * @var string|null
  212.      *
  213.      * @ORM\Column(type="string", length=50, nullable=true)
  214.      */
  215.     private $dropshippingName;
  216.     /**
  217.      * @var string|null
  218.      *
  219.      * @ORM\Column(type="string", length=100, nullable=true)
  220.      */
  221.     private $emailPaypal;
  222.     /**
  223.      * @var bool|null
  224.      *
  225.      * @ORM\Column(type="boolean", options={"default" : 0}, nullable=true)
  226.      */
  227.     private $moroso;
  228.     /**
  229.      * @var string|null
  230.      *
  231.      * @ORM\Column(type="string", length=25, nullable=true)
  232.      */
  233.     private $payerIdPaypal;
  234.     /**
  235.      * @var bool
  236.      *
  237.      * @ORM\Column(type="boolean", options={"default" : 1})
  238.      */
  239.     private $orderCsv;
  240.     /**
  241.      * @var bool|null
  242.      *
  243.      * @ORM\Column(type="boolean", columnDefinition="tinyint(4)" ,nullable=true)
  244.      */
  245.     private $excluirVies;
  246.     /**
  247.      * @var \DateTime|null
  248.      *
  249.      * @ORM\Column(type="datetime", nullable=true)
  250.      */
  251.     private $dateExcluirIva;
  252.     /**
  253.      * @var bool|null
  254.      *
  255.      * @ORM\Column(type="boolean", options={"default" : 0}, nullable=true)
  256.      */
  257.     private $forcePasswordUpdate;
  258.     /**
  259.      * @var \DateTime|null
  260.      *
  261.      * @ORM\Column(type="datetime", nullable=true)
  262.      */
  263.     private $readPolicyCookies;
  264.     /**
  265.      * @var bool
  266.      *
  267.      * @ORM\Column(type="boolean", options={"default" : 0}, nullable=false)
  268.      */
  269.     private $packByPurse;
  270.     /**
  271.      * @var int|null
  272.      *
  273.      * @ORM\Column(type="integer", length=1)
  274.      */
  275.     private $partialCreation;
  276.     /**
  277.      * @var bool|null
  278.      *
  279.      * @ORM\Column(type="boolean", options={"default" : 0}, nullable=true)
  280.      */
  281.     private $purchaseNotAllowed;
  282.     /**
  283.      * @var bool|null
  284.      *
  285.      * @ORM\Column(type="boolean", options={"default" : 0}, nullable=true)
  286.      */
  287.     private $packBankwirePayment;
  288.     /**
  289.      * @ORM\OneToMany(targetEntity="App\Entity\System\Order", mappedBy="customer")
  290.      */
  291.     private $orders;
  292.     /**
  293.      * @ORM\OneToMany(targetEntity="App\Entity\System\Address", mappedBy="customer",  cascade={"persist"})
  294.      */
  295.     private $addresses;
  296.     /**
  297.      * @var ArrayCollection|FuturePack[]
  298.      *
  299.      * @ORM\OneToMany(targetEntity="App\Entity\System\FuturePack", mappedBy="customer")
  300.      */
  301.     private $futurePacks;
  302.     /**
  303.      * @var ArrayCollection|SubscriptionLine[]
  304.      *
  305.      * @ORM\OneToMany(targetEntity="SubscriptionLine", mappedBy="customer")
  306.      */
  307.     private $subscriptionLines;
  308.     /**
  309.      * @var ArrayCollection|ServiceCustomer[]
  310.      *
  311.      * @ORM\OneToMany(targetEntity="ServiceCustomer", mappedBy="customer", cascade={"persist"})
  312.      */
  313.     private $serviceCustomer;
  314.     /**
  315.      * @ORM\OneToMany(targetEntity="CustomerApi", mappedBy="customer", cascade={"persist"})
  316.      */
  317.     private $customerApi;
  318.     /**
  319.      * @ORM\OneToMany(targetEntity="CustomerLog", mappedBy="customer", cascade={"persist"})
  320.      */
  321.     private $customerLog;
  322.     /**
  323.      * @ORM\OneToMany(targetEntity="App\Entity\System\Ftp", mappedBy="customer")
  324.      */
  325.     private $ftp;
  326.     /**
  327.      * @ORM\OneToMany(targetEntity="App\Entity\System\SynchronisedShopConfiguration", mappedBy="customer")
  328.      */
  329.     private $syncronisedShopConfiguration;
  330.     /**
  331.      * @ORM\OneToMany(targetEntity="App\Entity\System\CustomerMigration", mappedBy="customer")
  332.      */
  333.     private $customerMigration;
  334.     /**
  335.      * @var Role[]|ArrayCollection
  336.      *
  337.      * @ORM\ManyToMany(targetEntity="App\Entity\System\Role", inversedBy="customers")
  338.      *
  339.      * @ORM\JoinTable(name="customer_role",
  340.      *  joinColumns={@ORM\JoinColumn(name="id_customer", referencedColumnName="id_customer")},
  341.      *     inverseJoinColumns={@ORM\JoinColumn(name="id_role", referencedColumnName="id_role")}
  342.      * )
  343.      */
  344.     private $roles;
  345.     /**
  346.      * @ORM\OneToMany(targetEntity="App\Entity\System\CustomerCatalog", mappedBy="customer", cascade={"persist"}, indexBy="catalog_id")
  347.      */
  348.     private $customerCatalogs;
  349.     /**
  350.      * @var AdditionalInfoAnswer[]|ArrayCollection
  351.      *
  352.      * @ORM\ManyToMany(targetEntity="App\Entity\System\AdditionalInfoAnswer", inversedBy="customers")
  353.      *
  354.      *  @ORM\JoinTable(
  355.      *   name="customer_additional_info_answer",
  356.      *   inverseJoinColumns={@ORM\JoinColumn(name="answer_id", referencedColumnName="id")},
  357.      *   joinColumns={@ORM\JoinColumn(name="customer_id", referencedColumnName="id_customer")}
  358.      * )
  359.      */
  360.     private $additionalInfoAnswers;
  361.     /**
  362.      * @var string|null
  363.      *
  364.      * @ORM\Column(type="string", length=64, nullable=true)
  365.      */
  366.     private $adyenPaymentId;
  367.     /**
  368.      * @var Wishlist[]|ArrayCollection
  369.      *
  370.      * @ORM\OneToMany(targetEntity="Wishlist", mappedBy="customer", cascade={"persist"})
  371.      */
  372.     private $wishlists;
  373.     /**
  374.      * @var string
  375.      *
  376.      * @ORM\Column(type="string", length=50, nullable= true)
  377.      */
  378.     private $thePowerMbaUserId;
  379.     /**
  380.      * @var string|null
  381.      *
  382.      * @ORM\Column(type="string", length=50, nullable=true)
  383.      */
  384.     private $googleAccountId;
  385.     /**
  386.      * @var string|null
  387.      *
  388.      * @ORM\Column(type="string", length=50, nullable=true)
  389.      */
  390.     private $linkedinAccountId;
  391.     /**
  392.      * @ORM\Column(type="bigint", nullable=true)
  393.      */
  394.     private ?int $hubspotCompanyId null;
  395.     /**
  396.      * @ORM\Column(type="bigint", nullable=true)
  397.      */
  398.     private ?int $hubspotContactId null;
  399.     /**
  400.      * @var \DateTime|null
  401.      *
  402.      * @ORM\Column(type="datetime", nullable=true)
  403.      */
  404.     private ?\DateTime $lastAccess null;
  405.     /**
  406.      * @ORM\Column(type="string", length=255, nullable=true)
  407.      */
  408.     private ?string $stripeDefaultPaymentMethodReference;
  409.     /**
  410.      * Customer constructor.
  411.      *
  412.      * @throws \Exception
  413.      */
  414.     public function __construct()
  415.     {
  416.         $this->group 1;
  417.         $this->lastPasswdGen = new \DateTime();
  418.         $this->active 0;
  419.         $this->dropshipping 0;
  420.         $this->paypalBillingAgreement '0';
  421.         $this->moroso 0;
  422.         $this->orderCsv 1;
  423.         $this->orders = new ArrayCollection();
  424.         $this->addresses = new ArrayCollection();
  425.         $this->futurePacks = new ArrayCollection();
  426.         $this->subscriptionLines = new ArrayCollection();
  427.         $this->serviceCustomer = new ArrayCollection();
  428.         $this->customerApi = new ArrayCollection();
  429.         $this->customerLog = new ArrayCollection();
  430.         $this->customerMigration = new ArrayCollection();
  431.         $this->syncronisedShopConfiguration = new ArrayCollection();
  432.         $this->ftp = new ArrayCollection();
  433.         $this->roles = new ArrayCollection();
  434.         $this->customerCatalogs = new ArrayCollection();
  435.         $this->additionalInfoAnswers = new ArrayCollection();
  436.         $this->wishlists = new ArrayCollection();
  437.         $this->dateAdd = new \DateTime();
  438.         $this->multifactorAuthEnabled true;
  439.         $this->forcePasswordUpdate false;
  440.         $this->purchaseNotAllowed false;
  441.         $this->packByPurse false;
  442.     }
  443.     public static function createEmptyCustomer(string $emailstring $passwordGroup $groupRole $roleLanguage $language, \DateTime $currentDateTime, \DateTime $zeroDate): Customer
  444.     {
  445.         $customer = new self();
  446.         $customer->email $email;
  447.         $customer->passwd $password;
  448.         $customer->language $language;
  449.         $customer->active true;
  450.         $customer->purse 0;
  451.         $customer->dateAdd $currentDateTime;
  452.         $customer->dateUpd $currentDateTime;
  453.         $customer->dateCsv $zeroDate;
  454.         $customer->dateExcluirIva $zeroDate;
  455.         $customer->orderCsv false;
  456.         $customer->idPack Pack::PACK_WITHOUT_PACK;
  457.         $customer->packByPurse false;
  458.         $customer->group $group;
  459.         $customer->name '';
  460.         $customer->partialCreation self::PARTIAL_CREATION_STEP_0;
  461.         $customer->multifactorAuthEnabled true;
  462.         $customer->roles = [$role];
  463.         $customer->wishlists = new ArrayCollection([WishListFactory::createDefault($customer$customer->getLanguage()->getId())]);
  464.         return $customer;
  465.     }
  466.     public function getPassword(): string
  467.     {
  468.         return $this->getPasswd();
  469.     }
  470.     public function getSalt(): ?string
  471.     {
  472.         return null;
  473.     }
  474.     public function getUsername(): string
  475.     {
  476.         return $this->email;
  477.     }
  478.     public function eraseCredentials()
  479.     {
  480.     }
  481.     public function getEncoderName(): ?string
  482.     {
  483.         return 'customer_encoder';
  484.     }
  485.     /**
  486.      * @return mixed
  487.      */
  488.     public function getId()
  489.     {
  490.         return $this->id;
  491.     }
  492.     public function getUserIdentifier(): string
  493.     {
  494.         return (string)$this->id;
  495.     }
  496.     /**
  497.      * @param mixed $id
  498.      *
  499.      * @return Customer
  500.      */
  501.     public function setId($id): Customer
  502.     {
  503.         $this->id $id;
  504.         return $this;
  505.     }
  506.     /**
  507.      * @return Group|null
  508.      */
  509.     public function getGroup(): ?Group
  510.     {
  511.         return $this->group;
  512.     }
  513.     /**
  514.      * @param Group|null $group
  515.      *
  516.      * @return Customer
  517.      */
  518.     public function setGroup(?Group $group): Customer
  519.     {
  520.         $this->group $group;
  521.         return $this;
  522.     }
  523.     /**
  524.      * @return Language|null
  525.      */
  526.     public function getLanguage(): ?Language
  527.     {
  528.         return $this->language;
  529.     }
  530.     /**
  531.      * @param Language|null $language
  532.      *
  533.      * @return Customer
  534.      */
  535.     public function setLanguage(?Language $language): Customer
  536.     {
  537.         $this->language $language;
  538.         return $this;
  539.     }
  540.     /**
  541.      * @return string|null
  542.      */
  543.     public function getName(): ?string
  544.     {
  545.         return $this->name;
  546.     }
  547.     /**
  548.      * @param string|null $name
  549.      *
  550.      * @return Customer
  551.      */
  552.     public function setName(?string $name): Customer
  553.     {
  554.         $this->name $name;
  555.         return $this;
  556.     }
  557.     /**
  558.      * @return string|null
  559.      */
  560.     public function getSurnames(): ?string
  561.     {
  562.         return $this->surnames;
  563.     }
  564.     /**
  565.      * @return string|null
  566.      */
  567.     public function getLastname(): ?string
  568.     {
  569.         return $this->surnames;
  570.     }
  571.     /**
  572.      * @param string|null $surnames
  573.      *
  574.      * @return Customer
  575.      */
  576.     public function setSurnames(?string $surnames): Customer
  577.     {
  578.         $this->surnames $surnames;
  579.         return $this;
  580.     }
  581.     /**
  582.      * @return string
  583.      */
  584.     public function getEmail(): string
  585.     {
  586.         return $this->email;
  587.     }
  588.     /**
  589.      * @param string $email
  590.      *
  591.      * @return Customer
  592.      */
  593.     public function setEmail(string $email): Customer
  594.     {
  595.         $this->email $email;
  596.         return $this;
  597.     }
  598.     /**
  599.      * @return string
  600.      */
  601.     public function getPasswd(): string
  602.     {
  603.         return $this->passwd;
  604.     }
  605.     /**
  606.      * @param string $passwd
  607.      *
  608.      * @return Customer
  609.      */
  610.     public function setPasswd(string $passwd): Customer
  611.     {
  612.         $this->passwd $passwd;
  613.         return $this;
  614.     }
  615.     public function getIdPack(): int
  616.     {
  617.         return $this->idPack;
  618.     }
  619.     public function setIdPack(int $idPack): Customer
  620.     {
  621.         $this->idPack $idPack;
  622.         return $this;
  623.     }
  624.     /**
  625.      * @return float
  626.      */
  627.     public function getPurse(): float
  628.     {
  629.         return $this->purse;
  630.     }
  631.     /**
  632.      * @param float $purse
  633.      *
  634.      * @return Customer
  635.      */
  636.     public function setPurse(float $purse): Customer
  637.     {
  638.         $this->purse $purse;
  639.         return $this;
  640.     }
  641.     /**
  642.      * @return \DateTime
  643.      */
  644.     public function getLastPasswdGen(): \DateTime
  645.     {
  646.         return $this->lastPasswdGen;
  647.     }
  648.     /**
  649.      * @param \DateTime $lastPasswdGen
  650.      *
  651.      * @return Customer
  652.      */
  653.     public function setLastPasswdGen(\DateTime $lastPasswdGen): Customer
  654.     {
  655.         $this->lastPasswdGen $lastPasswdGen;
  656.         return $this;
  657.     }
  658.     /**
  659.      * @return bool
  660.      */
  661.     public function isActive(): bool
  662.     {
  663.         return $this->active;
  664.     }
  665.     /**
  666.      * @return bool
  667.      */
  668.     public function isEnabled(): bool
  669.     {
  670.         return $this->active;
  671.     }
  672.     /**
  673.      * @param bool $active
  674.      *
  675.      * @return Customer
  676.      */
  677.     public function setActive(bool $active): Customer
  678.     {
  679.         $this->active $active;
  680.         return $this;
  681.     }
  682.     /**
  683.      * @return bool
  684.      */
  685.     public function isDropshipping(): bool
  686.     {
  687.         return $this->dropshipping;
  688.     }
  689.     /**
  690.      * @param bool $dropshipping
  691.      *
  692.      * @return Customer
  693.      */
  694.     public function setDropshipping(bool $dropshipping): Customer
  695.     {
  696.         $this->dropshipping $dropshipping;
  697.         return $this;
  698.     }
  699.     /**
  700.      * @return \DateTime
  701.      */
  702.     public function getDateAdd(): \DateTime
  703.     {
  704.         return $this->dateAdd;
  705.     }
  706.     /**
  707.      * @param \DateTime $dateAdd
  708.      *
  709.      * @return Customer
  710.      */
  711.     public function setDateAdd(\DateTime $dateAdd): Customer
  712.     {
  713.         $this->dateAdd $dateAdd;
  714.         return $this;
  715.     }
  716.     /**
  717.      * @return \DateTime
  718.      */
  719.     public function getDateUpd(): \DateTime
  720.     {
  721.         return $this->dateUpd;
  722.     }
  723.     /**
  724.      * @param \DateTime $dateUpd
  725.      *
  726.      * @return Customer
  727.      */
  728.     public function setDateUpd(\DateTime $dateUpd): Customer
  729.     {
  730.         $this->dateUpd $dateUpd;
  731.         return $this;
  732.     }
  733.     /**
  734.      * @return string|null
  735.      */
  736.     public function getComment(): ?string
  737.     {
  738.         return $this->comment;
  739.     }
  740.     /**
  741.      * @param string|null $comment
  742.      *
  743.      * @return Customer
  744.      */
  745.     public function setComment(?string $comment): Customer
  746.     {
  747.         $this->comment $comment;
  748.         return $this;
  749.     }
  750.     public function getDateCsv(): ?\DateTime
  751.     {
  752.         return $this->dateCsv;
  753.     }
  754.     public function setDateCsv(?\DateTime $dateCsv)
  755.     {
  756.         $this->dateCsv $dateCsv;
  757.         return $this;
  758.     }
  759.     public function getDateBasicFree(): ?\DateTime
  760.     {
  761.         return $this->dateBasicFree;
  762.     }
  763.     public function setDateBasicFree(?\DateTime $dateBasicFree): Customer
  764.     {
  765.         $this->dateBasicFree $dateBasicFree;
  766.         return $this;
  767.     }
  768.     public function getPaypalBillingAgreement(): ?string
  769.     {
  770.         if ($this->paypalBillingAgreement === '0' || $this->paypalBillingAgreement === '') {
  771.             return null;
  772.         }
  773.         return $this->paypalBillingAgreement;
  774.     }
  775.     public function setPaypalBillingAgreement(?string $paypalBillingAgreement): Customer
  776.     {
  777.         $this->paypalBillingAgreement $paypalBillingAgreement;
  778.         return $this;
  779.     }
  780.     /**
  781.      * @return \DateTime|null
  782.      */
  783.     public function getDatePack(): ?\DateTime
  784.     {
  785.         return $this->datePack;
  786.     }
  787.     /**
  788.      * @param \DateTime|null $datePack
  789.      *
  790.      * @return Customer
  791.      */
  792.     public function setDatePack(?\DateTime $datePack): Customer
  793.     {
  794.         $this->datePack $datePack;
  795.         return $this;
  796.     }
  797.     /**
  798.      * @return string|null
  799.      */
  800.     public function getCsvLang(): ?string
  801.     {
  802.         return $this->csvLang;
  803.     }
  804.     /**
  805.      * @param string|null $csvLang
  806.      *
  807.      * @return Customer
  808.      */
  809.     public function setCsvLang(?string $csvLang): Customer
  810.     {
  811.         $this->csvLang $csvLang;
  812.         return $this;
  813.     }
  814.     /**
  815.      * @return string|null
  816.      */
  817.     public function getDropshippingName(): ?string
  818.     {
  819.         return $this->dropshippingName;
  820.     }
  821.     /**
  822.      * @param string|null $dropshippingName
  823.      *
  824.      * @return Customer
  825.      */
  826.     public function setDropshippingName(?string $dropshippingName): Customer
  827.     {
  828.         $this->dropshippingName $dropshippingName;
  829.         return $this;
  830.     }
  831.     /**
  832.      * @return string|null
  833.      */
  834.     public function getEmailPaypal(): ?string
  835.     {
  836.         return $this->emailPaypal;
  837.     }
  838.     /**
  839.      * @param string|null $emailPaypal
  840.      *
  841.      * @return Customer
  842.      */
  843.     public function setEmailPaypal(?string $emailPaypal): Customer
  844.     {
  845.         $this->emailPaypal $emailPaypal;
  846.         return $this;
  847.     }
  848.     /**
  849.      * @return bool|null
  850.      */
  851.     public function getMoroso(): ?bool
  852.     {
  853.         return $this->moroso;
  854.     }
  855.     /**
  856.      * @param bool|null $moroso
  857.      *
  858.      * @return Customer
  859.      */
  860.     public function setMoroso(?bool $moroso): Customer
  861.     {
  862.         $this->moroso $moroso;
  863.         return $this;
  864.     }
  865.     /**
  866.      * @return string|null
  867.      */
  868.     public function getPayerIdPaypal(): ?string
  869.     {
  870.         return $this->payerIdPaypal;
  871.     }
  872.     /**
  873.      * @param string|null $payerIdPaypal
  874.      *
  875.      * @return Customer
  876.      */
  877.     public function setPayerIdPaypal(?string $payerIdPaypal): Customer
  878.     {
  879.         $this->payerIdPaypal $payerIdPaypal;
  880.         return $this;
  881.     }
  882.     /**
  883.      * @return bool
  884.      */
  885.     public function isOrderCsv(): bool
  886.     {
  887.         return $this->orderCsv;
  888.     }
  889.     /**
  890.      * @param bool $orderCsv
  891.      *
  892.      * @return Customer
  893.      */
  894.     public function setOrderCsv(bool $orderCsv): Customer
  895.     {
  896.         $this->orderCsv $orderCsv;
  897.         return $this;
  898.     }
  899.     /**
  900.      * @return bool|null
  901.      */
  902.     public function getExcluirVies(): ?bool
  903.     {
  904.         return $this->excluirVies;
  905.     }
  906.     /**
  907.      * @param bool|null $excluirVies
  908.      *
  909.      * @return Customer
  910.      */
  911.     public function setExcluirVies(?bool $excluirVies): Customer
  912.     {
  913.         $this->excluirVies $excluirVies;
  914.         return $this;
  915.     }
  916.     /**
  917.      * @return \DateTime|null
  918.      */
  919.     public function getDateExcluirIva(): ?\DateTime
  920.     {
  921.         return $this->dateExcluirIva;
  922.     }
  923.     /**
  924.      * @param \DateTime|null $dateExcluirIva
  925.      *
  926.      * @return Customer
  927.      */
  928.     public function setDateExcluirIva(?\DateTime $dateExcluirIva): Customer
  929.     {
  930.         $this->dateExcluirIva $dateExcluirIva;
  931.         return $this;
  932.     }
  933.     /**
  934.      * @return \DateTime|null
  935.      */
  936.     public function getReadPolicyCookies(): ?\DateTime
  937.     {
  938.         return $this->readPolicyCookies;
  939.     }
  940.     /**
  941.      * @param \DateTime|null $readPolicyCookies
  942.      *
  943.      * @return Customer
  944.      */
  945.     public function setReadPolicyCookies(?\DateTime $readPolicyCookies): Customer
  946.     {
  947.         $this->readPolicyCookies $readPolicyCookies;
  948.         return $this;
  949.     }
  950.     public function getPackByPurse(): bool
  951.     {
  952.         return $this->packByPurse;
  953.     }
  954.     public function setPackByPurse(bool $packByPurse): Customer
  955.     {
  956.         $this->packByPurse $packByPurse;
  957.         return $this;
  958.     }
  959.     /**
  960.      * @return int
  961.      */
  962.     public function getPartialCreation(): int
  963.     {
  964.         return $this->partialCreation;
  965.     }
  966.     /**
  967.      * @param int $partialCreation
  968.      *
  969.      * @return Customer
  970.      */
  971.     public function setPartialCreation(int $partialCreation): Customer
  972.     {
  973.         $this->partialCreation $partialCreation;
  974.         return $this;
  975.     }
  976.     /**
  977.      * @return Collection|Order[]
  978.      */
  979.     public function getOrders(): Collection
  980.     {
  981.         throw new \LogicException();
  982.     }
  983.     /**
  984.      * @return Collection|Address[]
  985.      */
  986.     public function getAddresses(): Collection
  987.     {
  988.         throw new \LogicException();
  989.     }
  990.     /**
  991.      * @return bool|null
  992.      */
  993.     public function getPurchaseNotAllowed(): ?bool
  994.     {
  995.         return $this->purchaseNotAllowed;
  996.     }
  997.     /**
  998.      * @param bool|null $purchaseNotAllowed
  999.      *
  1000.      * @return Customer
  1001.      */
  1002.     public function setPurchaseNotAllowed(?bool $purchaseNotAllowed): self
  1003.     {
  1004.         $this->purchaseNotAllowed $purchaseNotAllowed;
  1005.         return $this;
  1006.     }
  1007.     /**
  1008.      * @return FuturePack[]|ArrayCollection
  1009.      */
  1010.     public function getFuturePacks()
  1011.     {
  1012.         return $this->futurePacks;
  1013.     }
  1014.     /**
  1015.      * @param FuturePack[]|ArrayCollection $futurePacks
  1016.      *
  1017.      * @return Customer
  1018.      */
  1019.     public function setFuturePacks($futurePacks)
  1020.     {
  1021.         $this->futurePacks $futurePacks;
  1022.         return $this;
  1023.     }
  1024.     /**
  1025.      * @return SubscriptionLine[]|ArrayCollection
  1026.      */
  1027.     public function getSubscriptionLines()
  1028.     {
  1029.         return $this->subscriptionLines;
  1030.     }
  1031.     /**
  1032.      * @param SubscriptionLine[]|ArrayCollection $subscriptionLines
  1033.      *
  1034.      * @return Customer
  1035.      */
  1036.     public function setSubscriptionLines($subscriptionLines)
  1037.     {
  1038.         $this->subscriptionLines $subscriptionLines;
  1039.         return $this;
  1040.     }
  1041.     /**
  1042.      * @return ServiceCustomer[]|ArrayCollection
  1043.      */
  1044.     public function getServiceCustomer()
  1045.     {
  1046.         return $this->serviceCustomer;
  1047.     }
  1048.     /**
  1049.      * @param array $serviceCustomer
  1050.      */
  1051.     public function setServiceCustomer(array $serviceCustomer): Customer
  1052.     {
  1053.         $this->serviceCustomer $serviceCustomer;
  1054.         return $this;
  1055.     }
  1056.     /**
  1057.      * @return ArrayCollection<int, CustomerApi>|CustomerApi[]
  1058.      */
  1059.     public function getCustomerApi()
  1060.     {
  1061.         return $this->customerApi;
  1062.     }
  1063.     /**
  1064.      * @param CustomerApi[] $customerApi
  1065.      */
  1066.     public function setCustomerApi(array $customerApi): Customer
  1067.     {
  1068.         $this->customerApi $customerApi;
  1069.         return $this;
  1070.     }
  1071.     /**
  1072.      * @return CustomerLog[]|ArrayCollection<int, CustomerLog>
  1073.      */
  1074.     public function getCustomerLog()
  1075.     {
  1076.         return $this->customerLog;
  1077.     }
  1078.     /**
  1079.      * @param CustomerLog[] $customerLog
  1080.      */
  1081.     public function setCustomerLog(array $customerLog): Customer
  1082.     {
  1083.         $this->customerLog $customerLog;
  1084.         return $this;
  1085.     }
  1086.     /**
  1087.      * @return ArrayCollection<int, Ftp>|Ftp[]
  1088.      */
  1089.     public function getFtp()
  1090.     {
  1091.         return $this->ftp;
  1092.     }
  1093.     /**
  1094.      * @param Ftp[] $ftp
  1095.      */
  1096.     public function setFtp(array $ftp): Customer
  1097.     {
  1098.         $this->ftp $ftp;
  1099.         return $this;
  1100.     }
  1101.     /**
  1102.      * @return SynchronisedShopConfiguration[]|ArrayCollection<int, SynchronisedShopConfiguration>
  1103.      */
  1104.     public function getSyncronisedShopConfiguration()
  1105.     {
  1106.         return $this->syncronisedShopConfiguration;
  1107.     }
  1108.     /**
  1109.      * @param array $syncronisedShopConfiguration
  1110.      */
  1111.     public function setSyncronisedShopConfiguration(array $syncronisedShopConfiguration): Customer
  1112.     {
  1113.         $this->syncronisedShopConfiguration $syncronisedShopConfiguration;
  1114.         return $this;
  1115.     }
  1116.     /**
  1117.      * @return CustomerMigration[]|ArrayCollection<int, CustomerMigration>
  1118.      */
  1119.     public function getCustomerMigration()
  1120.     {
  1121.         return $this->customerMigration;
  1122.     }
  1123.     /**
  1124.      * @param array $customerMigration
  1125.      *
  1126.      * @return Customer
  1127.      */
  1128.     public function setCustomerMigration(array $customerMigration): Customer
  1129.     {
  1130.         $this->customerMigration $customerMigration;
  1131.         return $this;
  1132.     }
  1133.     /**
  1134.      * @return array
  1135.      */
  1136.     public function getRoles(): array
  1137.     {
  1138.         $roleCollection $this->roles;
  1139.         $roles = [];
  1140.         if ($roleCollection) {
  1141.             foreach ($roleCollection as $role) {
  1142.                 $roleName $role->getName();
  1143.                 if (!$role->isEmployee() && !in_array($roleName$rolestrue)) {
  1144.                     $roles[$role->getId()] = $role->getName();
  1145.                 }
  1146.             }
  1147.         }
  1148.         return $roles;
  1149.     }
  1150.     public function hasRole(string $roleName): bool
  1151.     {
  1152.         return \in_array(\strtoupper($roleName), $this->getRoles(), true);
  1153.     }
  1154.     /**
  1155.      * @return Role[]|ArrayCollection
  1156.      */
  1157.     public function getRoleCollection()
  1158.     {
  1159.         return $this->roles;
  1160.     }
  1161.     /**
  1162.      * @param Role[]|ArrayCollection $roles
  1163.      */
  1164.     public function setRoleCollection(ArrayCollection $roles): Customer
  1165.     {
  1166.         $this->roles $roles;
  1167.         return $this;
  1168.     }
  1169.     /**
  1170.      * @return bool
  1171.      */
  1172.     public function hasMultifactorAuthEnabled(): bool
  1173.     {
  1174.         return $this->multifactorAuthEnabled;
  1175.     }
  1176.     /**
  1177.      * Resets paypal-related fields
  1178.      */
  1179.     public function resetBillingAgreement(): void
  1180.     {
  1181.         $this->setPaypalBillingAgreement(null);
  1182.         $this->setEmailPaypal('');
  1183.         $this->setPayerIdPaypal('');
  1184.     }
  1185.     /**
  1186.      * @param Customer $oldCustomer
  1187.      */
  1188.     public function setPackValuesFromOldCustomer(Customer $oldCustomer): void
  1189.     {
  1190.         $this->group $oldCustomer->getGroup();
  1191.         $this->idPack $oldCustomer->getIdPack();
  1192.         $this->dateCsv $oldCustomer->getDateCsv();
  1193.         $this->datePack $oldCustomer->getDatePack();
  1194.         $this->payerIdPaypal $oldCustomer->getPayerIdPaypal();
  1195.         $this->emailPaypal $oldCustomer->getEmailPaypal();
  1196.         $this->orderCsv $oldCustomer->isOrderCsv();
  1197.     }
  1198.     /**
  1199.      * @param Group $groupReference
  1200.      */
  1201.     public function setValuesAfterMigration(Group $groupReference): void
  1202.     {
  1203.         $this->group $groupReference;
  1204.         $this->idPack Pack::PACK_WITHOUT_PACK;
  1205.         $this->dateCsv null;
  1206.         $this->datePack null;
  1207.         $this->purchaseNotAllowed true;
  1208.     }
  1209.     /**
  1210.      * @return ArrayCollection|CustomerCatalog[]
  1211.      */
  1212.     public function getCustomerCatalogs()
  1213.     {
  1214.         return $this->customerCatalogs;
  1215.     }
  1216.     /**
  1217.      * @param ArrayCollection $customerCatalogs
  1218.      *
  1219.      * @return Customer
  1220.      */
  1221.     public function setCustomerCatalogs($customerCatalogs): self
  1222.     {
  1223.         $this->customerCatalogs $customerCatalogs;
  1224.         return $this;
  1225.     }
  1226.     public function getFullName(): string
  1227.     {
  1228.         return $this->name.' '.$this->surnames;
  1229.     }
  1230.     public function setMultifactorAuthEnabled(bool $multifactorAuthEnabled): void
  1231.     {
  1232.         $this->multifactorAuthEnabled $multifactorAuthEnabled;
  1233.     }
  1234.     public function removeAllAnswers()
  1235.     {
  1236.         $this->additionalInfoAnswers->clear();
  1237.     }
  1238.     public function addAnswers(array $answers): void
  1239.     {
  1240.         /** @var AdditionalInfoAnswer $answer */
  1241.         foreach ($answers as $answer) {
  1242.             if ($answer && !$this->additionalInfoAnswers->contains($answer)) {
  1243.                 $this->additionalInfoAnswers->add($answer);
  1244.             }
  1245.         }
  1246.     }
  1247.     public function getAdyenPaymentId(): ?string
  1248.     {
  1249.         return $this->adyenPaymentId;
  1250.     }
  1251.     public function setAdyenPaymentId(?string $adyenPaymentId): self
  1252.     {
  1253.         $this->adyenPaymentId $adyenPaymentId;
  1254.         return $this;
  1255.     }
  1256.     /**
  1257.      * @return Wishlist[]|ArrayCollection
  1258.      */
  1259.     public function getWishlists()
  1260.     {
  1261.         return $this->wishlists;
  1262.     }
  1263.     public function getThePowerMbaUserId(): ?string
  1264.     {
  1265.         return $this->thePowerMbaUserId;
  1266.     }
  1267.     public function setThePowerMbaUserId(?string $thePowerMbaUserId): self
  1268.     {
  1269.         $this->thePowerMbaUserId $thePowerMbaUserId;
  1270.         return $this;
  1271.     }
  1272.     public function checkInactive(): bool
  1273.     {
  1274.         return str_starts_with($this->emailself::PREFIX_DROP);
  1275.     }
  1276.     public function getGoogleAccountId(): ?string
  1277.     {
  1278.         return $this->googleAccountId;
  1279.     }
  1280.     public function setGoogleAccountId(?string $googleAccountId): Customer
  1281.     {
  1282.         $this->googleAccountId $googleAccountId;
  1283.         return $this;
  1284.     }
  1285.     public function getLinkedinAccountId(): ?string
  1286.     {
  1287.         return $this->linkedinAccountId;
  1288.     }
  1289.     public function setLinkedinAccountId(?string $linkedinAccountId): Customer
  1290.     {
  1291.         $this->linkedinAccountId $linkedinAccountId;
  1292.         return $this;
  1293.     }
  1294.     public function getPackBankwirePayment(): ?bool
  1295.     {
  1296.         return $this->packBankwirePayment;
  1297.     }
  1298.     public function setPackBankwirePayment(bool $packBankwirePayment): Customer
  1299.     {
  1300.         $this->packBankwirePayment $packBankwirePayment;
  1301.         return $this;
  1302.     }
  1303.     public function getForcePasswordUpdate(): ?bool
  1304.     {
  1305.         return $this->forcePasswordUpdate;
  1306.     }
  1307.     public function setForcePasswordUpdate(?bool $forcePasswordUpdate): void
  1308.     {
  1309.         $this->forcePasswordUpdate $forcePasswordUpdate;
  1310.     }
  1311.     public function getHubspotCompanyId(): ?int
  1312.     {
  1313.         return $this->hubspotCompanyId;
  1314.     }
  1315.     public function setHubspotCompanyId(?int $hubspotCompanyId): Customer
  1316.     {
  1317.         $this->hubspotCompanyId $hubspotCompanyId;
  1318.         return $this;
  1319.     }
  1320.     public function getHubspotContactId(): ?int
  1321.     {
  1322.         return $this->hubspotContactId;
  1323.     }
  1324.     public function setHubspotContactId(?int $hubspotContactId): Customer
  1325.     {
  1326.         $this->hubspotContactId $hubspotContactId;
  1327.         return $this;
  1328.     }
  1329.     public function getOrderConfirmationDelay(): ?int
  1330.     {
  1331.         if (null === $this->orderConfirmationDelay) {
  1332.             return null;
  1333.         }
  1334.         if (=== $this->orderConfirmationDelay) { // set by legacy model
  1335.             return null;
  1336.         }
  1337.         return $this->orderConfirmationDelay;
  1338.     }
  1339.     public function setOrderConfirmationDelay(?int $orderConfirmationDelay): void
  1340.     {
  1341.         $this->orderConfirmationDelay $orderConfirmationDelay;
  1342.     }
  1343.     public function getLastAccess(): ?\DateTime
  1344.     {
  1345.         return $this->lastAccess;
  1346.     }
  1347.     public function setLastAccess(?\DateTime $lastAccess): Customer
  1348.     {
  1349.         $this->lastAccess $lastAccess;
  1350.         return $this;
  1351.     }
  1352.     public function __toString(): string
  1353.     {
  1354.         return $this->name.' '.$this->surnames;
  1355.     }
  1356.     public function getStripeReference(): ?string
  1357.     {
  1358.         return $this->stripeReference;
  1359.     }
  1360.     public function setStripeReference(?string $stripeReference): Customer
  1361.     {
  1362.         $this->stripeReference $stripeReference;
  1363.         return $this;
  1364.     }
  1365.     public function getStripeDefaultPaymentMethodReference(): ?string
  1366.     {
  1367.         return $this->stripeDefaultPaymentMethodReference;
  1368.     }
  1369.     public function setStripeDefaultPaymentMethodReference(?string $stripeDefaultPaymentMethodReference): Customer
  1370.     {
  1371.         $this->stripeDefaultPaymentMethodReference $stripeDefaultPaymentMethodReference;
  1372.         return $this;
  1373.     }
  1374. }