src/Flexy/ShopBundle/Entity/Order/Order.php line 50

  1. <?php
  2. namespace App\Flexy\ShopBundle\Entity\Order;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  6. use App\Entity\LogHistory;
  7. use App\Entity\User;
  8. use App\Flexy\ShopBundle\Entity\Accounting\Invoice;
  9. use App\Flexy\ShopBundle\Entity\Customer\Customer;
  10. use App\Flexy\ShopBundle\Entity\Payment\Payment;
  11. use App\Flexy\ShopBundle\Entity\Shipping\Shipment;
  12. use App\Flexy\ShopBundle\Entity\Customer\CustomerWalletPoint;
  13. use App\Flexy\ShopBundle\Entity\Payment\PaymentMethod;
  14. use App\Flexy\ShopBundle\Entity\Promotion\Coupon;
  15. use App\Flexy\ShopBundle\Entity\Shipping\CityRegion;
  16. use App\Flexy\ShopBundle\Entity\Resource\Agent;
  17. use App\Flexy\ShopBundle\Entity\Shipping\ShippingMethod;
  18. use App\Flexy\ShopBundle\Entity\Store\Store;
  19. use App\Flexy\ShopBundle\Entity\Vendor\Vendor;
  20. use App\Flexy\ShopBundle\Repository\Order\OrderRepository;
  21. use Doctrine\Common\Collections\ArrayCollection;
  22. use Doctrine\Common\Collections\Collection;
  23. use Doctrine\DBAL\Types\Types;
  24. use Doctrine\ORM\Mapping as ORM;
  25. use Doctrine\ORM\Mapping\Entity;
  26. use Doctrine\ORM\Mapping\InheritanceType;
  27. use Gedmo\Mapping\Annotation as Gedmo;
  28. use Symfony\Component\Serializer\Annotation\Groups;
  29. use Symfony\Component\Validator\Constraints as Assert;
  30. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  31. #[ApiResource(
  32.     normalizationContext: ['groups' => ['read']],
  33.     denormalizationContext: ['groups' => ['write']],
  34. )]
  35. #[ApiFilter(SearchFilter::class, properties: ['status' => 'exact','customer'=>'exact'])]
  36. #[ORM\Table(name'`order`')]
  37. #[ORM\Entity(repositoryClassOrderRepository::class)]
  38. #[InheritanceType('JOINED')]
  39. #[Gedmo\SoftDeleteable(fieldName'deletedAt'timeAwarefalsehardDeletetrue)]
  40. #[Gedmo\Loggable(logEntryClass:LogHistory::class)]
  41. #[UniqueEntity(
  42.     fields: ['reference'],
  43.     errorPath'reference',
  44.     message'This reference is already exist.',
  45. )]
  46. class Order implements \Stringable
  47. {
  48.     #[ORM\Id]
  49.     #[ORM\GeneratedValue]
  50.     #[ORM\Column(type'integer')]
  51.     #[Groups(['read'])]
  52.     private $id;
  53.     #[Groups(['read'])]
  54.     #[ORM\Column(type'datetime'nullabletrue)]
  55.     private ?\DateTime $createdAt null;
  56.     #[Groups(['read','write'])]
  57.     #[ORM\Column(type'text'nullabletrue)]
  58.     #[Gedmo\Versioned]
  59.     private ?string $description null;
  60.     #[Groups(['read','write'])]
  61.     #[ORM\ManyToOne(targetEntityCustomer::class, inversedBy'orders'cascade: ['persist'])]
  62.     #[Assert\Valid]
  63.     #[Gedmo\Versioned]
  64.     private ?\App\Flexy\ShopBundle\Entity\Customer\Customer $customer null;
  65.     #[Groups(['read','write'])]
  66.     #[ORM\OneToMany(targetEntityOrderItem::class, mappedBy'parentOrder'cascade: ['persist''remove'])]
  67.     #[Assert\Valid]
  68.     
  69.     private \Doctrine\Common\Collections\Collection|array $orderItems;
  70.     
  71.     #[ORM\OneToMany(targetEntityAdjustment::class, mappedBy'parentOrder')]
  72.     private \Doctrine\Common\Collections\Collection|array $adjustments;
  73.     #[ORM\Column(type'string'length255nullabletrue)]
  74.     #[Groups(['read','write'])]
  75.     private ?string $firstName null;
  76.     #[ORM\Column(type'string'length255nullabletrue)]
  77.     #[Groups(['read','write'])]
  78.     private ?string $lastName null;
  79.     #[ORM\Column(type'string'length255nullabletrue)]
  80.     #[Groups(['read','write'])]
  81.     private ?string $companyName null;
  82.     #[ORM\Column(type'string'length255nullabletrue)]
  83.     #[Groups(['read','write'])]
  84.     private ?string $address null;
  85.     #[ORM\Column(type'string'length255nullabletrue)]
  86.     #[Groups(['read','write'])]
  87.     private ?string $city null;
  88.     #[ORM\Column(type'string'length255nullabletrue)]
  89.     #[Groups(['read','write'])]
  90.     private ?string $country null;
  91.     #[ORM\Column(type'string'length255nullabletrue)]
  92.     private ?string $department null;
  93.     #[ORM\Column(type'string'length255nullabletrue)]
  94.     private ?string $postcode null;
  95.     #[ORM\Column(type'string'length255nullabletrue)]
  96.     #[Groups(['read','write'])]
  97.     private ?string $email null;
  98.     #[ORM\Column(type'string'length255nullabletrue)]
  99.     #[Groups(['read','write'])]
  100.     private ?string $tel null;
  101.     #[ORM\Column(type'text'nullabletrue)]
  102.     private ?string $comment null;
  103.     #[ORM\ManyToOne(targetEntityDemandeFund::class, inversedBy'orders')]
  104.     private ?\App\Flexy\ShopBundle\Entity\Order\DemandeFund $demandeFund null;
  105.     #[Groups(['read','write'])]
  106.     #[ORM\Column(type'string'length255nullabletrue)]
  107.     #[Gedmo\Versioned]
  108.     private ?string $status "draft";
  109.     
  110.     #[ORM\Column(type'string'length255nullabletrue)]
  111.     private ?string $source null;
  112.     #[ORM\Column(type'text'nullabletrue)]
  113.     private $deliveryAt;
  114.     #[ORM\Column(type'text'nullabletrue)]
  115.     private $recoveryAt;
  116.     #[ORM\Column(type'string'length255nullabletrue)]
  117.     private ?string $oldOrderNumber null;
  118.     #[ORM\Column(type'float'nullabletrue)]
  119.     private ?float $reduction null;
  120.     #[ORM\Column(type'float'nullabletrue)]
  121.     private $distance 0;
  122.     #[ORM\ManyToOne(targetEntityShippingMethod::class, inversedBy'orders'cascade: ['persist'])]
  123.     #[Groups(['read','write'])]
  124.     #[Gedmo\Versioned]
  125.     private ?\App\Flexy\ShopBundle\Entity\Shipping\ShippingMethod $shippingMethod null;
  126.     #[ORM\ManyToOne(targetEntityAgent::class, inversedBy'orders')]
  127.     #[Groups(['read','write'])]
  128.     #[Gedmo\Versioned]
  129.     private ?\App\Flexy\ShopBundle\Entity\Resource\Agent $agent null;
  130.     #[Groups(['read','write'])]
  131.     #[ORM\ManyToOne(targetEntitypaymentMethod::class, inversedBy'orders'cascade: ['persist'])]
  132.     #[ORM\JoinColumn(nullabletrueonDelete'CASCADE')]
  133.     
  134.     private ?\App\Flexy\ShopBundle\Entity\Payment\PaymentMethod $paymentMethod null;
  135.     #[ORM\Column(type'float'nullabletrue)]
  136.     #[Groups(['read','write'])]
  137.     #[Gedmo\Versioned]
  138.     private ?float $payedAmount null;
  139.     #[ORM\Column(type'datetime'nullabletrue)]
  140.     #[Groups(['read','write'])]
  141.     #[Gedmo\Versioned]
  142.     private ?\DateTimeInterface $startProcessingAt null;
  143.     #[ORM\Column(type'string'length255nullabletrue)]
  144.     private ?string $deliveryType null;
  145.     #[ORM\Column(type'datetime'nullabletrue)]
  146.     #[Groups(['read','write'])]
  147.     #[Gedmo\Versioned]
  148.     private ?\DateTimeInterface $startDeliveryAt null;
  149.     #[ORM\OneToMany(targetEntityCustomerWalletPoint::class, mappedBy'originOrder')]
  150.     private \Doctrine\Common\Collections\Collection|array $customerWalletPoints;
  151.     #[ORM\ManyToOne(targetEntityCoupon::class, inversedBy'orders')]
  152.     #[Groups(['read','write'])]
  153.     private ?\App\Flexy\ShopBundle\Entity\Promotion\Coupon $coupon null;
  154.     #[ORM\ManyToOne(targetEntityAgent::class, inversedBy'ordersToDolist')]
  155.     private ?\App\Flexy\ShopBundle\Entity\Resource\Agent $agentToDo null;
  156.     #[ORM\Column(type'boolean'nullabletrue)]
  157.     private ?bool $isToDo null;
  158.     #[ORM\ManyToOne(targetEntityCityRegion::class, inversedBy'orders')]
  159.     private ?\App\Flexy\ShopBundle\Entity\Shipping\CityRegion $cityRegionShipping null;
  160.     #[ORM\ManyToOne(targetEntityCityRegion::class, inversedBy'collectedOrders')]
  161.     private $cityRegionCollect;
  162.     #[ORM\ManyToOne(targetEntityVendor::class, inversedBy'orders')]
  163.     private ?\App\Flexy\ShopBundle\Entity\Vendor\Vendor $vendor null;
  164.     #[ORM\Column(type'text'nullabletrue)]
  165.     #[Groups(['read','write'])]
  166.     private ?string $collectAddress null;
  167.     #[ORM\Column(type'text'nullabletrue)]
  168.     #[Groups(['read','write'])]
  169.     private ?string $shippingAddress null;
  170.     #[ORM\Column(type'string'length255nullabletrue)]
  171.     #[Groups(['read','write'])]
  172.     private ?string $collectTel null;
  173.     #[ORM\Column(type'boolean'nullabletrue)]
  174.     #[Groups(['read','write'])]
  175.     private ?bool $isHeavy null;
  176.     #[ORM\Column(type'float'nullabletrue)]
  177.     private $shippingTips 0;
  178.      #[ORM\Column(type'float'nullabletrue)]
  179.     private $walletPaymentAmount 0;
  180.     #[ORM\Column(type'boolean'nullabletrue)]
  181.     private $isChecked;
  182.     #[ORM\Column(type'string'length255nullabletrue)]
  183.     private $tokenStripe;
  184.     #[ORM\Column(length255nullabletrue)]
  185.     private ?string $orderType "order";
  186.     #[ORM\Column(nullabletrue)]
  187.     private ?\DateTimeImmutable $deletedAt null;
  188.     #[ORM\ManyToOne(inversedBy'orders')]
  189.     private ?Store $store null;
  190.     #[ORM\OneToOne(inversedBy'relatedOrder'cascade: ['persist''remove'])]
  191.     private ?Shipment $shipment null;
  192.     #[ORM\ManyToOne(inversedBy'orders')]
  193.     private ?Invoice $invoice null;
  194.     #[ORM\Column(typeTypes::STRING,nullabletrue)]
  195.     #[Gedmo\Blameable(on'create')]
  196.     private $createdBy;
  197.     #[ORM\OneToMany(mappedBy'relatedOrder'targetEntityPayment::class,cascade:["persist"])]
  198.     private Collection $payments;
  199.     #[ORM\Column(length255nullabletrue,unique:true)]
  200.     private ?string $reference null;
  201.     #[ORM\ManyToOne(inversedBy'orders',cascade:["persist"])]
  202.     #[ORM\JoinColumn(name"cash_box_order_id"referencedColumnName"id"onDelete"SET NULL")]
  203.     private ?CashBoxOrder $cashBoxOrder null;
  204.     
  205.      #[ORM\Column(nullabletrue)]
  206.     private ?bool $is_multiclub null;
  207.      #[ORM\Column(nullabletrue)]
  208.     private ?bool $is_local null;
  209.      
  210.     private ?string $accessChoice null;
  211.     public function __construct()
  212.     {
  213.         $this->orderItems = new ArrayCollection();
  214.         $this->adjustments = new ArrayCollection();
  215.         $this->createdAt = new \DateTime();
  216.         $this->customerWalletPoints = new ArrayCollection();
  217.         $this->payments = new ArrayCollection();
  218.         
  219.     }
  220.    
  221.     public function __toString(): string
  222.     {
  223.         return $this->getOrderNumber();
  224.     }
  225.     public function getId(): ?int
  226.     {
  227.         return $this->id;
  228.     }
  229.     #[Groups(['read'])]
  230.     public function getOrderNumber($secondaryPrefix=null)
  231.     {
  232.         $prefix "";
  233.         
  234.         $orderNumber $prefix.$this->createdAt->format("ym").str_pad((string) $this->id5"0"STR_PAD_LEFT);
  235.         if($secondaryPrefix){
  236.             $orderNumber $prefix.$this->createdAt->format("ym").str_pad((string) $this->id5"0"STR_PAD_LEFT)."-".$secondaryPrefix;
  237.         }
  238.         if($this->reference){
  239.             return $this->reference;
  240.         }
  241.         return $orderNumber;
  242.     }
  243.     #[Groups(['read'])]
  244.     public function getIdPrefixed()
  245.     {
  246.         return $this->getOrderNumber();
  247.     }
  248.     public function getCreatedAt(): ?\DateTime
  249.     {
  250.         return $this->createdAt;
  251.     }
  252.     public function setCreatedAt(?\DateTime $createdAt): self
  253.     {
  254.         $this->createdAt $createdAt;
  255.         return $this;
  256.     }
  257.     public function getCustomer(): ?Customer
  258.     {
  259.         return $this->customer;
  260.     }
  261.     public function setCustomer(?Customer $customer): self
  262.     {
  263.         $this->customer $customer;
  264.         return $this;
  265.     }
  266.     public function getCategoriesProduct(){
  267.         $categories = [];
  268.         foreach($this->getOrderItems() as $singleOrderItem){
  269.             if($singleOrderItem->getProduct()){
  270.                 if($singleOrderItem->getProduct()->getParentCategory()){
  271.                     $categories[] = $singleOrderItem->getProduct()->getParentCategory()->getName();
  272.                 }
  273.                 
  274.             }
  275.         }
  276.         return $categories;
  277.     }
  278.     public function getSubCategoriesProduct(){
  279.         $categories = [];
  280.         foreach($this->getOrderItems() as $singleOrderItem){
  281.             if($singleOrderItem->getProduct()){
  282.                 foreach($singleOrderItem->getProduct()->getCategoriesProduct() as $singleCategory){
  283.                     if(!in_array($singleCategory->getName(),$categories)){
  284.                         $categories[] = $singleCategory->getName();
  285.                     }
  286.                     
  287.                 }
  288.                 
  289.             }
  290.         }
  291.         return $categories;
  292.     }
  293.     /**
  294.      * @return Collection|OrderItem[]
  295.      */
  296.     public function getOrderItems(): Collection
  297.     {
  298.         return $this->orderItems;
  299.     }
  300.     public function addOrderItem(OrderItem $orderItem): self
  301.     {
  302.         if (!$this->orderItems->contains($orderItem)) {
  303.             $this->orderItems[] = $orderItem;
  304.             $orderItem->setParentOrder($this);
  305.         }
  306.         return $this;
  307.     }
  308.     public function removeOrderItem(OrderItem $orderItem): self
  309.     {
  310.         if ($this->orderItems->removeElement($orderItem)) {
  311.             // set the owning side to null (unless already changed)
  312.             if ($orderItem->getParentOrder() === $this) {
  313.                 $orderItem->setParentOrder(null);
  314.             }
  315.         }
  316.         return $this;
  317.     }
  318.     /**
  319.      * @return Collection|Adjustment[]
  320.      */
  321.     public function getAdjustments(): Collection
  322.     {
  323.         return $this->adjustments;
  324.     }
  325.     public function addAdjustment(Adjustment $adjustment): self
  326.     {
  327.         if (!$this->adjustments->contains($adjustment)) {
  328.             $this->adjustments[] = $adjustment;
  329.             $adjustment->setParentOrder($this);
  330.         }
  331.         return $this;
  332.     }
  333.     public function removeAdjustment(Adjustment $adjustment): self
  334.     {
  335.         if ($this->adjustments->removeElement($adjustment)) {
  336.             // set the owning side to null (unless already changed)
  337.             if ($adjustment->getParentOrder() === $this) {
  338.                 $adjustment->setParentOrder(null);
  339.             }
  340.         }
  341.         return $this;
  342.     }
  343.     public function getReductionOnCoupon(){
  344.         $reductionCoupon=0;
  345.         if($this->getCoupon()){
  346.             if($this->getCoupon()->getTypeReduction()=="percent"){
  347.                 $reductionCoupon = ($this->getTotalAmount()/100)*$this->getCoupon()->getValueReduction();
  348.             }else{
  349.                 $reductionCoupon $this->getCoupon()->getValueReduction();
  350.             }
  351.         }
  352.         return  $reductionCoupon;
  353.     }
  354.     public function getFirstName(): ?string
  355.     {
  356.         return $this->firstName;
  357.     }
  358.     public function setFirstName(string $firstName): self
  359.     {
  360.         $this->firstName $firstName;
  361.         return $this;
  362.     }
  363.     public function getLastName(): ?string
  364.     {
  365.         return $this->lastName;
  366.     }
  367.     public function setLastName(string $lastName): self
  368.     {
  369.         $this->lastName $lastName;
  370.         return $this;
  371.     }
  372.     public function getCompanyName(): ?string
  373.     {
  374.         return $this->companyName;
  375.     }
  376.     public function setCompanyName(?string $companyName): self
  377.     {
  378.         $this->companyName $companyName;
  379.         return $this;
  380.     }
  381.     public function getAddress(): ?string
  382.     {
  383.         return $this->address;
  384.     }
  385.     public function setAddress(string $address): self
  386.     {
  387.         $this->address $address;
  388.         return $this;
  389.     }
  390.     public function getCity(): ?string
  391.     {
  392.         return $this->city;
  393.     }
  394.     public function setCity(string $city): self
  395.     {
  396.         $this->city $city;
  397.         return $this;
  398.     }
  399.     public function getCountry(): ?string
  400.     {
  401.         return $this->country;
  402.     }
  403.     public function setCountry(string $country): self
  404.     {
  405.         $this->country $country;
  406.         return $this;
  407.     }
  408.     public function getDepartment(): ?string
  409.     {
  410.         return $this->department;
  411.     }
  412.     public function setDepartment(?string $department): self
  413.     {
  414.         $this->department $department;
  415.         return $this;
  416.     }
  417.     public function getPostcode(): ?string
  418.     {
  419.         return $this->postcode;
  420.     }
  421.     public function setPostcode(?string $postcode): self
  422.     {
  423.         $this->postcode $postcode;
  424.         return $this;
  425.     }
  426.     public function getEmail(): ?string
  427.     {
  428.         return $this->email;
  429.     }
  430.     public function setEmail(string $email): self
  431.     {
  432.         $this->email $email;
  433.         return $this;
  434.     }
  435.     public function getTel(): ?string
  436.     {
  437.         return $this->tel;
  438.     }
  439.     public function setTel(string $tel): self
  440.     {
  441.         $this->tel $tel;
  442.         return $this;
  443.     }
  444.     public function getComment(): ?string
  445.     {
  446.         return $this->comment;
  447.     }
  448.     public function setComment(?string $comment): self
  449.     {
  450.         $this->comment $comment;
  451.         return $this;
  452.     }
  453.   
  454.     #[Groups(['read'])]
  455.     public function getTotalAmount(){
  456.         $total=0;
  457.         foreach($this->orderItems as $singleOrderItem){
  458.             $total $total + ($singleOrderItem->getTotalAmount());
  459.         }
  460.         return $total;
  461.         
  462.     }
  463.     //needs optimisation
  464.     #[Groups(['read'])]
  465.     public function getShippingFees(){
  466.         $fees 0;
  467.         if($this->getShippingMethod()){
  468.             if($this->getShippingMethod()->isIsSeparatelyCalculated()){
  469.                 $fees $this->getShippingMethod()->getPrice();
  470.             
  471.                 foreach($this->getShippingMethod()->getShippingRules() as $shippingRule){
  472.     
  473.     
  474.                     if($shippingRule->getTypeCalculation() == "distance"){
  475.                         if( $shippingRule->getMin() < $this->getDistance()  and   $shippingRule->getMax() >= $this->getDistance() ){
  476.                             $fees =  $this->getDistance() * $shippingRule->getValueCalculation();
  477.     
  478.                             /*Condition for TLCS may be it works for all people*/
  479.                             if ($fees $this->getShippingMethod()->getPrice()){
  480.                                 $fees $this->getShippingMethod()->getPrice();
  481.                             }
  482.                             /*Condition for TLCS may be it works for all people*/
  483.                         }
  484.                         
  485.                     }
  486.                         else{
  487.                             if(
  488.                             $shippingRule->getMin() < $this->getTotalAmount() and $shippingRule->getMax() >=  $this->getTotalAmount()
  489.                             
  490.                             ){
  491.                                 if($shippingRule->getTypeCalculation() == "percent"){
  492.                                     $fees = ($this->getTotalAmount() / 100 ) * $shippingRule->getValueCalculation();
  493.                                 }
  494.                                 else{
  495.                                     $fees =  $shippingRule->getValueCalculation();
  496.                                 }
  497.                             }
  498.                         
  499.                     }
  500.     
  501.                     
  502.                 }
  503.             }
  504.             
  505.         }
  506.     
  507.         
  508.         
  509.         return $fees;
  510.     }
  511.     #[Groups(['read'])]
  512.     public function getTotalReduction(){
  513.         $total=0;
  514.         
  515.         foreach($this->orderItems as $singleOrderItem){
  516.             $total $total + ($singleOrderItem->getReduction());
  517.         }
  518.         return $total;
  519.     }
  520.     public function getReductionOnTotal(){
  521.         $reductionAmount 0;
  522.         
  523.         if($this->getReduction() and $this->getReduction()>0){
  524.             $reductionAmount = ($this->getTotalAmount() / 100) * $this->getReduction();
  525.         }
  526.         return $reductionAmount;
  527.     }
  528.     #[Groups(['read'])]
  529.     public function getAmountPayedByCredit(){
  530.         $total=0;
  531.         foreach($this->getCustomerWalletPoints() as $singleWalletPoints){
  532.             if($singleWalletPoints->getPoints()<0){
  533.                 $total $total + ($singleWalletPoints->getPoints());
  534.             }
  535.             
  536.         }
  537.         return $total;
  538.     }
  539.     #[Groups(['read'])]
  540.     public function getAmountEarnedAsCredit(){
  541.         $total=0;
  542.         foreach($this->getCustomerWalletPoints() as $singleWalletPoints){
  543.             if($singleWalletPoints->getPoints()>0){
  544.                 $total $total + ($singleWalletPoints->getPoints());
  545.             }
  546.             
  547.         }
  548.         return $total;
  549.     }
  550.     public function getDemandeFund(): ?DemandeFund
  551.     {
  552.         return $this->demandeFund;
  553.     }
  554.     public function setDemandeFund(?DemandeFund $demandeFund): self
  555.     {
  556.         $this->demandeFund $demandeFund;
  557.         return $this;
  558.     }
  559.     public function getStatus(): ?string
  560.     {
  561.         $status "order_finance_verification_pending";
  562.         if($this->status)
  563.         {
  564.             $status $this->status;
  565.         }
  566.         return $status;
  567.     }
  568.     public function setStatus(?string $status): self
  569.     {
  570.         $this->status $status;
  571.         return $this;
  572.     }
  573.     // BySamir : TO CLEAN
  574.  
  575.     public function getSource(): ?string
  576.     {
  577.         return $this->source;
  578.     }
  579.     public function setSource(?string $source): self
  580.     {
  581.         $this->source $source;
  582.         return $this;
  583.     }
  584.     public function getDeliveryAt()
  585.     {
  586.         return $this->deliveryAt;
  587.     }
  588.     public function setDeliveryAt($deliveryAt)
  589.     {
  590.         $this->deliveryAt $deliveryAt;
  591.         return $this;
  592.     }
  593.     public function getRecoveryAt()
  594.     {
  595.         return $this->recoveryAt;
  596.     }
  597.     public function setRecoveryAt($recoveryAt)
  598.     {
  599.         $this->recoveryAt $recoveryAt;
  600.         return $this;
  601.     }
  602.     public function getReduction(): ?float
  603.     {
  604.         return $this->reduction;
  605.     }
  606.     public function setReduction(?float $reduction): self
  607.     {
  608.         $this->reduction $reduction;
  609.         return $this;
  610.     }
  611.     public function getShippingMethod(): ?ShippingMethod
  612.     {
  613.         return $this->shippingMethod;
  614.     }
  615.     public function setShippingMethod(?ShippingMethod $shippingMethod): self
  616.     {
  617.         $this->shippingMethod $shippingMethod;
  618.         return $this;
  619.     }
  620.     public function getAgent(): ?Agent
  621.     {
  622.         return $this->agent;
  623.     }
  624.     public function setAgent(?Agent $agent): self
  625.     {
  626.         $this->agent $agent;
  627.         return $this;
  628.     }
  629.     public function getPaymentMethod(): ?paymentMethod
  630.     {
  631.         return $this->paymentMethod;
  632.     }
  633.     public function setPaymentMethod(?paymentMethod $paymentMethod): self
  634.     {
  635.         $this->paymentMethod $paymentMethod;
  636.         return $this;
  637.     }
  638.     public function getPayedAmount(): ?float
  639.     {
  640.         return $this->payedAmount;
  641.     }
  642.     public function setPayedAmount(?float $payedAmount): self
  643.     {
  644.         $this->payedAmount $payedAmount;
  645.         return $this;
  646.     }
  647.     public function getStartProcessingAt(): ?\DateTimeInterface
  648.     {
  649.         return $this->startProcessingAt;
  650.     }
  651.     public function setStartProcessingAt(?\DateTimeInterface $startProcessingAt): self
  652.     {
  653.         $this->startProcessingAt $startProcessingAt;
  654.         return $this;
  655.     }
  656.     public function getDeliveryType(): ?string
  657.     {
  658.         return $this->deliveryType;
  659.     }
  660.     public function setDeliveryType(?string $deliveryType): self
  661.     {
  662.         $this->deliveryType $deliveryType;
  663.         return $this;
  664.     }
  665.     public function getStartDeliveryAt(): ?\DateTimeInterface
  666.     {
  667.         return $this->startDeliveryAt;
  668.     }
  669.     public function setStartDeliveryAt(?\DateTimeInterface $startDeliveryAt): self
  670.     {
  671.         $this->startDeliveryAt $startDeliveryAt;
  672.         return $this;
  673.     }
  674.     /**
  675.      * @return Collection<int, CustomerWalletPoint>
  676.      */
  677.     public function getCustomerWalletPoints(): Collection
  678.     {
  679.         return $this->customerWalletPoints;
  680.     }
  681.     public function addCustomerWalletPoint(CustomerWalletPoint $customerWalletPoint): self
  682.     {
  683.         if (!$this->customerWalletPoints->contains($customerWalletPoint)) {
  684.             $this->customerWalletPoints[] = $customerWalletPoint;
  685.             $customerWalletPoint->setOriginOrder($this);
  686.         }
  687.         return $this;
  688.     }
  689.     public function removeCustomerWalletPoint(CustomerWalletPoint $customerWalletPoint): self
  690.     {
  691.         if ($this->customerWalletPoints->removeElement($customerWalletPoint)) {
  692.             // set the owning side to null (unless already changed)
  693.             if ($customerWalletPoint->getOriginOrder() === $this) {
  694.                 $customerWalletPoint->setOriginOrder(null);
  695.             }
  696.         }
  697.         return $this;
  698.     }
  699.     public function getCoupon(): ?Coupon
  700.     {
  701.         return $this->coupon;
  702.     }
  703.     public function setCoupon(?Coupon $coupon): self
  704.     {
  705.         $this->coupon $coupon;
  706.         return $this;
  707.     }
  708.     public function getAgentToDo(): ?Agent
  709.     {
  710.         return $this->agentToDo;
  711.     }
  712.     public function setAgentToDo(?Agent $agentToDo): self
  713.     {
  714.         $this->agentToDo $agentToDo;
  715.         return $this;
  716.     }
  717.     public function getIsToDo(): ?bool
  718.     {
  719.         return $this->isToDo;
  720.     }
  721.     public function setIsToDo(?bool $isToDo): self
  722.     {
  723.         $this->isToDo $isToDo;
  724.         return $this;
  725.     }
  726.     public function getCityRegionShipping(): ?CityRegion
  727.     {
  728.         return $this->cityRegionShipping;
  729.     }
  730.     public function setCityRegionShipping(?CityRegion $cityRegionShipping): self
  731.     {
  732.         $this->cityRegionShipping $cityRegionShipping;
  733.         return $this;
  734.     }
  735.     public function getVendor(): ?Vendor
  736.     {
  737.         return $this->vendor;
  738.     }
  739.     public function setVendor(?Vendor $vendor): self
  740.     {
  741.         $this->vendor $vendor;
  742.         return $this;
  743.     }
  744.     public function getCollectAddress(): ?string
  745.     {
  746.         return $this->collectAddress;
  747.     }
  748.     public function setCollectAddress(?string $collectAddress): self
  749.     {
  750.         $this->collectAddress $collectAddress;
  751.         return $this;
  752.     }
  753.     public function getCollectTel(): ?string
  754.     {
  755.         return $this->collectTel;
  756.     }
  757.     public function setCollectTel(?string $collectTel): self
  758.     {
  759.         $this->collectTel $collectTel;
  760.         return $this;
  761.     }
  762.     public function getIsHeavy(): ?bool
  763.     {
  764.         return $this->isHeavy;
  765.     }
  766.     public function setIsHeavy(?bool $isHeavy): self
  767.     {
  768.         $this->isHeavy $isHeavy;
  769.         return $this;
  770.     }
  771.     public function getShippingTips(): ?float
  772.     {
  773.         return $this->shippingTips;
  774.     }
  775.     public function setShippingTips(?float $shippingTips): self
  776.     {
  777.         $this->shippingTips $shippingTips;
  778.         return $this;
  779.     }
  780.  
  781.     
  782.     /**
  783.      * Get the value of isChecked
  784.      */ 
  785.     public function getIsChecked()
  786.     {
  787.         return $this->isChecked;
  788.     }
  789.     /**
  790.      * Set the value of isChecked
  791.      *
  792.      * @return  self
  793.      */ 
  794.     public function setIsChecked($isChecked)
  795.     {
  796.         $this->isChecked $isChecked;
  797.         return $this;
  798.     }
  799.     /**
  800.      * Get the value of walletPaymentAmount
  801.      */ 
  802.     public function getWalletPaymentAmount()
  803.     {
  804.         return $this->walletPaymentAmount;
  805.     }
  806.     /**
  807.      * Set the value of walletPaymentAmount
  808.      *
  809.      * @return  self
  810.      */ 
  811.     public function setWalletPaymentAmount($walletPaymentAmount)
  812.     {
  813.         $this->walletPaymentAmount $walletPaymentAmount;
  814.         return $this;
  815.     }
  816.     /**
  817.      * Get the value of cityRegionCollect
  818.      */ 
  819.     public function getCityRegionCollect()
  820.     {
  821.         return $this->cityRegionCollect;
  822.     }
  823.     /**
  824.      * Set the value of cityRegionCollect
  825.      *
  826.      * @return  self
  827.      */ 
  828.     public function setCityRegionCollect($cityRegionCollect)
  829.     {
  830.         $this->cityRegionCollect $cityRegionCollect;
  831.         return $this;
  832.     }
  833.     /**
  834.      * Get the value of distance
  835.      */ 
  836.     public function getDistance()
  837.     {
  838.         return $this->distance;
  839.     }
  840.     /**
  841.      * Set the value of distance
  842.      *
  843.      * @return  self
  844.      */ 
  845.     public function setDistance($distance)
  846.     {
  847.         $this->distance $distance;
  848.         return $this;
  849.     }
  850.     /**
  851.      * Get the value of tokenStripe
  852.      */ 
  853.     public function getTokenStripe()
  854.     {
  855.         return $this->tokenStripe;
  856.     }
  857.     /**
  858.      * Set the value of tokenStripe
  859.      *
  860.      * @return  self
  861.      */ 
  862.     public function setTokenStripe($tokenStripe)
  863.     {
  864.         $this->tokenStripe $tokenStripe;
  865.         return $this;
  866.     }
  867.     public function getOrderType(): ?string
  868.     {
  869.         return $this->orderType;
  870.     }
  871.     public function setOrderType(?string $orderType): self
  872.     {
  873.         $this->orderType $orderType;
  874.         return $this;
  875.     }
  876.     /**
  877.      * Get the value of deletedAt
  878.      */ 
  879.     public function getDeletedAt()
  880.     {
  881.         return $this->deletedAt;
  882.     }
  883.     /**
  884.      * Set the value of deletedAt
  885.      *
  886.      * @return  self
  887.      */ 
  888.     public function setDeletedAt($deletedAt)
  889.     {
  890.         $this->deletedAt $deletedAt;
  891.         return $this;
  892.     }
  893.     public function getStore(): ?Store
  894.     {
  895.         return $this->store;
  896.     }
  897.     public function setStore(?Store $store): self
  898.     {
  899.         $this->store $store;
  900.         return $this;
  901.     }
  902.     public function getShipment(): ?Shipment
  903.     {
  904.         return $this->shipment;
  905.     }
  906.     public function setShipment(?Shipment $shipment): self
  907.     {
  908.         $this->shipment $shipment;
  909.         return $this;
  910.     }
  911.     public function getInvoice(): ?Invoice
  912.     {
  913.         return $this->invoice;
  914.     }
  915.     public function setInvoice(?Invoice $invoice): self
  916.     {
  917.         $this->invoice $invoice;
  918.         return $this;
  919.     }
  920.     /**
  921.      * Get the value of shippingAddress
  922.      */ 
  923.     public function getShippingAddress()
  924.     {
  925.         return $this->shippingAddress;
  926.     }
  927.     /**
  928.      * Set the value of shippingAddress
  929.      *
  930.      * @return  self
  931.      */ 
  932.     public function setShippingAddress($shippingAddress)
  933.     {
  934.         $this->shippingAddress $shippingAddress;
  935.         return $this;
  936.     }
  937.     public function getCreatedBy()
  938.     {
  939.         return $this->createdBy;
  940.     }
  941.     public function getDescription(): ?string
  942.     {
  943.         return $this->description;
  944.     }
  945.     public function setDescription(?string $description): self
  946.     {
  947.         $this->description $description;
  948.         return $this;
  949.     }
  950.     /**
  951.      * @return Collection<int, Payment>
  952.      */
  953.     public function getPayments(): Collection
  954.     {
  955.         return $this->payments;
  956.     }
  957.     public function addPayment(Payment $payment): self
  958.     {
  959.         if (!$this->payments->contains($payment)) {
  960.             $this->payments->add($payment);
  961.             $payment->setRelatedOrder($this);
  962.         }
  963.         return $this;
  964.     }
  965.     public function removePayment(Payment $payment): self
  966.     {
  967.         if ($this->payments->removeElement($payment)) {
  968.             // set the owning side to null (unless already changed)
  969.             if ($payment->getRelatedOrder() === $this) {
  970.                 $payment->setRelatedOrder(null);
  971.             }
  972.         }
  973.         return $this;
  974.     }
  975.     public function getReference(): ?string
  976.     {
  977.         return $this->reference;
  978.     }
  979.     public function setReference(?string $reference): self
  980.     {
  981.         $this->reference $reference;
  982.         return $this;
  983.     }
  984.     public function getCashBoxOrder(): ?CashBoxOrder
  985.     {
  986.         return $this->cashBoxOrder;
  987.     }
  988.     public function setCashBoxOrder(?CashBoxOrder $cashBoxOrder): self
  989.     {
  990.         $this->cashBoxOrder $cashBoxOrder;
  991.         return $this;
  992.     }
  993.     
  994.      public function isIsMulticlub(): ?bool
  995.     {
  996.         return $this->is_multiclub;
  997.     }
  998.     public function setIsMulticlub(?bool $is_multiclub): static
  999.     {
  1000.         $this->is_multiclub $is_multiclub;
  1001.        if ($is_multiclub) {
  1002.         $this->is_local false;
  1003.     }
  1004.     return $this;
  1005.     }
  1006.     public function isIsLocal(): ?bool
  1007.     {
  1008.         return $this->is_local;
  1009.     }
  1010.     public function setIsLocal(?bool $is_local): static
  1011.     {
  1012.         $this->is_local $is_local;
  1013.         if ($is_local) {
  1014.         $this->is_multiclub false;
  1015.       }
  1016.     return $this;
  1017.     }
  1018.     
  1019.     
  1020.         public function getAccessChoice(): string
  1021.     {
  1022.         if ($this->is_multiclub) {
  1023.             return 'multiclub';
  1024.         }
  1025.     
  1026.         return 'local';
  1027.     }
  1028.     
  1029.     public function setAccessChoice(?string $accessChoice): self
  1030.     {
  1031.         $this->accessChoice $accessChoice;
  1032.     
  1033.         if ($accessChoice === 'multiclub') {
  1034.             $this->is_multiclub true;
  1035.             $this->is_local false;
  1036.         } else {
  1037.             $this->is_local true;
  1038.             $this->is_multiclub false;
  1039.         }
  1040.     
  1041.         return $this;
  1042.     }
  1043. }