src/Entity/Order.php line 29

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Knp\DoctrineBehaviors\Contract\Entity\SoftDeletableInterface;
  4. use Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletableTrait;
  5. use Knp\DoctrineBehaviors\Model\Blameable\BlameableTrait;
  6. use Knp\DoctrineBehaviors\Contract\Entity\BlameableInterface;
  7. use Knp\DoctrineBehaviors\Model\Timestampable\TimestampableTrait;
  8. use Knp\DoctrineBehaviors\Contract\Entity\TimestampableInterface;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use Symfony\Component\Validator\Constraints as Assert;
  13. use Symfony\Component\HttpFoundation\File\UploadedFile;
  14. use Symfony\Component\HttpFoundation\File\File;
  15. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  16. /**
  17.  * @ORM\Entity
  18.  * @ORM\Table(name="orders")
  19.  */
  20. class Order implements BlameableInterfaceTimestampableInterfaceSoftDeletableInterface  {
  21.     use BlameableTrait;
  22.     use TimestampableTrait;
  23.     
  24.     use SoftDeletableTrait;
  25.     
  26. /**
  27.      * @ORM\Id
  28.      * @ORM\Column(type="integer")
  29.      * @ORM\GeneratedValue(strategy="AUTO")
  30.      */
  31.     protected $id;
  32.     /**
  33.      * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="orders")
  34.      */
  35.     private $user;
  36.     /**
  37.      * @ORM\ManyToOne(targetEntity="App\Entity\Cart")
  38.      */
  39.     private $cart;
  40.     /**
  41.      * @ORM\ManyToOne(targetEntity="App\Entity\DeliveryCountry")
  42.      */
  43.     private $deliveryCountry;
  44.     /**
  45.      * @ORM\ManyToOne(targetEntity="App\Entity\DeliveryMethod")
  46.      */
  47.     private $deliveryMethod;
  48.     /**
  49.      * @ORM\ManyToOne(targetEntity="App\Entity\PaymentMethod")
  50.      */
  51.     private $paymentMethod;
  52.     /**
  53.      * @ORM\ManyToOne(targetEntity="App\Entity\RebateCode", cascade={"all"}, inversedBy="orders")
  54.      */
  55.     private $rebateCode;
  56.     /**
  57.      * @ORM\ManyToOne(targetEntity="App\Entity\OrderStatus")
  58.      */
  59.     private $status;
  60.     /**
  61.      * @Doctrine\ORM\Mapping\Column(name="total_cost", type="decimal", precision=10, scale=2, nullable=true)
  62.      */
  63.     protected $totalCost;
  64.     /**
  65.      * @Doctrine\ORM\Mapping\Column(name="total_cost_no_rebate", type="decimal", precision=10, scale=2, nullable=true)
  66.      */
  67.     protected $totalCostNoRebate;
  68.     /**
  69.      * @Doctrine\ORM\Mapping\Column(name="shipping_cost", type="decimal", precision=10, scale=2, nullable=true)
  70.      */
  71.     protected $shippingCost;
  72.     /**
  73.      * @var string
  74.      *
  75.      * @ORM\Column(name="tracking_number", type="string", length=40, nullable=true)
  76.      */
  77.     private $trackingNumber;
  78.     /**
  79.      * @var string
  80.      *
  81.      * @ORM\Column(name="dotpay_number", type="string", length=40, nullable=true)
  82.      */
  83.     private $dotpayNumber;
  84.     /**
  85.      * @var string
  86.      *
  87.      * @ORM\Column(name="gopay", type="string", length=40, nullable=true)
  88.      */
  89.     private $gopay;
  90.     /**
  91.      * @var string
  92.      *
  93.      * @ORM\Column(name="session", type="string", length=40, nullable=true)
  94.      */
  95.     private $session;
  96.     /**
  97.      * @var string
  98.      *
  99.      * @ORM\Column(name="code", type="string", length=40, nullable=true)
  100.      */
  101.     private $code;
  102.     /**
  103.      * @var string
  104.      *
  105.      * @ORM\Column(name="notes", type="text", nullable=true)
  106.      */
  107.     private $notes;
  108.     /**
  109.      * @var string
  110.      *
  111.      * @ORM\Column(name="email", type="string", length=255, nullable=true)
  112.      */
  113.     private $email;
  114.     /**
  115.      * @var string
  116.      *
  117.      * @ORM\Column(name="phone", type="string", length=255, nullable=true)
  118.      */
  119.     private $phone;
  120.     /**
  121.      * @var string
  122.      *
  123.      * @ORM\Column(name="ip", type="string", length=40, nullable=true)
  124.      */
  125.     private $ip;
  126.     /**
  127.      * @var string
  128.      *
  129.      * @ORM\Column(name="user_agent", type="text", nullable=true)
  130.      */
  131.     private $userAgent;
  132.     /**
  133.      * @var string
  134.      *
  135.      * @ORM\Column(name="rebate_code_content", type="string", length=255, nullable=true)
  136.      */
  137.     private $rebateCodeContent;
  138.     /**
  139.      * @ORM\OneToMany(targetEntity="App\Entity\OrderProduct", mappedBy="order", cascade={"all"})
  140.      * @Doctrine\ORM\Mapping\OrderBy({"id" = "DESC"})
  141.      */
  142.     protected $products;
  143.     /**
  144.      * @ORM\ManyToOne(targetEntity="App\Entity\Currency")
  145.      */
  146.     private $currency;
  147.     /**
  148.      * @ORM\ManyToOne(targetEntity="App\Entity\Language")
  149.      */
  150.     private $language;
  151.     /**
  152.      * @ORM\ManyToOne(targetEntity="App\Entity\Address", cascade={"all"})
  153.      * @ORM\JoinColumn(name="address_id", referencedColumnName="id", onDelete="CASCADE")
  154.      */
  155.     protected $address;
  156.     /**
  157.      * @ORM\ManyToOne(targetEntity="App\Entity\Address", cascade={"all"})
  158.      * @ORM\JoinColumn(name="invoice_address_id", referencedColumnName="id", onDelete="CASCADE")
  159.      */
  160.     protected $invoiceAddress;
  161.     /**
  162.      * @ORM\ManyToOne(targetEntity="App\Entity\Address", cascade={"all"})
  163.      * @ORM\JoinColumn(name="delivery_address_id", referencedColumnName="id", onDelete="CASCADE")
  164.      */
  165.     protected $deliveryAddress;
  166.     /**
  167.      * @Doctrine\ORM\Mapping\Column(type="boolean", name="paid", nullable=true)
  168.      */
  169.     protected $paid false;
  170.     /**
  171.      * @Doctrine\ORM\Mapping\Column(name="send_to_heureka", type="boolean", nullable=true)
  172.      */
  173.     protected $sendToHeureka false;
  174.     /**
  175.      * @Doctrine\ORM\Mapping\Column(type="boolean", name="confirmed", nullable=true)
  176.      */
  177.     protected $confirmed false;
  178.     /**
  179.      * @var \DateTime
  180.      *
  181.      * @ORM\Column(name="sent_date", type="datetime", nullable=true)
  182.      */
  183.     private $sentDate;
  184.     /**
  185.      * @return \DateTime
  186.      */
  187.     public function getCommentRequestSendDate()
  188.     {
  189.         return $this->commentRequestSendDate;
  190.     }
  191.     /**
  192.      * @param \DateTime $commentRequestSendDate
  193.      */
  194.     public function setCommentRequestSendDate(\DateTime $commentRequestSendDate): void
  195.     {
  196.         $this->commentRequestSendDate $commentRequestSendDate;
  197.     }
  198.     /**
  199.      * @var \DateTime
  200.      *
  201.      * @ORM\Column(name="comment_request_send_date", type="datetime", nullable=true)
  202.      */
  203.     private $commentRequestSendDate;
  204.     /**
  205.      * @Doctrine\ORM\Mapping\Column(type="boolean", name="phone_request", nullable=true)
  206.      */
  207.     protected $phoneRequest false;
  208.     /**
  209.      * @var \DateTime
  210.      *
  211.      * @ORM\Column(name="ga4sent_data", type="datetime", nullable=true)
  212.      */
  213.     private $ga4SentData;
  214.     /**
  215.      * @var string
  216.      *
  217.      * @ORM\Column(name="pay_uredirect_url", type="text", nullable=true)
  218.      */
  219.     private $payURedirectUrl;
  220.     /**
  221.      * @var string
  222.      *
  223.      * @ORM\Column(name="pay_uorder_id", type="text", nullable=true)
  224.      */
  225.     private $payUOrderId;
  226.     /**
  227.      * @var string
  228.      *
  229.      * @ORM\Column(name="pay_upayment_status", type="text", nullable=true)
  230.      */
  231.     private $payUPaymentStatus;
  232.     public $storeDeliveryAddress;
  233.     public $storeInvoiceAddress;
  234.     public $shippingNumber;
  235.     public $PCStatus;
  236.     public $PCNotConfirmed;
  237.     public $PCStatusId;
  238.     public $PCDataAvailable;
  239.     public $plannedSendDate;
  240.     public $pcInvoices;
  241.     public $pcProFormas;
  242.     public function getLanguage(): ?Language
  243.     {
  244.         return $this->language;
  245.     }
  246.     public function setLanguage(?Language $language): self
  247.     {
  248.         $this->language $language;
  249.         return $this;
  250.     }
  251.     /**
  252.      * Constructor
  253.      */
  254.     public function __construct()
  255.     {
  256.         $this->products = new \Doctrine\Common\Collections\ArrayCollection();
  257.         $this->storeDeliveryAddress = new Address();
  258.         $this->storeInvoiceAddress = new Address();
  259.     }
  260.     public function getTotalCostBrutto() {
  261.         //return round($this->getTotalCost()*1.23,2);
  262.         return $this->getTotalCost();
  263.     }
  264.     public function getOrderCeneoString() {
  265.         $produktyString '';
  266.         /** @var $product OrderProduct */
  267.         foreach ($this->getOrderProducts() as $product) {
  268.             $produktyString $produktyString.'#'.$product->getProduct()->getId();
  269.         }
  270.         return $produktyString;
  271.     }
  272.     /**
  273.      * Get id
  274.      *
  275.      * @return integer
  276.      */
  277.     public function getId()
  278.     {
  279.         return $this->id;
  280.     }
  281.     /**
  282.      * Set totalCost
  283.      *
  284.      * @param string $totalCost
  285.      *
  286.      * @return Order
  287.      */
  288.     public function setTotalCost($totalCost)
  289.     {
  290.         $this->totalCost $totalCost;
  291.         return $this;
  292.     }
  293.     /**
  294.      * Get totalCost
  295.      *
  296.      * @return string
  297.      */
  298.     public function getTotalCost()
  299.     {
  300.         return $this->totalCost;
  301.     }
  302.     /**
  303.      * Set shippingCost
  304.      *
  305.      * @param string $shippingCost
  306.      *
  307.      * @return Order
  308.      */
  309.     public function setShippingCost($shippingCost)
  310.     {
  311.         $this->shippingCost $shippingCost;
  312.         return $this;
  313.     }
  314.     /**
  315.      * Get shippingCost
  316.      *
  317.      * @return float
  318.      */
  319.     public function getShippingCost()
  320.     {
  321.         return $this->shippingCost;
  322.     }
  323.     /**
  324.      * Set session
  325.      *
  326.      * @param string $session
  327.      *
  328.      * @return Order
  329.      */
  330.     public function setSession($session)
  331.     {
  332.         $this->session $session;
  333.         return $this;
  334.     }
  335.     /**
  336.      * Get session
  337.      *
  338.      * @return string
  339.      */
  340.     public function getSession()
  341.     {
  342.         return $this->session;
  343.     }
  344.     /**
  345.      * Set ip
  346.      *
  347.      * @param string $ip
  348.      *
  349.      * @return Order
  350.      */
  351.     public function setIp($ip)
  352.     {
  353.         $this->ip $ip;
  354.         return $this;
  355.     }
  356.     /**
  357.      * Get ip
  358.      *
  359.      * @return string
  360.      */
  361.     public function getIp()
  362.     {
  363.         return $this->ip;
  364.     }
  365.     /**
  366.      * Set userAgent
  367.      *
  368.      * @param string $userAgent
  369.      *
  370.      * @return Order
  371.      */
  372.     public function setUserAgent($userAgent)
  373.     {
  374.         $this->userAgent $userAgent;
  375.         return $this;
  376.     }
  377.     /**
  378.      * Get userAgent
  379.      *
  380.      * @return string
  381.      */
  382.     public function getUserAgent()
  383.     {
  384.         return $this->userAgent;
  385.     }
  386.     /**
  387.      * Set rebateCodeContent
  388.      *
  389.      * @param string $rebateCodeContent
  390.      *
  391.      * @return Order
  392.      */
  393.     public function setRebateCodeContent($rebateCodeContent)
  394.     {
  395.         $this->rebateCodeContent $rebateCodeContent;
  396.         return $this;
  397.     }
  398.     /**
  399.      * Get rebateCodeContent
  400.      *
  401.      * @return string
  402.      */
  403.     public function getRebateCodeContent()
  404.     {
  405.         return $this->rebateCodeContent;
  406.     }
  407.     /**
  408.      * Set user
  409.      *
  410.      * @param \App\Entity\User $user
  411.      *
  412.      * @return Order
  413.      */
  414.     public function setUser(\App\Entity\User $user null)
  415.     {
  416.         $this->user $user;
  417.         return $this;
  418.     }
  419.     /**
  420.      * Get user
  421.      *
  422.      * @return \App\Entity\User
  423.      */
  424.     public function getUser()
  425.     {
  426.         return $this->user;
  427.     }
  428.     /**
  429.      * Set cart
  430.      *
  431.      * @param \App\Entity\Cart $cart
  432.      *
  433.      * @return Order
  434.      */
  435.     public function setCart(\App\Entity\Cart $cart null)
  436.     {
  437.         $this->cart $cart;
  438.         return $this;
  439.     }
  440.     /**
  441.      * Get cart
  442.      *
  443.      * @return \App\Entity\Cart
  444.      */
  445.     public function getCart()
  446.     {
  447.         return $this->cart;
  448.     }
  449.     /**
  450.      * Set deliveryCountry
  451.      *
  452.      * @param \App\Entity\DeliveryCountry $deliveryCountry
  453.      *
  454.      * @return Order
  455.      */
  456.     public function setDeliveryCountry(\App\Entity\DeliveryCountry $deliveryCountry null)
  457.     {
  458.         $this->deliveryCountry $deliveryCountry;
  459.         return $this;
  460.     }
  461.     /**
  462.      * Get deliveryCountry
  463.      *
  464.      * @return \App\Entity\DeliveryCountry
  465.      */
  466.     public function getDeliveryCountry()
  467.     {
  468.         return $this->deliveryCountry;
  469.     }
  470.     /**
  471.      * Set deliveryMethod
  472.      *
  473.      * @param \App\Entity\DeliveryMethod $deliveryMethod
  474.      *
  475.      * @return Order
  476.      */
  477.     public function setDeliveryMethod(\App\Entity\DeliveryMethod $deliveryMethod null)
  478.     {
  479.         $this->deliveryMethod $deliveryMethod;
  480.         return $this;
  481.     }
  482.     /**
  483.      * Get deliveryMethod
  484.      *
  485.      * @return \App\Entity\DeliveryMethod
  486.      */
  487.     public function getDeliveryMethod()
  488.     {
  489.         return $this->deliveryMethod;
  490.     }
  491.     /**
  492.      * Set paymentMethod
  493.      *
  494.      * @param \App\Entity\PaymentMethod $paymentMethod
  495.      *
  496.      * @return Order
  497.      */
  498.     public function setPaymentMethod(\App\Entity\PaymentMethod $paymentMethod null)
  499.     {
  500.         $this->paymentMethod $paymentMethod;
  501.         return $this;
  502.     }
  503.     /**
  504.      * Get paymentMethod
  505.      *
  506.      * @return \App\Entity\PaymentMethod
  507.      */
  508.     public function getPaymentMethod()
  509.     {
  510.         return $this->paymentMethod;
  511.     }
  512.     /**
  513.      * Set rebateCode
  514.      *
  515.      * @param \App\Entity\RebateCode $rebateCode
  516.      *
  517.      * @return Order
  518.      */
  519.     public function setRebateCode(\App\Entity\RebateCode $rebateCode null)
  520.     {
  521.         $this->rebateCode $rebateCode;
  522.         return $this;
  523.     }
  524.     /**
  525.      * Get rebateCode
  526.      *
  527.      * @return \App\Entity\RebateCode
  528.      */
  529.     public function getRebateCode()
  530.     {
  531.         return $this->rebateCode;
  532.     }
  533.     /**
  534.      * Add product
  535.      *
  536.      * @param \App\Entity\OrderProduct $product
  537.      *
  538.      * @return Order
  539.      */
  540.     public function addProduct(\App\Entity\OrderProduct $product)
  541.     {
  542.         $this->products[] = $product;
  543.         return $this;
  544.     }
  545.     /**
  546.      * Remove product
  547.      *
  548.      * @param \App\Entity\OrderProduct $product
  549.      */
  550.     public function removeProduct(\App\Entity\OrderProduct $product)
  551.     {
  552.         $this->products->removeElement($product);
  553.     }
  554.     /**
  555.      * Get products
  556.      *
  557.      * @return \Doctrine\Common\Collections\Collection
  558.      */
  559.     public function getOnlyOrderProducts()
  560.     {
  561.         return $this->products;
  562.     }
  563.     /**
  564.      * Get products
  565.      *
  566.      * @return \Doctrine\Common\Collections\Collection
  567.      */
  568.     public function getProducts()
  569.     {
  570.         if ($this->products->count() == 0) {
  571.             if (is_object($this->getCart())) {
  572.                 return $this->getCart()->getProducts();
  573.             }
  574.         }
  575.         return $this->products;
  576.     }
  577.     public function getOrderProducts() {
  578.         return $this->products;
  579.     }
  580.     public function getProductsAsTablePl() {
  581.         $table '<table style="width:100%;">';
  582.         $table .= '<tr style="font-weight: bold"><td>Nazwa</td><td></td><td>Ilość</td><td>Cena</td></tr>';
  583.         /** @var $product OrderProduct */
  584.         foreach ($this->getProducts() as $product) {
  585.             if ($product->getDeletedBy()) {
  586.                 continue;
  587.             }
  588.             $equipments '';
  589.             if ($product->getEquipments()->count()) {
  590.                 $equipments '<br/>Wyposażenie dodatkowe: <Br/><strong>'.$product->getEquipmentAsString().'</strong>';
  591.             }
  592.             $table .= '<tr><td>'.$product->getProductName().$equipments.'</td><td></td><td>'.$product->getQuantity().'</td><td>'.$product->getPrice().'</td></tr>';
  593.             if ($product->getParameterValues()->count()) {
  594.                 $variants '';
  595.                 /** @var $value OrderProductParameterValue */
  596.                 foreach ($product->getParameterValues() as $value) {
  597.                     $variants .= '<strong>'.$value->getParameter()->getName().': </strong>'.$value->getParameterValue()->getName().'<br/>';
  598.                 }
  599.                 $table .= '<tr><td colspan="3">Wariant produktu: <em><br/>'.$variants.'</em></td></tr>';
  600.             }
  601.         }
  602.         $table .= '<tr><td colspan="3" style="height:5px;"></td>';
  603.         $table .= '</table>';
  604.         return $table;
  605.     }
  606.     public function getProductsAsTableCz() {
  607.         $table '<table style="width: 100%;">';
  608.         $table .= '<tr style="font-weight: bold"><td>Název produktu</td><td></td><td>Počet</td></tr>';
  609.         /** @var $product OrderProduct */
  610.         foreach ($this->getProducts() as $product) {
  611.             if ($product->getDeletedBy()) {
  612.                 continue;
  613.             }
  614.             $equipments '';
  615.             if ($product->getEquipments()->count()) {
  616.                 $equipments '<br/>Lze objednat dodatečné vybavení: <Br/>'.$product->getEquipmentAsString();
  617.             }
  618.             $table .= '<tr><td>'.$product->getProductName().$equipments.'</td><td></td><td>'.$product->getQuantity().'</td></tr>';
  619.             if ($product->getParameterValues()->count()) {
  620.                 $variants '';
  621.                 /** @var $value OrderProductParameterValue */
  622.                 foreach ($product->getParameterValues() as $value) {
  623.                     $variants .= '<strong>'.$value->getParameter()->getName().': </strong>'.$value->getParameterValue()->getName().'<br/>';
  624.                 }
  625.                 $table .= '<tr><td colspan="3">Varianta: <em><br/>'.$variants.'</em></td></tr>';
  626.             }
  627.         }
  628.         $table .= '<tr><td colspan="3" style="height:5px;"></td>';
  629.         $table .= '</table>';
  630.         return $table;
  631.     }
  632.     public function getProductsAsTableSk() {
  633.         $table '<table style="width: 100%;">';
  634.         $table .= '<tr style="font-weight: bold"><td>Název produktu</td><td></td><td>Počet</td></tr>';
  635.         /** @var $product OrderProduct */
  636.         foreach ($this->getProducts() as $product) {
  637.             if ($product->getDeletedBy()) {
  638.                 continue;
  639.             }
  640.             $equipments '';
  641.             if ($product->getEquipments()->count()) {
  642.                 $equipments '<br/>Lze objednat dodatečné vybavení: <Br/>'.$product->getEquipmentAsString();
  643.             }
  644.             $table .= '<tr><td>'.$product->getProductName().$equipments.'</td><td></td><td>'.$product->getQuantity().'</td></tr>';
  645.             if ($product->getParameterValues()->count()) {
  646.                 $variants '';
  647.                 /** @var $value OrderProductParameterValue */
  648.                 foreach ($product->getParameterValues() as $value) {
  649.                     $variants .= '<strong>'.$value->getParameter()->getName().': </strong>'.$value->getParameterValue()->getName().'<br/>';
  650.                 }
  651.                 $table .= '<tr><td colspan="3">Varianta: <em><br/>'.$variants.'</em></td></tr>';
  652.             }
  653.         }
  654.         $table .= '<tr><td colspan="3" style="height:5px;"></td>';
  655.         $table .= '</table>';
  656.         return $table;
  657.     }
  658.     public function getProductsAsTableRo() {
  659.         $table '<table style="width: 100%;">';
  660.         $table .= '<tr style="font-weight: bold"><td>Denumire</td><td></td><td>cantitate</td></tr>';
  661.         /** @var $product OrderProduct */
  662.         foreach ($this->getProducts() as $product) {
  663.             if ($product->getDeletedBy()) {
  664.                 continue;
  665.             }
  666.             $equipments '';
  667.             if ($product->getEquipments()->count()) {
  668.                 $equipments '<br/>Echipament adițional: <Br/>'.$product->getEquipmentAsString();
  669.             }
  670.             $table .= '<tr><td>'.$product->getProductName().$equipments.'</td><td></td><td>'.$product->getQuantity().'</td></tr>';
  671.             if ($product->getParameterValues()->count()) {
  672.                 $variants '';
  673.                 /** @var $value OrderProductParameterValue */
  674.                 foreach ($product->getParameterValues() as $value) {
  675.                     $variants .= '<strong>'.$value->getParameter()->getName().': </strong>'.$value->getParameterValue()->getName().'<br/>';
  676.                 }
  677.                 $table .= '<tr><td colspan="3">Varianta: <em><br/>'.$variants.'</em></td></tr>';
  678.             }
  679.         }
  680.         $table .= '<tr><td colspan="3" style="height:5px;"></td>';
  681.         $table .= '</table>';
  682.         return $table;
  683.     }
  684.     /**
  685.      * Set address
  686.      *
  687.      * @param \App\Entity\Address $address
  688.      *
  689.      * @return Order
  690.      */
  691.     public function setAddress(\App\Entity\Address $address null)
  692.     {
  693.         $this->deliveryAddress $address;
  694.         return $this;
  695.     }
  696.     /**
  697.      * Get address
  698.      *
  699.      * @return \App\Entity\Address
  700.      */
  701.     public function getAddress()
  702.     {
  703.         return $this->deliveryAddress;
  704.     }
  705.     /**
  706.      * Set invoiceAddress
  707.      *
  708.      * @param \App\Entity\Address $invoiceAddress
  709.      *
  710.      * @return Order
  711.      */
  712.     public function setInvoiceAddress(\App\Entity\Address $invoiceAddress null)
  713.     {
  714.         $this->invoiceAddress $invoiceAddress;
  715.         return $this;
  716.     }
  717.     /**
  718.      * Get invoiceAddress
  719.      *
  720.      * @return \App\Entity\Address
  721.      */
  722.     public function getInvoiceAddress()
  723.     {
  724.         return $this->invoiceAddress;
  725.     }
  726.     /**
  727.      * Set deliveryAddress
  728.      *
  729.      * @param \App\Entity\Address $deliveryAddress
  730.      *
  731.      * @return Order
  732.      */
  733.     public function setDeliveryAddress(\App\Entity\Address $deliveryAddress null)
  734.     {
  735.         $this->deliveryAddress $deliveryAddress;
  736.         return $this;
  737.     }
  738.     /**
  739.      * Get deliveryAddress
  740.      *
  741.      * @return \App\Entity\Address
  742.      */
  743.     public function getDeliveryAddress()
  744.     {
  745.         return $this->deliveryAddress;
  746.     }
  747.     /**
  748.      * Set totalCostNoRebate
  749.      *
  750.      * @param string $totalCostNoRebate
  751.      *
  752.      * @return Order
  753.      */
  754.     public function setTotalCostNoRebate($totalCostNoRebate)
  755.     {
  756.         $this->totalCostNoRebate $totalCostNoRebate;
  757.         return $this;
  758.     }
  759.     /**
  760.      * Get totalCostNoRebate
  761.      *
  762.      * @return string
  763.      */
  764.     public function getTotalCostNoRebate()
  765.     {
  766.         return $this->totalCostNoRebate;
  767.     }
  768.     /**
  769.      * Set currency
  770.      *
  771.      * @param \App\Entity\Currency $currency
  772.      *
  773.      * @return Order
  774.      */
  775.     public function setCurrency(\App\Entity\Currency $currency null)
  776.     {
  777.         $this->currency $currency;
  778.         return $this;
  779.     }
  780.     /**
  781.      * Get currency
  782.      *
  783.      * @return \App\Entity\Currency
  784.      */
  785.     public function getCurrency()
  786.     {
  787.         return $this->currency;
  788.     }
  789.     /**
  790.      * Set email
  791.      *
  792.      * @param string $email
  793.      *
  794.      * @return Order
  795.      */
  796.     public function setEmail($email)
  797.     {
  798.         $this->email $email;
  799.         return $this;
  800.     }
  801.     /**
  802.      * Get email
  803.      *
  804.      * @return string
  805.      */
  806.     public function getEmail()
  807.     {
  808.         return $this->email;
  809.     }
  810.     /**
  811.      * Set phone
  812.      *
  813.      * @param string $phone
  814.      *
  815.      * @return Order
  816.      */
  817.     public function setPhone($phone)
  818.     {
  819.         $this->phone $phone;
  820.         return $this;
  821.     }
  822.     /**
  823.      * Get phone
  824.      *
  825.      * @return string
  826.      */
  827.     public function getPhone()
  828.     {
  829.         return $this->phone;
  830.     }
  831.     /**
  832.      * Set notes
  833.      *
  834.      * @param string $notes
  835.      *
  836.      * @return Order
  837.      */
  838.     public function setNotes($notes)
  839.     {
  840.         $this->notes $notes;
  841.         return $this;
  842.     }
  843.     /**
  844.      * Get notes
  845.      *
  846.      * @return string
  847.      */
  848.     public function getNotes()
  849.     {
  850.         return $this->notes;
  851.     }
  852.     /**
  853.      * Set trackingNumber
  854.      *
  855.      * @param string $trackingNumber
  856.      *
  857.      * @return Order
  858.      */
  859.     public function setTrackingNumber($trackingNumber)
  860.     {
  861.         $this->trackingNumber $trackingNumber;
  862.         return $this;
  863.     }
  864.     /**
  865.      * Get trackingNumber
  866.      *
  867.      * @return string
  868.      */
  869.     public function getTrackingNumber()
  870.     {
  871.         return $this->trackingNumber;
  872.     }
  873.     /**
  874.      * Set code
  875.      *
  876.      * @param string $code
  877.      *
  878.      * @return Order
  879.      */
  880.     public function setCode($code)
  881.     {
  882.         $this->code $code;
  883.         return $this;
  884.     }
  885.     /**
  886.      * Get code
  887.      *
  888.      * @return string
  889.      */
  890.     public function getCode()
  891.     {
  892.         return $this->code;
  893.     }
  894.     /**
  895.      * Set status
  896.      *
  897.      * @param \App\Entity\OrderStatus $status
  898.      *
  899.      * @return Order
  900.      */
  901.     public function setStatus(\App\Entity\OrderStatus $status null)
  902.     {
  903.         $this->status $status;
  904.         return $this;
  905.     }
  906.     /**
  907.      * Get status
  908.      *
  909.      * @return \App\Entity\OrderStatus
  910.      */
  911.     public function getStatus()
  912.     {
  913.         return $this->status;
  914.     }
  915.     /**
  916.      * Set paid
  917.      *
  918.      * @param boolean $paid
  919.      *
  920.      * @return Order
  921.      */
  922.     public function setPaid($paid)
  923.     {
  924.         $this->paid $paid;
  925.         return $this;
  926.     }
  927.     /**
  928.      * Get paid
  929.      *
  930.      * @return boolean
  931.      */
  932.     public function getPaid()
  933.     {
  934.         return $this->paid;
  935.     }
  936.     /**
  937.      * Set confirmed
  938.      *
  939.      * @param boolean $confirmed
  940.      *
  941.      * @return Order
  942.      */
  943.     public function setConfirmed($confirmed)
  944.     {
  945.         $this->confirmed $confirmed;
  946.         return $this;
  947.     }
  948.     /**
  949.      * Get confirmed
  950.      *
  951.      * @return boolean
  952.      */
  953.     public function getConfirmed()
  954.     {
  955.         return $this->confirmed;
  956.     }
  957.     /**
  958.      * Set sentDate
  959.      *
  960.      * @param \DateTime $sentDate
  961.      *
  962.      * @return Order
  963.      */
  964.     public function setSentDate($sentDate)
  965.     {
  966.         $this->sentDate $sentDate;
  967.         return $this;
  968.     }
  969.     /**
  970.      * Get sentDate
  971.      *
  972.      * @return \DateTime
  973.      */
  974.     public function getSentDate()
  975.     {
  976.         return $this->sentDate;
  977.     }
  978.     public function getDotpayNumber(): ?string
  979.     {
  980.         return $this->dotpayNumber;
  981.     }
  982.     public function setDotpayNumber(?string $dotpayNumber): self
  983.     {
  984.         $this->dotpayNumber $dotpayNumber;
  985.         return $this;
  986.     }
  987.     /**
  988.      * @return string
  989.      */
  990.     public function getGopay()
  991.     {
  992.         return $this->gopay;
  993.     }
  994.     /**
  995.      * @param string $gopay
  996.      */
  997.     public function setGopay($gopay)
  998.     {
  999.         $this->gopay $gopay;
  1000.     }
  1001.     public function getDiscount() {
  1002.         if ($this->getRebateCode()) {
  1003.             return (round(($this->getTotalCostNoRebate() - $this->getTotalCost())/1.21,2));
  1004.         }
  1005.     }
  1006.     public function getProductsForCjWithRebate() {
  1007.         if ($this->getRebateCode() and $this->getRebateCode()->getCodeType() == RebateCode::CODE_TYPE_PERCENT) {
  1008.             $s '';
  1009.             /** @var $product OrderProduct */
  1010.             $c 0;
  1011.             foreach ($this->getOrderProducts() as $product) {
  1012.                 $c $c 1;
  1013.                 $disc - ($this->getRebateCode()->getPercent()/100);
  1014.                 $pr $product->getPrice()/$disc;
  1015.                 $price round($pr/1.21,2);
  1016.                 $s .= '&item'.$c.'='.$product->getProduct()->getId().'&amt'.$c.'='.$price.'&qty'.$c.'='.$product->getQuantity();
  1017.             }
  1018.             $s .= '&COUPON='.$this->getRebateCode()->getCode().'&DISCOUNT='.$this->getDiscount();
  1019.             return $s;
  1020.         } else {
  1021.             return $this->productsForCj();
  1022.         }
  1023.     }
  1024.     public function productsForCj() {
  1025.         //&item1=[item_id]&amt1=[item_unit_price]&qty1=[item_quantity]
  1026.         $s '';
  1027.         /** @var $product OrderProduct */
  1028.         $c 0;
  1029.         foreach ($this->getOrderProducts() as $product) {
  1030.             $c $c 1;
  1031.             $price round($product->getPrice()/1.21,2);
  1032.             $s .= '&item'.$c.'='.$product->getProduct()->getId().'&amt'.$c.'='.$price.'&qty'.$c.'='.$product->getQuantity();
  1033.         }
  1034.         return $s;
  1035.     }
  1036.     /**
  1037.      * @return mixed
  1038.      */
  1039.     public function getPhoneRequest()
  1040.     {
  1041.         return $this->phoneRequest;
  1042.     }
  1043.     /**
  1044.      * @param mixed $phoneRequest
  1045.      */
  1046.     public function setPhoneRequest($phoneRequest)
  1047.     {
  1048.         $this->phoneRequest $phoneRequest;
  1049.     }
  1050.     /**
  1051.      * @return bool
  1052.      */
  1053.     public function isSendToHeureka()
  1054.     {
  1055.         return $this->sendToHeureka;
  1056.     }
  1057.     /**
  1058.      * @param bool $sendToHeureka
  1059.      */
  1060.     public function setSendToHeureka(bool $sendToHeureka)
  1061.     {
  1062.         $this->sendToHeureka $sendToHeureka;
  1063.     }
  1064.     /**
  1065.      * @return \DateTime
  1066.      */
  1067.     public function getGa4SentData()
  1068.     {
  1069.         return $this->ga4SentData;
  1070.     }
  1071.     /**
  1072.      * @param \DateTime $ga4SentData
  1073.      */
  1074.     public function setGa4SentData(\DateTime $ga4SentData)
  1075.     {
  1076.         $this->ga4SentData $ga4SentData;
  1077.     }
  1078.     public function getSendToHeureka(): ?bool
  1079.     {
  1080.         return $this->sendToHeureka;
  1081.     }
  1082.     /**
  1083.      * @return string
  1084.      */
  1085.     public function getPayURedirectUrl()
  1086.     {
  1087.         return $this->payURedirectUrl;
  1088.     }
  1089.     /**
  1090.      * @param string $payURedirectUrl
  1091.      */
  1092.     public function setPayURedirectUrl($payURedirectUrl)
  1093.     {
  1094.         $this->payURedirectUrl $payURedirectUrl;
  1095.     }
  1096.     /**
  1097.      * @return string
  1098.      */
  1099.     public function getPayUOrderId()
  1100.     {
  1101.         return $this->payUOrderId;
  1102.     }
  1103.     /**
  1104.      * @param string $payUOrderId
  1105.      */
  1106.     public function setPayUOrderId($payUOrderId)
  1107.     {
  1108.         $this->payUOrderId $payUOrderId;
  1109.     }
  1110.     /**
  1111.      * @return string
  1112.      */
  1113.     public function getPayUPaymentStatus()
  1114.     {
  1115.         return $this->payUPaymentStatus;
  1116.     }
  1117.     /**
  1118.      * @param string $payUPaymentStatus
  1119.      */
  1120.     public function setPayUPaymentStatus($payUPaymentStatus): void
  1121.     {
  1122.         $this->payUPaymentStatus $payUPaymentStatus;
  1123.     }
  1124. }