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.     }
  442.     public static function createEmptyCustomer(string $emailstring $passwordGroup $groupRole $roleLanguage $language, \DateTime $currentDateTime, \DateTime $zeroDate): Customer
  443.     {
  444.         $customer = new self();
  445.         $customer->email $email;
  446.         $customer->passwd $password;
  447.         $customer->language $language;
  448.         $customer->active true;
  449.         $customer->purse 0;
  450.         $customer->dateAdd $currentDateTime;
  451.         $customer->dateUpd $currentDateTime;
  452.         $customer->dateCsv $zeroDate;
  453.         $customer->dateExcluirIva $zeroDate;
  454.         $customer->orderCsv false;
  455.         $customer->idPack Pack::PACK_WITHOUT_PACK;
  456.         $customer->packByPurse false;
  457.         $customer->group $group;
  458.         $customer->name '';
  459.         $customer->partialCreation self::PARTIAL_CREATION_STEP_0;
  460.         $customer->multifactorAuthEnabled true;
  461.         $customer->roles = [$role];
  462.         $customer->wishlists = new ArrayCollection([WishListFactory::createDefault($customer$customer->getLanguage()->getId())]);
  463.         return $customer;
  464.     }
  465.     public function getPassword(): string
  466.     {
  467.         return $this->getPasswd();
  468.     }
  469.     public function getSalt(): ?string
  470.     {
  471.         return null;
  472.     }
  473.     public function getUsername(): string
  474.     {
  475.         return $this->email;
  476.     }
  477.     public function eraseCredentials()
  478.     {
  479.     }
  480.     public function getEncoderName(): ?string
  481.     {
  482.         return 'customer_encoder';
  483.     }
  484.     /**
  485.      * @return mixed
  486.      */
  487.     public function getId()
  488.     {
  489.         return $this->id;
  490.     }
  491.     public function getUserIdentifier(): string
  492.     {
  493.         return (string)$this->id;
  494.     }
  495.     /**
  496.      * @param mixed $id
  497.      *
  498.      * @return Customer
  499.      */
  500.     public function setId($id): Customer
  501.     {
  502.         $this->id $id;
  503.         return $this;
  504.     }
  505.     /**
  506.      * @return Group|null
  507.      */
  508.     public function getGroup(): ?Group
  509.     {
  510.         return $this->group;
  511.     }
  512.     /**
  513.      * @param Group|null $group
  514.      *
  515.      * @return Customer
  516.      */
  517.     public function setGroup(?Group $group): Customer
  518.     {
  519.         $this->group $group;
  520.         return $this;
  521.     }
  522.     /**
  523.      * @return Language|null
  524.      */
  525.     public function getLanguage(): ?Language
  526.     {
  527.         return $this->language;
  528.     }
  529.     /**
  530.      * @param Language|null $language
  531.      *
  532.      * @return Customer
  533.      */
  534.     public function setLanguage(?Language $language): Customer
  535.     {
  536.         $this->language $language;
  537.         return $this;
  538.     }
  539.     /**
  540.      * @return string|null
  541.      */
  542.     public function getName(): ?string
  543.     {
  544.         return $this->name;
  545.     }
  546.     /**
  547.      * @param string|null $name
  548.      *
  549.      * @return Customer
  550.      */
  551.     public function setName(?string $name): Customer
  552.     {
  553.         $this->name $name;
  554.         return $this;
  555.     }
  556.     /**
  557.      * @return string|null
  558.      */
  559.     public function getSurnames(): ?string
  560.     {
  561.         return $this->surnames;
  562.     }
  563.     /**
  564.      * @return string|null
  565.      */
  566.     public function getLastname(): ?string
  567.     {
  568.         return $this->surnames;
  569.     }
  570.     /**
  571.      * @param string|null $surnames
  572.      *
  573.      * @return Customer
  574.      */
  575.     public function setSurnames(?string $surnames): Customer
  576.     {
  577.         $this->surnames $surnames;
  578.         return $this;
  579.     }
  580.     /**
  581.      * @return string
  582.      */
  583.     public function getEmail(): string
  584.     {
  585.         return $this->email;
  586.     }
  587.     /**
  588.      * @param string $email
  589.      *
  590.      * @return Customer
  591.      */
  592.     public function setEmail(string $email): Customer
  593.     {
  594.         $this->email $email;
  595.         return $this;
  596.     }
  597.     /**
  598.      * @return string
  599.      */
  600.     public function getPasswd(): string
  601.     {
  602.         return $this->passwd;
  603.     }
  604.     /**
  605.      * @param string $passwd
  606.      *
  607.      * @return Customer
  608.      */
  609.     public function setPasswd(string $passwd): Customer
  610.     {
  611.         $this->passwd $passwd;
  612.         return $this;
  613.     }
  614.     public function getIdPack(): int
  615.     {
  616.         return $this->idPack;
  617.     }
  618.     public function setIdPack(int $idPack): Customer
  619.     {
  620.         $this->idPack $idPack;
  621.         return $this;
  622.     }
  623.     /**
  624.      * @return float
  625.      */
  626.     public function getPurse(): float
  627.     {
  628.         return $this->purse;
  629.     }
  630.     /**
  631.      * @param float $purse
  632.      *
  633.      * @return Customer
  634.      */
  635.     public function setPurse(float $purse): Customer
  636.     {
  637.         $this->purse $purse;
  638.         return $this;
  639.     }
  640.     /**
  641.      * @return \DateTime
  642.      */
  643.     public function getLastPasswdGen(): \DateTime
  644.     {
  645.         return $this->lastPasswdGen;
  646.     }
  647.     /**
  648.      * @param \DateTime $lastPasswdGen
  649.      *
  650.      * @return Customer
  651.      */
  652.     public function setLastPasswdGen(\DateTime $lastPasswdGen): Customer
  653.     {
  654.         $this->lastPasswdGen $lastPasswdGen;
  655.         return $this;
  656.     }
  657.     /**
  658.      * @return bool
  659.      */
  660.     public function isActive(): bool
  661.     {
  662.         return $this->active;
  663.     }
  664.     /**
  665.      * @return bool
  666.      */
  667.     public function isEnabled(): bool
  668.     {
  669.         return $this->active;
  670.     }
  671.     /**
  672.      * @param bool $active
  673.      *
  674.      * @return Customer
  675.      */
  676.     public function setActive(bool $active): Customer
  677.     {
  678.         $this->active $active;
  679.         return $this;
  680.     }
  681.     /**
  682.      * @return bool
  683.      */
  684.     public function isDropshipping(): bool
  685.     {
  686.         return $this->dropshipping;
  687.     }
  688.     /**
  689.      * @param bool $dropshipping
  690.      *
  691.      * @return Customer
  692.      */
  693.     public function setDropshipping(bool $dropshipping): Customer
  694.     {
  695.         $this->dropshipping $dropshipping;
  696.         return $this;
  697.     }
  698.     /**
  699.      * @return \DateTime
  700.      */
  701.     public function getDateAdd(): \DateTime
  702.     {
  703.         return $this->dateAdd;
  704.     }
  705.     /**
  706.      * @param \DateTime $dateAdd
  707.      *
  708.      * @return Customer
  709.      */
  710.     public function setDateAdd(\DateTime $dateAdd): Customer
  711.     {
  712.         $this->dateAdd $dateAdd;
  713.         return $this;
  714.     }
  715.     /**
  716.      * @return \DateTime
  717.      */
  718.     public function getDateUpd(): \DateTime
  719.     {
  720.         return $this->dateUpd;
  721.     }
  722.     /**
  723.      * @param \DateTime $dateUpd
  724.      *
  725.      * @return Customer
  726.      */
  727.     public function setDateUpd(\DateTime $dateUpd): Customer
  728.     {
  729.         $this->dateUpd $dateUpd;
  730.         return $this;
  731.     }
  732.     /**
  733.      * @return string|null
  734.      */
  735.     public function getComment(): ?string
  736.     {
  737.         return $this->comment;
  738.     }
  739.     /**
  740.      * @param string|null $comment
  741.      *
  742.      * @return Customer
  743.      */
  744.     public function setComment(?string $comment): Customer
  745.     {
  746.         $this->comment $comment;
  747.         return $this;
  748.     }
  749.     public function getDateCsv(): ?\DateTime
  750.     {
  751.         return $this->dateCsv;
  752.     }
  753.     public function setDateCsv(?\DateTime $dateCsv)
  754.     {
  755.         $this->dateCsv $dateCsv;
  756.         return $this;
  757.     }
  758.     public function getDateBasicFree(): ?\DateTime
  759.     {
  760.         return $this->dateBasicFree;
  761.     }
  762.     public function setDateBasicFree(?\DateTime $dateBasicFree): Customer
  763.     {
  764.         $this->dateBasicFree $dateBasicFree;
  765.         return $this;
  766.     }
  767.     public function getPaypalBillingAgreement(): ?string
  768.     {
  769.         if ($this->paypalBillingAgreement === '0' || $this->paypalBillingAgreement === '') {
  770.             return null;
  771.         }
  772.         return $this->paypalBillingAgreement;
  773.     }
  774.     public function setPaypalBillingAgreement(?string $paypalBillingAgreement): Customer
  775.     {
  776.         $this->paypalBillingAgreement $paypalBillingAgreement;
  777.         return $this;
  778.     }
  779.     /**
  780.      * @return \DateTime|null
  781.      */
  782.     public function getDatePack(): ?\DateTime
  783.     {
  784.         return $this->datePack;
  785.     }
  786.     /**
  787.      * @param \DateTime|null $datePack
  788.      *
  789.      * @return Customer
  790.      */
  791.     public function setDatePack(?\DateTime $datePack): Customer
  792.     {
  793.         $this->datePack $datePack;
  794.         return $this;
  795.     }
  796.     /**
  797.      * @return string|null
  798.      */
  799.     public function getCsvLang(): ?string
  800.     {
  801.         return $this->csvLang;
  802.     }
  803.     /**
  804.      * @param string|null $csvLang
  805.      *
  806.      * @return Customer
  807.      */
  808.     public function setCsvLang(?string $csvLang): Customer
  809.     {
  810.         $this->csvLang $csvLang;
  811.         return $this;
  812.     }
  813.     /**
  814.      * @return string|null
  815.      */
  816.     public function getDropshippingName(): ?string
  817.     {
  818.         return $this->dropshippingName;
  819.     }
  820.     /**
  821.      * @param string|null $dropshippingName
  822.      *
  823.      * @return Customer
  824.      */
  825.     public function setDropshippingName(?string $dropshippingName): Customer
  826.     {
  827.         $this->dropshippingName $dropshippingName;
  828.         return $this;
  829.     }
  830.     /**
  831.      * @return string|null
  832.      */
  833.     public function getEmailPaypal(): ?string
  834.     {
  835.         return $this->emailPaypal;
  836.     }
  837.     /**
  838.      * @param string|null $emailPaypal
  839.      *
  840.      * @return Customer
  841.      */
  842.     public function setEmailPaypal(?string $emailPaypal): Customer
  843.     {
  844.         $this->emailPaypal $emailPaypal;
  845.         return $this;
  846.     }
  847.     /**
  848.      * @return bool|null
  849.      */
  850.     public function getMoroso(): ?bool
  851.     {
  852.         return $this->moroso;
  853.     }
  854.     /**
  855.      * @param bool|null $moroso
  856.      *
  857.      * @return Customer
  858.      */
  859.     public function setMoroso(?bool $moroso): Customer
  860.     {
  861.         $this->moroso $moroso;
  862.         return $this;
  863.     }
  864.     /**
  865.      * @return string|null
  866.      */
  867.     public function getPayerIdPaypal(): ?string
  868.     {
  869.         return $this->payerIdPaypal;
  870.     }
  871.     /**
  872.      * @param string|null $payerIdPaypal
  873.      *
  874.      * @return Customer
  875.      */
  876.     public function setPayerIdPaypal(?string $payerIdPaypal): Customer
  877.     {
  878.         $this->payerIdPaypal $payerIdPaypal;
  879.         return $this;
  880.     }
  881.     /**
  882.      * @return bool
  883.      */
  884.     public function isOrderCsv(): bool
  885.     {
  886.         return $this->orderCsv;
  887.     }
  888.     /**
  889.      * @param bool $orderCsv
  890.      *
  891.      * @return Customer
  892.      */
  893.     public function setOrderCsv(bool $orderCsv): Customer
  894.     {
  895.         $this->orderCsv $orderCsv;
  896.         return $this;
  897.     }
  898.     /**
  899.      * @return bool|null
  900.      */
  901.     public function getExcluirVies(): ?bool
  902.     {
  903.         return $this->excluirVies;
  904.     }
  905.     /**
  906.      * @param bool|null $excluirVies
  907.      *
  908.      * @return Customer
  909.      */
  910.     public function setExcluirVies(?bool $excluirVies): Customer
  911.     {
  912.         $this->excluirVies $excluirVies;
  913.         return $this;
  914.     }
  915.     /**
  916.      * @return \DateTime|null
  917.      */
  918.     public function getDateExcluirIva(): ?\DateTime
  919.     {
  920.         return $this->dateExcluirIva;
  921.     }
  922.     /**
  923.      * @param \DateTime|null $dateExcluirIva
  924.      *
  925.      * @return Customer
  926.      */
  927.     public function setDateExcluirIva(?\DateTime $dateExcluirIva): Customer
  928.     {
  929.         $this->dateExcluirIva $dateExcluirIva;
  930.         return $this;
  931.     }
  932.     /**
  933.      * @return \DateTime|null
  934.      */
  935.     public function getReadPolicyCookies(): ?\DateTime
  936.     {
  937.         return $this->readPolicyCookies;
  938.     }
  939.     /**
  940.      * @param \DateTime|null $readPolicyCookies
  941.      *
  942.      * @return Customer
  943.      */
  944.     public function setReadPolicyCookies(?\DateTime $readPolicyCookies): Customer
  945.     {
  946.         $this->readPolicyCookies $readPolicyCookies;
  947.         return $this;
  948.     }
  949.     public function getPackByPurse(): bool
  950.     {
  951.         return $this->packByPurse;
  952.     }
  953.     public function setPackByPurse(bool $packByPurse): Customer
  954.     {
  955.         $this->packByPurse $packByPurse;
  956.         return $this;
  957.     }
  958.     /**
  959.      * @return int
  960.      */
  961.     public function getPartialCreation(): int
  962.     {
  963.         return $this->partialCreation;
  964.     }
  965.     /**
  966.      * @param int $partialCreation
  967.      *
  968.      * @return Customer
  969.      */
  970.     public function setPartialCreation(int $partialCreation): Customer
  971.     {
  972.         $this->partialCreation $partialCreation;
  973.         return $this;
  974.     }
  975.     /**
  976.      * @return Collection|Order[]
  977.      */
  978.     public function getOrders(): Collection
  979.     {
  980.         return $this->orders;
  981.     }
  982.     public function addOrder(Order $order): self
  983.     {
  984.         if (!$this->orders->contains($order)) {
  985.             $this->orders[] = $order;
  986.             $order->setCustomer($this);
  987.         }
  988.         return $this;
  989.     }
  990.     /**
  991.      * @return Collection|Address[]
  992.      */
  993.     public function getAddresses(): Collection
  994.     {
  995.         return $this->addresses;
  996.     }
  997.     public function addAddress(Address $address): self
  998.     {
  999.         if (!$this->addresses->contains($address)) {
  1000.             $this->addresses[] = $address;
  1001.             $address->setCustomer($this);
  1002.         }
  1003.         return $this;
  1004.     }
  1005.     /**
  1006.      * @return bool|null
  1007.      */
  1008.     public function getPurchaseNotAllowed(): ?bool
  1009.     {
  1010.         return $this->purchaseNotAllowed;
  1011.     }
  1012.     /**
  1013.      * @param bool|null $purchaseNotAllowed
  1014.      *
  1015.      * @return Customer
  1016.      */
  1017.     public function setPurchaseNotAllowed(?bool $purchaseNotAllowed): self
  1018.     {
  1019.         $this->purchaseNotAllowed $purchaseNotAllowed;
  1020.         return $this;
  1021.     }
  1022.     /**
  1023.      * @return FuturePack[]|ArrayCollection
  1024.      */
  1025.     public function getFuturePacks()
  1026.     {
  1027.         return $this->futurePacks;
  1028.     }
  1029.     /**
  1030.      * @param FuturePack[]|ArrayCollection $futurePacks
  1031.      *
  1032.      * @return Customer
  1033.      */
  1034.     public function setFuturePacks($futurePacks)
  1035.     {
  1036.         $this->futurePacks $futurePacks;
  1037.         return $this;
  1038.     }
  1039.     /**
  1040.      * @return SubscriptionLine[]|ArrayCollection
  1041.      */
  1042.     public function getSubscriptionLines()
  1043.     {
  1044.         return $this->subscriptionLines;
  1045.     }
  1046.     /**
  1047.      * @param SubscriptionLine[]|ArrayCollection $subscriptionLines
  1048.      *
  1049.      * @return Customer
  1050.      */
  1051.     public function setSubscriptionLines($subscriptionLines)
  1052.     {
  1053.         $this->subscriptionLines $subscriptionLines;
  1054.         return $this;
  1055.     }
  1056.     /**
  1057.      * @return ServiceCustomer[]|ArrayCollection
  1058.      */
  1059.     public function getServiceCustomer()
  1060.     {
  1061.         return $this->serviceCustomer;
  1062.     }
  1063.     /**
  1064.      * @param array $serviceCustomer
  1065.      */
  1066.     public function setServiceCustomer(array $serviceCustomer): Customer
  1067.     {
  1068.         $this->serviceCustomer $serviceCustomer;
  1069.         return $this;
  1070.     }
  1071.     /**
  1072.      * @return array
  1073.      */
  1074.     public function getCustomerApi(): array
  1075.     {
  1076.         return $this->customerApi;
  1077.     }
  1078.     /**
  1079.      * @param array $customerApi
  1080.      *
  1081.      * @return Customer
  1082.      */
  1083.     public function setCustomerApi(array $customerApi): Customer
  1084.     {
  1085.         $this->customerApi $customerApi;
  1086.         return $this;
  1087.     }
  1088.     /**
  1089.      * @return array
  1090.      */
  1091.     public function getCustomerLog(): array
  1092.     {
  1093.         return $this->customerLog;
  1094.     }
  1095.     /**
  1096.      * @param array $customerLog
  1097.      *
  1098.      * @return Customer
  1099.      */
  1100.     public function setCustomerLog(array $customerLog): Customer
  1101.     {
  1102.         $this->customerLog $customerLog;
  1103.         return $this;
  1104.     }
  1105.     /**
  1106.      * @return array
  1107.      */
  1108.     public function getFtp(): array
  1109.     {
  1110.         return $this->ftp;
  1111.     }
  1112.     /**
  1113.      * @param array $ftp
  1114.      *
  1115.      * @return Customer
  1116.      */
  1117.     public function setFtp(array $ftp): Customer
  1118.     {
  1119.         $this->ftp $ftp;
  1120.         return $this;
  1121.     }
  1122.     /**
  1123.      * @return array
  1124.      */
  1125.     public function getSyncronisedShopConfiguration(): array
  1126.     {
  1127.         return $this->syncronisedShopConfiguration;
  1128.     }
  1129.     /**
  1130.      * @param array $syncronisedShopConfiguration
  1131.      *
  1132.      * @return Customer
  1133.      */
  1134.     public function setSyncronisedShopConfiguration(array $syncronisedShopConfiguration): Customer
  1135.     {
  1136.         $this->syncronisedShopConfiguration $syncronisedShopConfiguration;
  1137.         return $this;
  1138.     }
  1139.     /**
  1140.      * @return array
  1141.      */
  1142.     public function getCustomerMigration(): array
  1143.     {
  1144.         return $this->customerMigration;
  1145.     }
  1146.     /**
  1147.      * @param array $customerMigration
  1148.      *
  1149.      * @return Customer
  1150.      */
  1151.     public function setCustomerMigration(array $customerMigration): Customer
  1152.     {
  1153.         $this->customerMigration $customerMigration;
  1154.         return $this;
  1155.     }
  1156.     /**
  1157.      * @return array
  1158.      */
  1159.     public function getRoles(): array
  1160.     {
  1161.         $roleCollection $this->roles;
  1162.         $roles = [];
  1163.         if ($roleCollection) {
  1164.             foreach ($roleCollection as $role) {
  1165.                 $roleName $role->getName();
  1166.                 if (!$role->isEmployee() && !in_array($roleName$rolestrue)) {
  1167.                     $roles[$role->getId()] = $role->getName();
  1168.                 }
  1169.             }
  1170.         }
  1171.         return $roles;
  1172.     }
  1173.     public function hasRole(string $roleName): bool
  1174.     {
  1175.         return \in_array(\strtoupper($roleName), $this->getRoles(), true);
  1176.     }
  1177.     /**
  1178.      * @return Role[]|ArrayCollection
  1179.      */
  1180.     public function getRoleCollection()
  1181.     {
  1182.         return $this->roles;
  1183.     }
  1184.     /**
  1185.      * @param Role[]|ArrayCollection $roles
  1186.      */
  1187.     public function setRoleCollection(ArrayCollection $roles): Customer
  1188.     {
  1189.         $this->roles $roles;
  1190.         return $this;
  1191.     }
  1192.     /**
  1193.      * @return bool
  1194.      */
  1195.     public function hasMultifactorAuthEnabled(): bool
  1196.     {
  1197.         return $this->multifactorAuthEnabled;
  1198.     }
  1199.     /**
  1200.      * Resets paypal-related fields
  1201.      */
  1202.     public function resetBillingAgreement(): void
  1203.     {
  1204.         $this->setPaypalBillingAgreement(null);
  1205.         $this->setEmailPaypal('');
  1206.         $this->setPayerIdPaypal('');
  1207.     }
  1208.     /**
  1209.      * @param Customer $oldCustomer
  1210.      */
  1211.     public function setPackValuesFromOldCustomer(Customer $oldCustomer): void
  1212.     {
  1213.         $this->group $oldCustomer->getGroup();
  1214.         $this->idPack $oldCustomer->getIdPack();
  1215.         $this->dateCsv $oldCustomer->getDateCsv();
  1216.         $this->datePack $oldCustomer->getDatePack();
  1217.         $this->payerIdPaypal $oldCustomer->getPayerIdPaypal();
  1218.         $this->emailPaypal $oldCustomer->getEmailPaypal();
  1219.         $this->orderCsv $oldCustomer->isOrderCsv();
  1220.     }
  1221.     /**
  1222.      * @param Group $groupReference
  1223.      */
  1224.     public function setValuesAfterMigration(Group $groupReference): void
  1225.     {
  1226.         $this->group $groupReference;
  1227.         $this->idPack Pack::PACK_WITHOUT_PACK;
  1228.         $this->dateCsv null;
  1229.         $this->datePack null;
  1230.         $this->purchaseNotAllowed true;
  1231.     }
  1232.     /**
  1233.      * @return ArrayCollection|CustomerCatalog[]
  1234.      */
  1235.     public function getCustomerCatalogs()
  1236.     {
  1237.         return $this->customerCatalogs;
  1238.     }
  1239.     /**
  1240.      * @param ArrayCollection $customerCatalogs
  1241.      *
  1242.      * @return Customer
  1243.      */
  1244.     public function setCustomerCatalogs($customerCatalogs): self
  1245.     {
  1246.         $this->customerCatalogs $customerCatalogs;
  1247.         return $this;
  1248.     }
  1249.     public function getFullName(): string
  1250.     {
  1251.         return $this->name.' '.$this->surnames;
  1252.     }
  1253.     public function setMultifactorAuthEnabled(bool $multifactorAuthEnabled): void
  1254.     {
  1255.         $this->multifactorAuthEnabled $multifactorAuthEnabled;
  1256.     }
  1257.     public function removeAllAnswers()
  1258.     {
  1259.         $this->additionalInfoAnswers->clear();
  1260.     }
  1261.     public function addAnswers(array $answers): void
  1262.     {
  1263.         /** @var AdditionalInfoAnswer $answer */
  1264.         foreach ($answers as $answer) {
  1265.             if ($answer && !$this->additionalInfoAnswers->contains($answer)) {
  1266.                 $this->additionalInfoAnswers->add($answer);
  1267.             }
  1268.         }
  1269.     }
  1270.     public function getAdyenPaymentId(): ?string
  1271.     {
  1272.         return $this->adyenPaymentId;
  1273.     }
  1274.     public function setAdyenPaymentId(?string $adyenPaymentId): self
  1275.     {
  1276.         $this->adyenPaymentId $adyenPaymentId;
  1277.         return $this;
  1278.     }
  1279.     /**
  1280.      * @return Wishlist[]|ArrayCollection
  1281.      */
  1282.     public function getWishlists()
  1283.     {
  1284.         return $this->wishlists;
  1285.     }
  1286.     public function getThePowerMbaUserId(): ?string
  1287.     {
  1288.         return $this->thePowerMbaUserId;
  1289.     }
  1290.     public function setThePowerMbaUserId(?string $thePowerMbaUserId): self
  1291.     {
  1292.         $this->thePowerMbaUserId $thePowerMbaUserId;
  1293.         return $this;
  1294.     }
  1295.     public function checkInactive(): bool
  1296.     {
  1297.         return str_starts_with($this->emailself::PREFIX_DROP);
  1298.     }
  1299.     public function getGoogleAccountId(): ?string
  1300.     {
  1301.         return $this->googleAccountId;
  1302.     }
  1303.     public function setGoogleAccountId(?string $googleAccountId): Customer
  1304.     {
  1305.         $this->googleAccountId $googleAccountId;
  1306.         return $this;
  1307.     }
  1308.     public function getLinkedinAccountId(): ?string
  1309.     {
  1310.         return $this->linkedinAccountId;
  1311.     }
  1312.     public function setLinkedinAccountId(?string $linkedinAccountId): Customer
  1313.     {
  1314.         $this->linkedinAccountId $linkedinAccountId;
  1315.         return $this;
  1316.     }
  1317.     public function getPackBankwirePayment(): ?bool
  1318.     {
  1319.         return $this->packBankwirePayment;
  1320.     }
  1321.     public function setPackBankwirePayment(bool $packBankwirePayment): Customer
  1322.     {
  1323.         $this->packBankwirePayment $packBankwirePayment;
  1324.         return $this;
  1325.     }
  1326.     public function getForcePasswordUpdate(): ?bool
  1327.     {
  1328.         return $this->forcePasswordUpdate;
  1329.     }
  1330.     public function setForcePasswordUpdate(?bool $forcePasswordUpdate): void
  1331.     {
  1332.         $this->forcePasswordUpdate $forcePasswordUpdate;
  1333.     }
  1334.     public function getHubspotCompanyId(): ?int
  1335.     {
  1336.         return $this->hubspotCompanyId;
  1337.     }
  1338.     public function setHubspotCompanyId(?int $hubspotCompanyId): Customer
  1339.     {
  1340.         $this->hubspotCompanyId $hubspotCompanyId;
  1341.         return $this;
  1342.     }
  1343.     public function getHubspotContactId(): ?int
  1344.     {
  1345.         return $this->hubspotContactId;
  1346.     }
  1347.     public function setHubspotContactId(?int $hubspotContactId): Customer
  1348.     {
  1349.         $this->hubspotContactId $hubspotContactId;
  1350.         return $this;
  1351.     }
  1352.     public function getOrderConfirmationDelay(): ?int
  1353.     {
  1354.         if (null === $this->orderConfirmationDelay) {
  1355.             return null;
  1356.         }
  1357.         if (=== $this->orderConfirmationDelay) { // set by legacy model
  1358.             return null;
  1359.         }
  1360.         return $this->orderConfirmationDelay;
  1361.     }
  1362.     public function setOrderConfirmationDelay(?int $orderConfirmationDelay): void
  1363.     {
  1364.         $this->orderConfirmationDelay $orderConfirmationDelay;
  1365.     }
  1366.     public function getLastAccess(): ?\DateTime
  1367.     {
  1368.         return $this->lastAccess;
  1369.     }
  1370.     public function setLastAccess(?\DateTime $lastAccess): Customer
  1371.     {
  1372.         $this->lastAccess $lastAccess;
  1373.         return $this;
  1374.     }
  1375.     public function __toString(): string
  1376.     {
  1377.         return $this->name.' '.$this->surnames;
  1378.     }
  1379.     public function getStripeReference(): ?string
  1380.     {
  1381.         return $this->stripeReference;
  1382.     }
  1383.     public function setStripeReference(?string $stripeReference): Customer
  1384.     {
  1385.         $this->stripeReference $stripeReference;
  1386.         return $this;
  1387.     }
  1388.     public function getStripeDefaultPaymentMethodReference(): ?string
  1389.     {
  1390.         return $this->stripeDefaultPaymentMethodReference;
  1391.     }
  1392.     public function setStripeDefaultPaymentMethodReference(?string $stripeDefaultPaymentMethodReference): Customer
  1393.     {
  1394.         $this->stripeDefaultPaymentMethodReference $stripeDefaultPaymentMethodReference;
  1395.         return $this;
  1396.     }
  1397. }