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 ID_CUSTOMER_NOT_BILLING_AGREEMENT '0';
  39.     public const WORKHUMAN_CUSTOMER_IDS = [232487235957235968235969235972235973235974235976235977235978235980235986235989235993235994235996277077425892425896454066454504454508454511454513454515635273669050];
  40.     public const WORKHUMAN_PRICE_FACTOR 1.01;
  41.     public const PREFIX_DROP 'baja_';
  42.     public const NINE_CUSTOMER_ID 132688;
  43.     public const CUSTOMER_DISABLE_CONTROL_FLAG '_baja';
  44.     public const CUSTOMER_PERCENTAGE_COST_PRICES_INDEXED_BY_CUSTOMER_ID = [self::NINE_CUSTOMER_ID => 0.0];
  45.     public const EQUIVALENCE_SURCHARGE_2_NAME 'REC_EQ_2';
  46.     public const EQUIVALENCE_SURCHARGE_2_VALUE 0.0026;
  47.     public const EQUIVALENCE_SURCHARGE_4_NAME 'REC_EQ_4';
  48.     public const EQUIVALENCE_SURCHARGE_4_VALUE 0.005;
  49.     public const EQUIVALENCE_SURCHARGE_5_NAME 'REC_EQ_5';
  50.     public const EQUIVALENCE_SURCHARGE_5_VALUE 0.006;
  51.     public const EQUIVALENCE_SURCHARGE_7_NAME 'REC_EQ_7';
  52.     public const EQUIVALENCE_SURCHARGE_7_VALUE 0.01;
  53.     public const EQUIVALENCE_SURCHARGE_10_NAME 'REC_EQ_10';
  54.     public const EQUIVALENCE_SURCHARGE_10_VALUE 0.014;
  55.     public const EQUIVALENCE_SURCHARGE_21_NAME 'REC_EQ_21';
  56.     public const EQUIVALENCE_SURCHARGE_21_VALUE 0.052;
  57.     public const EQUIVALENCE_SURCHARGE_PERCENTAGE_INDEXED_BY_NAME = [
  58.         self::EQUIVALENCE_SURCHARGE_2_NAME => self::EQUIVALENCE_SURCHARGE_2_VALUE,
  59.         self::EQUIVALENCE_SURCHARGE_4_NAME => self::EQUIVALENCE_SURCHARGE_4_VALUE,
  60.         self::EQUIVALENCE_SURCHARGE_5_NAME => self::EQUIVALENCE_SURCHARGE_5_VALUE,
  61.         self::EQUIVALENCE_SURCHARGE_7_NAME => self::EQUIVALENCE_SURCHARGE_7_VALUE,
  62.         self::EQUIVALENCE_SURCHARGE_10_NAME => self::EQUIVALENCE_SURCHARGE_10_VALUE,
  63.         self::EQUIVALENCE_SURCHARGE_21_NAME => self::EQUIVALENCE_SURCHARGE_21_VALUE,
  64.     ];
  65.     /**
  66.      * @ORM\Id()
  67.      *
  68.      * @ORM\GeneratedValue()
  69.      *
  70.      * @ORM\Column(type="integer", name="id_customer")
  71.      */
  72.     private $id;
  73.     /**
  74.      * @var Group|null
  75.      *
  76.      * @ORM\ManyToOne(targetEntity="App\Entity\System\Group", inversedBy="customers")
  77.      *
  78.      * @ORM\JoinColumn(name="id_group", referencedColumnName="id_group", nullable=false)
  79.      */
  80.     private $group;
  81.     /**
  82.      * @var Language|null
  83.      *
  84.      * @ORM\ManyToOne(targetEntity="App\Entity\System\Language")
  85.      *
  86.      * @ORM\JoinColumn(name="id_lang", referencedColumnName="id_lang", nullable=false)
  87.      */
  88.     private $language;
  89.     /**
  90.      * @var string|null
  91.      *
  92.      * @ORM\Column(type="string", length=100, nullable=false)
  93.      */
  94.     private $name;
  95.     /**
  96.      * @var string|null
  97.      *
  98.      * @ORM\Column(type="string", length=32, nullable=true)
  99.      */
  100.     private $surnames;
  101.     /**
  102.      * @var string
  103.      *
  104.      * @Assert\Email
  105.      *
  106.      * @ORM\Column(type="string", length=128)
  107.      */
  108.     private $email;
  109.     /**
  110.      * @var string
  111.      *
  112.      * @ORM\Column(type="string", length=100)
  113.      */
  114.     private $passwd;
  115.     /**
  116.      * @var int
  117.      *
  118.      * @ORM\Column(type="integer", length=11, nullable=false)
  119.      */
  120.     private $idPack;
  121.     /**
  122.      * @var float
  123.      *
  124.      * @ORM\Column(type="float", nullable=false)
  125.      */
  126.     private $purse;
  127.     /**
  128.      * @var \DateTime
  129.      *
  130.      * @ORM\Column(type="datetime", options={"default" : "CURRENT_TIMESTAMP"})
  131.      */
  132.     private $lastPasswdGen;
  133.     /**
  134.      * @var bool
  135.      *
  136.      * @ORM\Column(type="boolean", options={"default" : 0})
  137.      */
  138.     private $multifactorAuthEnabled;
  139.     /**
  140.      * @var int|null
  141.      *               Number of hours that orders owned by this customer
  142.      *               must be delayed until confirmed by ERP
  143.      *
  144.      * @ORM\Column(type="integer", nullable=true)
  145.      */
  146.     private $orderConfirmationDelay;
  147.     /**
  148.      * @var bool
  149.      *
  150.      * @ORM\Column(type="boolean", options={"default" : 0})
  151.      */
  152.     private $active;
  153.     /**
  154.      * @var bool
  155.      *
  156.      * @ORM\Column(type="boolean", options={"default" : 0})
  157.      */
  158.     private $dropshipping;
  159.     /**
  160.      * @var \DateTime
  161.      *
  162.      * @ORM\Column(type="datetime")
  163.      */
  164.     private $dateAdd;
  165.     /**
  166.      * @var \DateTime
  167.      *
  168.      * @ORM\Column(type="datetime")
  169.      */
  170.     private $dateUpd;
  171.     /**
  172.      * @var string|null
  173.      *
  174.      * @ORM\Column(type="text", nullable=true)
  175.      */
  176.     private $comment;
  177.     /**
  178.      * @ORM\Column(type="datetime", nullable=true)
  179.      */
  180.     private $dateCsv;
  181.     /**
  182.      * @var \DateTime|null
  183.      *
  184.      * @ORM\Column(type="datetime", nullable=true)
  185.      */
  186.     private $dateBasicFree;
  187.     /**
  188.      * @var string|null
  189.      *
  190.      * @ORM\Column(type="string", length=30, nullable=true, options={"default" : "0"})
  191.      */
  192.     private $paypalBillingAgreement;
  193.     /**
  194.      * @var string|null
  195.      *
  196.      * @ORM\Column(type="string", length=255, nullable=true))
  197.      */
  198.     private $stripeReference;
  199.     /**
  200.      * @var \DateTime|null
  201.      *
  202.      * @ORM\Column(type="datetime", nullable=true)
  203.      */
  204.     private $datePack;
  205.     /**
  206.      * @var string|null
  207.      *
  208.      * @ORM\Column(type="string", length=2, nullable=true)
  209.      */
  210.     private $csvLang;
  211.     /**
  212.      * @var string|null
  213.      *
  214.      * @ORM\Column(type="string", length=50, nullable=true)
  215.      */
  216.     private $dropshippingName;
  217.     /**
  218.      * @var string|null
  219.      *
  220.      * @ORM\Column(type="string", length=100, nullable=true)
  221.      */
  222.     private $emailPaypal;
  223.     /**
  224.      * @var bool|null
  225.      *
  226.      * @ORM\Column(type="boolean", options={"default" : 0}, nullable=true)
  227.      */
  228.     private $moroso;
  229.     /**
  230.      * @var string|null
  231.      *
  232.      * @ORM\Column(type="string", length=25, nullable=true)
  233.      */
  234.     private $payerIdPaypal;
  235.     /**
  236.      * @var bool
  237.      *
  238.      * @ORM\Column(type="boolean", options={"default" : 1})
  239.      */
  240.     private $orderCsv;
  241.     /**
  242.      * @var bool|null
  243.      *
  244.      * @ORM\Column(type="boolean", columnDefinition="tinyint(4)" ,nullable=true)
  245.      */
  246.     private $excluirVies;
  247.     /**
  248.      * @var \DateTime|null
  249.      *
  250.      * @ORM\Column(type="datetime", nullable=true)
  251.      */
  252.     private $dateExcluirIva;
  253.     /**
  254.      * @var bool|null
  255.      *
  256.      * @ORM\Column(type="boolean", options={"default" : 0}, nullable=true)
  257.      */
  258.     private $forcePasswordUpdate;
  259.     /**
  260.      * @var \DateTime|null
  261.      *
  262.      * @ORM\Column(type="datetime", nullable=true)
  263.      */
  264.     private $readPolicyCookies;
  265.     /**
  266.      * @var bool
  267.      *
  268.      * @ORM\Column(type="boolean", options={"default" : 0}, nullable=false)
  269.      */
  270.     private $packByPurse;
  271.     /**
  272.      * @var int|null
  273.      *
  274.      * @ORM\Column(type="integer", length=1)
  275.      */
  276.     private $partialCreation;
  277.     /**
  278.      * @var bool|null
  279.      *
  280.      * @ORM\Column(type="boolean", options={"default" : 0}, nullable=true)
  281.      */
  282.     private $purchaseNotAllowed;
  283.     /**
  284.      * @var bool|null
  285.      *
  286.      * @ORM\Column(type="boolean", options={"default" : 0}, nullable=true)
  287.      */
  288.     private $packBankwirePayment;
  289.     /**
  290.      * @ORM\OneToMany(targetEntity="App\Entity\System\Order", mappedBy="customer")
  291.      */
  292.     private $orders;
  293.     /**
  294.      * @ORM\OneToMany(targetEntity="App\Entity\System\Address", mappedBy="customer",  cascade={"persist"})
  295.      */
  296.     private $addresses;
  297.     /**
  298.      * @var ArrayCollection|FuturePack[]
  299.      *
  300.      * @ORM\OneToMany(targetEntity="App\Entity\System\FuturePack", mappedBy="customer")
  301.      */
  302.     private $futurePacks;
  303.     /**
  304.      * @var ArrayCollection|SubscriptionLine[]
  305.      *
  306.      * @ORM\OneToMany(targetEntity="SubscriptionLine", mappedBy="customer")
  307.      */
  308.     private $subscriptionLines;
  309.     /**
  310.      * @var ArrayCollection|ServiceCustomer[]
  311.      *
  312.      * @ORM\OneToMany(targetEntity="ServiceCustomer", mappedBy="customer", cascade={"persist"})
  313.      */
  314.     private $serviceCustomer;
  315.     /**
  316.      * @ORM\OneToMany(targetEntity="CustomerApi", mappedBy="customer", cascade={"persist"})
  317.      */
  318.     private $customerApi;
  319.     /**
  320.      * @ORM\OneToMany(targetEntity="CustomerLog", mappedBy="customer", cascade={"persist"})
  321.      */
  322.     private $customerLog;
  323.     /**
  324.      * @ORM\OneToMany(targetEntity="App\Entity\System\Ftp", mappedBy="customer")
  325.      */
  326.     private $ftp;
  327.     /**
  328.      * @ORM\OneToMany(targetEntity="App\Entity\System\SynchronisedShopConfiguration", mappedBy="customer")
  329.      */
  330.     private $syncronisedShopConfiguration;
  331.     /**
  332.      * @ORM\OneToMany(targetEntity="App\Entity\System\CustomerMigration", mappedBy="customer")
  333.      */
  334.     private $customerMigration;
  335.     /**
  336.      * @var Role[]|ArrayCollection
  337.      *
  338.      * @ORM\ManyToMany(targetEntity="App\Entity\System\Role", inversedBy="customers")
  339.      *
  340.      * @ORM\JoinTable(name="customer_role",
  341.      *  joinColumns={@ORM\JoinColumn(name="id_customer", referencedColumnName="id_customer")},
  342.      *     inverseJoinColumns={@ORM\JoinColumn(name="id_role", referencedColumnName="id_role")}
  343.      * )
  344.      */
  345.     private $roles;
  346.     /**
  347.      * @ORM\OneToMany(targetEntity="App\Entity\System\CustomerCatalog", mappedBy="customer", cascade={"persist"}, indexBy="catalog_id")
  348.      */
  349.     private $customerCatalogs;
  350.     /**
  351.      * @var AdditionalInfoAnswer[]|ArrayCollection
  352.      *
  353.      * @ORM\ManyToMany(targetEntity="App\Entity\System\AdditionalInfoAnswer", inversedBy="customers")
  354.      *
  355.      *  @ORM\JoinTable(
  356.      *   name="customer_additional_info_answer",
  357.      *   inverseJoinColumns={@ORM\JoinColumn(name="answer_id", referencedColumnName="id")},
  358.      *   joinColumns={@ORM\JoinColumn(name="customer_id", referencedColumnName="id_customer")}
  359.      * )
  360.      */
  361.     private $additionalInfoAnswers;
  362.     /**
  363.      * @var string|null
  364.      *
  365.      * @ORM\Column(type="string", length=64, nullable=true)
  366.      */
  367.     private $adyenPaymentId;
  368.     /**
  369.      * @var Wishlist[]|ArrayCollection
  370.      *
  371.      * @ORM\OneToMany(targetEntity="Wishlist", mappedBy="customer", cascade={"persist"})
  372.      */
  373.     private $wishlists;
  374.     /**
  375.      * @var string
  376.      *
  377.      * @ORM\Column(type="string", length=50, nullable= true)
  378.      */
  379.     private $thePowerMbaUserId;
  380.     /**
  381.      * @var string|null
  382.      *
  383.      * @ORM\Column(type="string", length=50, nullable=true)
  384.      */
  385.     private $googleAccountId;
  386.     /**
  387.      * @var string|null
  388.      *
  389.      * @ORM\Column(type="string", length=50, nullable=true)
  390.      */
  391.     private $linkedinAccountId;
  392.     /**
  393.      * @ORM\Column(type="bigint", nullable=true)
  394.      */
  395.     private ?int $hubspotCompanyId null;
  396.     /**
  397.      * @ORM\Column(type="bigint", nullable=true)
  398.      */
  399.     private ?int $hubspotContactId null;
  400.     /**
  401.      * @var \DateTime|null
  402.      *
  403.      * @ORM\Column(type="datetime", nullable=true)
  404.      */
  405.     private ?\DateTime $lastAccess null;
  406.     /**
  407.      * @ORM\Column(type="string", length=255, nullable=true)
  408.      */
  409.     private ?string $stripeDefaultPaymentMethodReference;
  410.     /**
  411.      * Customer constructor.
  412.      *
  413.      * @throws \Exception
  414.      */
  415.     public function __construct()
  416.     {
  417.         $this->group 1;
  418.         $this->lastPasswdGen = new \DateTime();
  419.         $this->active 0;
  420.         $this->dropshipping 0;
  421.         $this->paypalBillingAgreement '0';
  422.         $this->moroso 0;
  423.         $this->orderCsv 1;
  424.         $this->orders = new ArrayCollection();
  425.         $this->addresses = new ArrayCollection();
  426.         $this->futurePacks = 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.     }
  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()
  751.     {
  752.         return $this->dateCsv;
  753.     }
  754.     public function setDateCsv($dateCsv)
  755.     {
  756.         $this->dateCsv $dateCsv;
  757.         return $this;
  758.     }
  759.     /**
  760.      * @return \DateTime|null
  761.      */
  762.     public function getDateBasicFree(): ?\DateTime
  763.     {
  764.         return $this->dateBasicFree;
  765.     }
  766.     /**
  767.      * @param \DateTime|null $dateBasicFree
  768.      *
  769.      * @return Customer
  770.      */
  771.     public function setDateBasicFree(?\DateTime $dateBasicFree): Customer
  772.     {
  773.         $this->dateBasicFree $dateBasicFree;
  774.         return $this;
  775.     }
  776.     /**
  777.      * @return string|null
  778.      */
  779.     public function getPaypalBillingAgreement(): ?string
  780.     {
  781.         return $this->paypalBillingAgreement;
  782.     }
  783.     /**
  784.      * @param string|null $paypalBillingAgreement
  785.      *
  786.      * @return Customer
  787.      */
  788.     public function setPaypalBillingAgreement(?string $paypalBillingAgreement): Customer
  789.     {
  790.         $this->paypalBillingAgreement $paypalBillingAgreement;
  791.         return $this;
  792.     }
  793.     /**
  794.      * @return \DateTime|null
  795.      */
  796.     public function getDatePack(): ?\DateTime
  797.     {
  798.         return $this->datePack;
  799.     }
  800.     /**
  801.      * @param \DateTime|null $datePack
  802.      *
  803.      * @return Customer
  804.      */
  805.     public function setDatePack(?\DateTime $datePack): Customer
  806.     {
  807.         $this->datePack $datePack;
  808.         return $this;
  809.     }
  810.     /**
  811.      * @return string|null
  812.      */
  813.     public function getCsvLang(): ?string
  814.     {
  815.         return $this->csvLang;
  816.     }
  817.     /**
  818.      * @param string|null $csvLang
  819.      *
  820.      * @return Customer
  821.      */
  822.     public function setCsvLang(?string $csvLang): Customer
  823.     {
  824.         $this->csvLang $csvLang;
  825.         return $this;
  826.     }
  827.     /**
  828.      * @return string|null
  829.      */
  830.     public function getDropshippingName(): ?string
  831.     {
  832.         return $this->dropshippingName;
  833.     }
  834.     /**
  835.      * @param string|null $dropshippingName
  836.      *
  837.      * @return Customer
  838.      */
  839.     public function setDropshippingName(?string $dropshippingName): Customer
  840.     {
  841.         $this->dropshippingName $dropshippingName;
  842.         return $this;
  843.     }
  844.     /**
  845.      * @return string|null
  846.      */
  847.     public function getEmailPaypal(): ?string
  848.     {
  849.         return $this->emailPaypal;
  850.     }
  851.     /**
  852.      * @param string|null $emailPaypal
  853.      *
  854.      * @return Customer
  855.      */
  856.     public function setEmailPaypal(?string $emailPaypal): Customer
  857.     {
  858.         $this->emailPaypal $emailPaypal;
  859.         return $this;
  860.     }
  861.     /**
  862.      * @return bool|null
  863.      */
  864.     public function getMoroso(): ?bool
  865.     {
  866.         return $this->moroso;
  867.     }
  868.     /**
  869.      * @param bool|null $moroso
  870.      *
  871.      * @return Customer
  872.      */
  873.     public function setMoroso(?bool $moroso): Customer
  874.     {
  875.         $this->moroso $moroso;
  876.         return $this;
  877.     }
  878.     /**
  879.      * @return string|null
  880.      */
  881.     public function getPayerIdPaypal(): ?string
  882.     {
  883.         return $this->payerIdPaypal;
  884.     }
  885.     /**
  886.      * @param string|null $payerIdPaypal
  887.      *
  888.      * @return Customer
  889.      */
  890.     public function setPayerIdPaypal(?string $payerIdPaypal): Customer
  891.     {
  892.         $this->payerIdPaypal $payerIdPaypal;
  893.         return $this;
  894.     }
  895.     /**
  896.      * @return bool
  897.      */
  898.     public function isOrderCsv(): bool
  899.     {
  900.         return $this->orderCsv;
  901.     }
  902.     /**
  903.      * @param bool $orderCsv
  904.      *
  905.      * @return Customer
  906.      */
  907.     public function setOrderCsv(bool $orderCsv): Customer
  908.     {
  909.         $this->orderCsv $orderCsv;
  910.         return $this;
  911.     }
  912.     /**
  913.      * @return bool|null
  914.      */
  915.     public function getExcluirVies(): ?bool
  916.     {
  917.         return $this->excluirVies;
  918.     }
  919.     /**
  920.      * @param bool|null $excluirVies
  921.      *
  922.      * @return Customer
  923.      */
  924.     public function setExcluirVies(?bool $excluirVies): Customer
  925.     {
  926.         $this->excluirVies $excluirVies;
  927.         return $this;
  928.     }
  929.     /**
  930.      * @return \DateTime|null
  931.      */
  932.     public function getDateExcluirIva(): ?\DateTime
  933.     {
  934.         return $this->dateExcluirIva;
  935.     }
  936.     /**
  937.      * @param \DateTime|null $dateExcluirIva
  938.      *
  939.      * @return Customer
  940.      */
  941.     public function setDateExcluirIva(?\DateTime $dateExcluirIva): Customer
  942.     {
  943.         $this->dateExcluirIva $dateExcluirIva;
  944.         return $this;
  945.     }
  946.     /**
  947.      * @return \DateTime|null
  948.      */
  949.     public function getReadPolicyCookies(): ?\DateTime
  950.     {
  951.         return $this->readPolicyCookies;
  952.     }
  953.     /**
  954.      * @param \DateTime|null $readPolicyCookies
  955.      *
  956.      * @return Customer
  957.      */
  958.     public function setReadPolicyCookies(?\DateTime $readPolicyCookies): Customer
  959.     {
  960.         $this->readPolicyCookies $readPolicyCookies;
  961.         return $this;
  962.     }
  963.     public function getPackByPurse(): bool
  964.     {
  965.         return $this->packByPurse;
  966.     }
  967.     public function setPackByPurse(bool $packByPurse): Customer
  968.     {
  969.         $this->packByPurse $packByPurse;
  970.         return $this;
  971.     }
  972.     /**
  973.      * @return int
  974.      */
  975.     public function getPartialCreation(): int
  976.     {
  977.         return $this->partialCreation;
  978.     }
  979.     /**
  980.      * @param int $partialCreation
  981.      *
  982.      * @return Customer
  983.      */
  984.     public function setPartialCreation(int $partialCreation): Customer
  985.     {
  986.         $this->partialCreation $partialCreation;
  987.         return $this;
  988.     }
  989.     /**
  990.      * @return Collection|Order[]
  991.      */
  992.     public function getOrders(): Collection
  993.     {
  994.         return $this->orders;
  995.     }
  996.     public function addOrder(Order $order): self
  997.     {
  998.         if (!$this->orders->contains($order)) {
  999.             $this->orders[] = $order;
  1000.             $order->setCustomer($this);
  1001.         }
  1002.         return $this;
  1003.     }
  1004.     public function removeOrder(Order $order): self
  1005.     {
  1006.         if ($this->orders->contains($order)) {
  1007.             $this->orders->removeElement($order);
  1008.             // set the owning side to null (unless already changed)
  1009.             if ($order->getCustomer() === $this) {
  1010.                 $order->setCustomer(null);
  1011.             }
  1012.         }
  1013.         return $this;
  1014.     }
  1015.     /**
  1016.      * @return Collection|Address[]
  1017.      */
  1018.     public function getAddresses(): Collection
  1019.     {
  1020.         return $this->addresses;
  1021.     }
  1022.     public function addAddress(Address $address): self
  1023.     {
  1024.         if (!$this->addresses->contains($address)) {
  1025.             $this->addresses[] = $address;
  1026.             $address->setCustomer($this);
  1027.         }
  1028.         return $this;
  1029.     }
  1030.     public function removeAddress(Address $address): self
  1031.     {
  1032.         if ($this->addresses->contains($address)) {
  1033.             $this->addresses->removeElement($address);
  1034.             // set the owning side to null (unless already changed)
  1035.             if ($address->getCustomer() === $this) {
  1036.                 $address->setCustomer(null);
  1037.             }
  1038.         }
  1039.         return $this;
  1040.     }
  1041.     /**
  1042.      * @return bool|null
  1043.      */
  1044.     public function getPurchaseNotAllowed(): ?bool
  1045.     {
  1046.         return $this->purchaseNotAllowed;
  1047.     }
  1048.     /**
  1049.      * @param bool|null $purchaseNotAllowed
  1050.      *
  1051.      * @return Customer
  1052.      */
  1053.     public function setPurchaseNotAllowed(?bool $purchaseNotAllowed): self
  1054.     {
  1055.         $this->purchaseNotAllowed $purchaseNotAllowed;
  1056.         return $this;
  1057.     }
  1058.     /**
  1059.      * @return FuturePack[]|ArrayCollection
  1060.      */
  1061.     public function getFuturePacks()
  1062.     {
  1063.         return $this->futurePacks;
  1064.     }
  1065.     /**
  1066.      * @param FuturePack[]|ArrayCollection $futurePacks
  1067.      *
  1068.      * @return Customer
  1069.      */
  1070.     public function setFuturePacks($futurePacks)
  1071.     {
  1072.         $this->futurePacks $futurePacks;
  1073.         return $this;
  1074.     }
  1075.     /**
  1076.      * @return SubscriptionLine[]|ArrayCollection
  1077.      */
  1078.     public function getSubscriptionLines()
  1079.     {
  1080.         return $this->subscriptionLines;
  1081.     }
  1082.     /**
  1083.      * @param SubscriptionLine[]|ArrayCollection $subscriptionLines
  1084.      *
  1085.      * @return Customer
  1086.      */
  1087.     public function setSubscriptionLines($subscriptionLines)
  1088.     {
  1089.         $this->subscriptionLines $subscriptionLines;
  1090.         return $this;
  1091.     }
  1092.     /**
  1093.      * @return ServiceCustomer[]|ArrayCollection
  1094.      */
  1095.     public function getServiceCustomer()
  1096.     {
  1097.         return $this->serviceCustomer;
  1098.     }
  1099.     /**
  1100.      * @param array $serviceCustomer
  1101.      */
  1102.     public function setServiceCustomer(array $serviceCustomer): Customer
  1103.     {
  1104.         $this->serviceCustomer $serviceCustomer;
  1105.         return $this;
  1106.     }
  1107.     /**
  1108.      * @return array
  1109.      */
  1110.     public function getCustomerApi(): array
  1111.     {
  1112.         return $this->customerApi;
  1113.     }
  1114.     /**
  1115.      * @param array $customerApi
  1116.      *
  1117.      * @return Customer
  1118.      */
  1119.     public function setCustomerApi(array $customerApi): Customer
  1120.     {
  1121.         $this->customerApi $customerApi;
  1122.         return $this;
  1123.     }
  1124.     /**
  1125.      * @return array
  1126.      */
  1127.     public function getCustomerLog(): array
  1128.     {
  1129.         return $this->customerLog;
  1130.     }
  1131.     /**
  1132.      * @param array $customerLog
  1133.      *
  1134.      * @return Customer
  1135.      */
  1136.     public function setCustomerLog(array $customerLog): Customer
  1137.     {
  1138.         $this->customerLog $customerLog;
  1139.         return $this;
  1140.     }
  1141.     /**
  1142.      * @return array
  1143.      */
  1144.     public function getFtp(): array
  1145.     {
  1146.         return $this->ftp;
  1147.     }
  1148.     /**
  1149.      * @param array $ftp
  1150.      *
  1151.      * @return Customer
  1152.      */
  1153.     public function setFtp(array $ftp): Customer
  1154.     {
  1155.         $this->ftp $ftp;
  1156.         return $this;
  1157.     }
  1158.     /**
  1159.      * @return array
  1160.      */
  1161.     public function getSyncronisedShopConfiguration(): array
  1162.     {
  1163.         return $this->syncronisedShopConfiguration;
  1164.     }
  1165.     /**
  1166.      * @param array $syncronisedShopConfiguration
  1167.      *
  1168.      * @return Customer
  1169.      */
  1170.     public function setSyncronisedShopConfiguration(array $syncronisedShopConfiguration): Customer
  1171.     {
  1172.         $this->syncronisedShopConfiguration $syncronisedShopConfiguration;
  1173.         return $this;
  1174.     }
  1175.     /**
  1176.      * @return array
  1177.      */
  1178.     public function getCustomerMigration(): array
  1179.     {
  1180.         return $this->customerMigration;
  1181.     }
  1182.     /**
  1183.      * @param array $customerMigration
  1184.      *
  1185.      * @return Customer
  1186.      */
  1187.     public function setCustomerMigration(array $customerMigration): Customer
  1188.     {
  1189.         $this->customerMigration $customerMigration;
  1190.         return $this;
  1191.     }
  1192.     /**
  1193.      * @return array
  1194.      */
  1195.     public function getRoles(): array
  1196.     {
  1197.         $roleCollection $this->roles;
  1198.         $roles = [];
  1199.         if ($roleCollection) {
  1200.             foreach ($roleCollection as $role) {
  1201.                 $roleName $role->getName();
  1202.                 if (!$role->isEmployee() && !in_array($roleName$rolestrue)) {
  1203.                     $roles[$role->getId()] = $role->getName();
  1204.                 }
  1205.             }
  1206.         }
  1207.         return $roles;
  1208.     }
  1209.     public function hasRole(string $roleName): bool
  1210.     {
  1211.         return \in_array(\strtoupper($roleName), $this->getRoles(), true);
  1212.     }
  1213.     /**
  1214.      * @return Role[]|ArrayCollection
  1215.      */
  1216.     public function getRoleCollection()
  1217.     {
  1218.         return $this->roles;
  1219.     }
  1220.     /**
  1221.      * @param Role[]|ArrayCollection $roles
  1222.      */
  1223.     public function setRoleCollection(ArrayCollection $roles): Customer
  1224.     {
  1225.         $this->roles $roles;
  1226.         return $this;
  1227.     }
  1228.     /**
  1229.      * @return bool
  1230.      */
  1231.     public function hasMultifactorAuthEnabled(): bool
  1232.     {
  1233.         return $this->multifactorAuthEnabled;
  1234.     }
  1235.     /**
  1236.      * Resets paypal-related fields
  1237.      */
  1238.     public function resetBillingAgreement(): void
  1239.     {
  1240.         $this->setPaypalBillingAgreement(self::ID_CUSTOMER_NOT_BILLING_AGREEMENT);
  1241.         $this->setEmailPaypal('');
  1242.         $this->setPayerIdPaypal('');
  1243.     }
  1244.     /**
  1245.      * @param Customer $oldCustomer
  1246.      */
  1247.     public function setPackValuesFromOldCustomer(Customer $oldCustomer): void
  1248.     {
  1249.         $this->group $oldCustomer->getGroup();
  1250.         $this->idPack $oldCustomer->getIdPack();
  1251.         $this->dateCsv $oldCustomer->getDateCsv();
  1252.         $this->datePack $oldCustomer->getDatePack();
  1253.         $this->payerIdPaypal $oldCustomer->getPayerIdPaypal();
  1254.         $this->emailPaypal $oldCustomer->getEmailPaypal();
  1255.         $this->orderCsv $oldCustomer->isOrderCsv();
  1256.     }
  1257.     /**
  1258.      * @param Group $groupReference
  1259.      */
  1260.     public function setValuesAfterMigration(Group $groupReference): void
  1261.     {
  1262.         $this->group $groupReference;
  1263.         $this->idPack Pack::PACK_WITHOUT_PACK;
  1264.         $this->dateCsv null;
  1265.         $this->datePack null;
  1266.         $this->purchaseNotAllowed true;
  1267.     }
  1268.     public function resetPackAndGroup(Group $group): void
  1269.     {
  1270.         $this->group $group;
  1271.         $this->idPack Pack::PACK_WITHOUT_PACK;
  1272.         $this->dateCsv null;
  1273.     }
  1274.     /**
  1275.      * @return ArrayCollection|CustomerCatalog[]
  1276.      */
  1277.     public function getCustomerCatalogs()
  1278.     {
  1279.         return $this->customerCatalogs;
  1280.     }
  1281.     /**
  1282.      * @param ArrayCollection $customerCatalogs
  1283.      *
  1284.      * @return Customer
  1285.      */
  1286.     public function setCustomerCatalogs($customerCatalogs): self
  1287.     {
  1288.         $this->customerCatalogs $customerCatalogs;
  1289.         return $this;
  1290.     }
  1291.     public function getFullName(): string
  1292.     {
  1293.         return $this->name.' '.$this->surnames;
  1294.     }
  1295.     public function setMultifactorAuthEnabled(bool $multifactorAuthEnabled): void
  1296.     {
  1297.         $this->multifactorAuthEnabled $multifactorAuthEnabled;
  1298.     }
  1299.     public function removeAllAnswers()
  1300.     {
  1301.         $this->additionalInfoAnswers->clear();
  1302.     }
  1303.     public function addAnswers(array $answers): void
  1304.     {
  1305.         /** @var AdditionalInfoAnswer $answer */
  1306.         foreach ($answers as $answer) {
  1307.             if ($answer && !$this->additionalInfoAnswers->contains($answer)) {
  1308.                 $this->additionalInfoAnswers->add($answer);
  1309.             }
  1310.         }
  1311.     }
  1312.     public function getAdyenPaymentId(): ?string
  1313.     {
  1314.         return $this->adyenPaymentId;
  1315.     }
  1316.     public function setAdyenPaymentId(?string $adyenPaymentId): self
  1317.     {
  1318.         $this->adyenPaymentId $adyenPaymentId;
  1319.         return $this;
  1320.     }
  1321.     /**
  1322.      * @return Wishlist[]|ArrayCollection
  1323.      */
  1324.     public function getWishlists()
  1325.     {
  1326.         return $this->wishlists;
  1327.     }
  1328.     public function getThePowerMbaUserId(): ?string
  1329.     {
  1330.         return $this->thePowerMbaUserId;
  1331.     }
  1332.     public function setThePowerMbaUserId(?string $thePowerMbaUserId): self
  1333.     {
  1334.         $this->thePowerMbaUserId $thePowerMbaUserId;
  1335.         return $this;
  1336.     }
  1337.     public function checkInactive(): bool
  1338.     {
  1339.         return str_starts_with($this->emailself::PREFIX_DROP);
  1340.     }
  1341.     public function getGoogleAccountId(): ?string
  1342.     {
  1343.         return $this->googleAccountId;
  1344.     }
  1345.     public function setGoogleAccountId(?string $googleAccountId): Customer
  1346.     {
  1347.         $this->googleAccountId $googleAccountId;
  1348.         return $this;
  1349.     }
  1350.     public function getLinkedinAccountId(): ?string
  1351.     {
  1352.         return $this->linkedinAccountId;
  1353.     }
  1354.     public function setLinkedinAccountId(?string $linkedinAccountId): Customer
  1355.     {
  1356.         $this->linkedinAccountId $linkedinAccountId;
  1357.         return $this;
  1358.     }
  1359.     public function getPackBankwirePayment(): ?bool
  1360.     {
  1361.         return $this->packBankwirePayment;
  1362.     }
  1363.     public function setPackBankwirePayment(bool $packBankwirePayment): Customer
  1364.     {
  1365.         $this->packBankwirePayment $packBankwirePayment;
  1366.         return $this;
  1367.     }
  1368.     public function getForcePasswordUpdate(): ?bool
  1369.     {
  1370.         return $this->forcePasswordUpdate;
  1371.     }
  1372.     public function setForcePasswordUpdate(?bool $forcePasswordUpdate): void
  1373.     {
  1374.         $this->forcePasswordUpdate $forcePasswordUpdate;
  1375.     }
  1376.     public function getHubspotCompanyId(): ?int
  1377.     {
  1378.         return $this->hubspotCompanyId;
  1379.     }
  1380.     public function setHubspotCompanyId(?int $hubspotCompanyId): Customer
  1381.     {
  1382.         $this->hubspotCompanyId $hubspotCompanyId;
  1383.         return $this;
  1384.     }
  1385.     public function getHubspotContactId(): ?int
  1386.     {
  1387.         return $this->hubspotContactId;
  1388.     }
  1389.     public function setHubspotContactId(?int $hubspotContactId): Customer
  1390.     {
  1391.         $this->hubspotContactId $hubspotContactId;
  1392.         return $this;
  1393.     }
  1394.     public function getOrderConfirmationDelay(): ?int
  1395.     {
  1396.         if (null === $this->orderConfirmationDelay) {
  1397.             return null;
  1398.         }
  1399.         if (=== $this->orderConfirmationDelay) { // set by legacy model
  1400.             return null;
  1401.         }
  1402.         return $this->orderConfirmationDelay;
  1403.     }
  1404.     public function setOrderConfirmationDelay(?int $orderConfirmationDelay): void
  1405.     {
  1406.         $this->orderConfirmationDelay $orderConfirmationDelay;
  1407.     }
  1408.     public function getLastAccess(): ?\DateTime
  1409.     {
  1410.         return $this->lastAccess;
  1411.     }
  1412.     public function setLastAccess(?\DateTime $lastAccess): Customer
  1413.     {
  1414.         $this->lastAccess $lastAccess;
  1415.         return $this;
  1416.     }
  1417.     public function __toString(): string
  1418.     {
  1419.         return $this->name.' '.$this->surnames;
  1420.     }
  1421.     public function getStripeReference(): ?string
  1422.     {
  1423.         return $this->stripeReference;
  1424.     }
  1425.     public function setStripeReference(?string $stripeReference): Customer
  1426.     {
  1427.         $this->stripeReference $stripeReference;
  1428.         return $this;
  1429.     }
  1430.     public function getStripeDefaultPaymentMethodReference(): ?string
  1431.     {
  1432.         return $this->stripeDefaultPaymentMethodReference;
  1433.     }
  1434.     public function setStripeDefaultPaymentMethodReference(?string $stripeDefaultPaymentMethodReference): Customer
  1435.     {
  1436.         $this->stripeDefaultPaymentMethodReference $stripeDefaultPaymentMethodReference;
  1437.         return $this;
  1438.     }
  1439. }