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.             $equipments '';
  586.             if ($product->getEquipments()->count()) {
  587.                 $equipments '<br/>Wyposażenie dodatkowe: <Br/><strong>'.$product->getEquipmentAsString().'</strong>';
  588.             }
  589.             $table .= '<tr><td>'.$product->getProductName().$equipments.'</td><td></td><td>'.$product->getQuantity().'</td><td>'.$product->getPrice().'</td></tr>';
  590.             if ($product->getParameterValues()->count()) {
  591.                 $variants '';
  592.                 /** @var $value OrderProductParameterValue */
  593.                 foreach ($product->getParameterValues() as $value) {
  594.                     $variants .= '<strong>'.$value->getParameter()->getName().': </strong>'.$value->getParameterValue()->getName().'<br/>';
  595.                 }
  596.                 $table .= '<tr><td colspan="3">Wariant produktu: <em><br/>'.$variants.'</em></td></tr>';
  597.             }
  598.         }
  599.         $table .= '<tr><td colspan="3" style="height:5px;"></td>';
  600.         $table .= '</table>';
  601.         return $table;
  602.     }
  603.     public function getProductsAsTableCz() {
  604.         $table '<table style="width: 100%;">';
  605.         $table .= '<tr style="font-weight: bold"><td>Název produktu</td><td></td><td>Počet</td></tr>';
  606.         /** @var $product OrderProduct */
  607.         foreach ($this->getProducts() as $product) {
  608.             $equipments '';
  609.             if ($product->getEquipments()->count()) {
  610.                 $equipments '<br/>Lze objednat dodatečné vybavení: <Br/>'.$product->getEquipmentAsString();
  611.             }
  612.             $table .= '<tr><td>'.$product->getProductName().$equipments.'</td><td></td><td>'.$product->getQuantity().'</td></tr>';
  613.             if ($product->getParameterValues()->count()) {
  614.                 $variants '';
  615.                 /** @var $value OrderProductParameterValue */
  616.                 foreach ($product->getParameterValues() as $value) {
  617.                     $variants .= '<strong>'.$value->getParameter()->getName().': </strong>'.$value->getParameterValue()->getName().'<br/>';
  618.                 }
  619.                 $table .= '<tr><td colspan="3">Varianta: <em><br/>'.$variants.'</em></td></tr>';
  620.             }
  621.         }
  622.         $table .= '<tr><td colspan="3" style="height:5px;"></td>';
  623.         $table .= '</table>';
  624.         return $table;
  625.     }
  626.     public function getProductsAsTableSk() {
  627.         $table '<table style="width: 100%;">';
  628.         $table .= '<tr style="font-weight: bold"><td>Název produktu</td><td></td><td>Počet</td></tr>';
  629.         /** @var $product OrderProduct */
  630.         foreach ($this->getProducts() as $product) {
  631.             $equipments '';
  632.             if ($product->getEquipments()->count()) {
  633.                 $equipments '<br/>Lze objednat dodatečné vybavení: <Br/>'.$product->getEquipmentAsString();
  634.             }
  635.             $table .= '<tr><td>'.$product->getProductName().$equipments.'</td><td></td><td>'.$product->getQuantity().'</td></tr>';
  636.             if ($product->getParameterValues()->count()) {
  637.                 $variants '';
  638.                 /** @var $value OrderProductParameterValue */
  639.                 foreach ($product->getParameterValues() as $value) {
  640.                     $variants .= '<strong>'.$value->getParameter()->getName().': </strong>'.$value->getParameterValue()->getName().'<br/>';
  641.                 }
  642.                 $table .= '<tr><td colspan="3">Varianta: <em><br/>'.$variants.'</em></td></tr>';
  643.             }
  644.         }
  645.         $table .= '<tr><td colspan="3" style="height:5px;"></td>';
  646.         $table .= '</table>';
  647.         return $table;
  648.     }
  649.     public function getProductsAsTableRo() {
  650.         $table '<table style="width: 100%;">';
  651.         $table .= '<tr style="font-weight: bold"><td>Denumire</td><td></td><td>cantitate</td></tr>';
  652.         /** @var $product OrderProduct */
  653.         foreach ($this->getProducts() as $product) {
  654.             $equipments '';
  655.             if ($product->getEquipments()->count()) {
  656.                 $equipments '<br/>Echipament adițional: <Br/>'.$product->getEquipmentAsString();
  657.             }
  658.             $table .= '<tr><td>'.$product->getProductName().$equipments.'</td><td></td><td>'.$product->getQuantity().'</td></tr>';
  659.             if ($product->getParameterValues()->count()) {
  660.                 $variants '';
  661.                 /** @var $value OrderProductParameterValue */
  662.                 foreach ($product->getParameterValues() as $value) {
  663.                     $variants .= '<strong>'.$value->getParameter()->getName().': </strong>'.$value->getParameterValue()->getName().'<br/>';
  664.                 }
  665.                 $table .= '<tr><td colspan="3">Varianta: <em><br/>'.$variants.'</em></td></tr>';
  666.             }
  667.         }
  668.         $table .= '<tr><td colspan="3" style="height:5px;"></td>';
  669.         $table .= '</table>';
  670.         return $table;
  671.     }
  672.     /**
  673.      * Set address
  674.      *
  675.      * @param \App\Entity\Address $address
  676.      *
  677.      * @return Order
  678.      */
  679.     public function setAddress(\App\Entity\Address $address null)
  680.     {
  681.         $this->deliveryAddress $address;
  682.         return $this;
  683.     }
  684.     /**
  685.      * Get address
  686.      *
  687.      * @return \App\Entity\Address
  688.      */
  689.     public function getAddress()
  690.     {
  691.         return $this->deliveryAddress;
  692.     }
  693.     /**
  694.      * Set invoiceAddress
  695.      *
  696.      * @param \App\Entity\Address $invoiceAddress
  697.      *
  698.      * @return Order
  699.      */
  700.     public function setInvoiceAddress(\App\Entity\Address $invoiceAddress null)
  701.     {
  702.         $this->invoiceAddress $invoiceAddress;
  703.         return $this;
  704.     }
  705.     /**
  706.      * Get invoiceAddress
  707.      *
  708.      * @return \App\Entity\Address
  709.      */
  710.     public function getInvoiceAddress()
  711.     {
  712.         return $this->invoiceAddress;
  713.     }
  714.     /**
  715.      * Set deliveryAddress
  716.      *
  717.      * @param \App\Entity\Address $deliveryAddress
  718.      *
  719.      * @return Order
  720.      */
  721.     public function setDeliveryAddress(\App\Entity\Address $deliveryAddress null)
  722.     {
  723.         $this->deliveryAddress $deliveryAddress;
  724.         return $this;
  725.     }
  726.     /**
  727.      * Get deliveryAddress
  728.      *
  729.      * @return \App\Entity\Address
  730.      */
  731.     public function getDeliveryAddress()
  732.     {
  733.         return $this->deliveryAddress;
  734.     }
  735.     /**
  736.      * Set totalCostNoRebate
  737.      *
  738.      * @param string $totalCostNoRebate
  739.      *
  740.      * @return Order
  741.      */
  742.     public function setTotalCostNoRebate($totalCostNoRebate)
  743.     {
  744.         $this->totalCostNoRebate $totalCostNoRebate;
  745.         return $this;
  746.     }
  747.     /**
  748.      * Get totalCostNoRebate
  749.      *
  750.      * @return string
  751.      */
  752.     public function getTotalCostNoRebate()
  753.     {
  754.         return $this->totalCostNoRebate;
  755.     }
  756.     /**
  757.      * Set currency
  758.      *
  759.      * @param \App\Entity\Currency $currency
  760.      *
  761.      * @return Order
  762.      */
  763.     public function setCurrency(\App\Entity\Currency $currency null)
  764.     {
  765.         $this->currency $currency;
  766.         return $this;
  767.     }
  768.     /**
  769.      * Get currency
  770.      *
  771.      * @return \App\Entity\Currency
  772.      */
  773.     public function getCurrency()
  774.     {
  775.         return $this->currency;
  776.     }
  777.     /**
  778.      * Set email
  779.      *
  780.      * @param string $email
  781.      *
  782.      * @return Order
  783.      */
  784.     public function setEmail($email)
  785.     {
  786.         $this->email $email;
  787.         return $this;
  788.     }
  789.     /**
  790.      * Get email
  791.      *
  792.      * @return string
  793.      */
  794.     public function getEmail()
  795.     {
  796.         return $this->email;
  797.     }
  798.     /**
  799.      * Set phone
  800.      *
  801.      * @param string $phone
  802.      *
  803.      * @return Order
  804.      */
  805.     public function setPhone($phone)
  806.     {
  807.         $this->phone $phone;
  808.         return $this;
  809.     }
  810.     /**
  811.      * Get phone
  812.      *
  813.      * @return string
  814.      */
  815.     public function getPhone()
  816.     {
  817.         return $this->phone;
  818.     }
  819.     /**
  820.      * Set notes
  821.      *
  822.      * @param string $notes
  823.      *
  824.      * @return Order
  825.      */
  826.     public function setNotes($notes)
  827.     {
  828.         $this->notes $notes;
  829.         return $this;
  830.     }
  831.     /**
  832.      * Get notes
  833.      *
  834.      * @return string
  835.      */
  836.     public function getNotes()
  837.     {
  838.         return $this->notes;
  839.     }
  840.     /**
  841.      * Set trackingNumber
  842.      *
  843.      * @param string $trackingNumber
  844.      *
  845.      * @return Order
  846.      */
  847.     public function setTrackingNumber($trackingNumber)
  848.     {
  849.         $this->trackingNumber $trackingNumber;
  850.         return $this;
  851.     }
  852.     /**
  853.      * Get trackingNumber
  854.      *
  855.      * @return string
  856.      */
  857.     public function getTrackingNumber()
  858.     {
  859.         return $this->trackingNumber;
  860.     }
  861.     /**
  862.      * Set code
  863.      *
  864.      * @param string $code
  865.      *
  866.      * @return Order
  867.      */
  868.     public function setCode($code)
  869.     {
  870.         $this->code $code;
  871.         return $this;
  872.     }
  873.     /**
  874.      * Get code
  875.      *
  876.      * @return string
  877.      */
  878.     public function getCode()
  879.     {
  880.         return $this->code;
  881.     }
  882.     /**
  883.      * Set status
  884.      *
  885.      * @param \App\Entity\OrderStatus $status
  886.      *
  887.      * @return Order
  888.      */
  889.     public function setStatus(\App\Entity\OrderStatus $status null)
  890.     {
  891.         $this->status $status;
  892.         return $this;
  893.     }
  894.     /**
  895.      * Get status
  896.      *
  897.      * @return \App\Entity\OrderStatus
  898.      */
  899.     public function getStatus()
  900.     {
  901.         return $this->status;
  902.     }
  903.     /**
  904.      * Set paid
  905.      *
  906.      * @param boolean $paid
  907.      *
  908.      * @return Order
  909.      */
  910.     public function setPaid($paid)
  911.     {
  912.         $this->paid $paid;
  913.         return $this;
  914.     }
  915.     /**
  916.      * Get paid
  917.      *
  918.      * @return boolean
  919.      */
  920.     public function getPaid()
  921.     {
  922.         return $this->paid;
  923.     }
  924.     /**
  925.      * Set confirmed
  926.      *
  927.      * @param boolean $confirmed
  928.      *
  929.      * @return Order
  930.      */
  931.     public function setConfirmed($confirmed)
  932.     {
  933.         $this->confirmed $confirmed;
  934.         return $this;
  935.     }
  936.     /**
  937.      * Get confirmed
  938.      *
  939.      * @return boolean
  940.      */
  941.     public function getConfirmed()
  942.     {
  943.         return $this->confirmed;
  944.     }
  945.     /**
  946.      * Set sentDate
  947.      *
  948.      * @param \DateTime $sentDate
  949.      *
  950.      * @return Order
  951.      */
  952.     public function setSentDate($sentDate)
  953.     {
  954.         $this->sentDate $sentDate;
  955.         return $this;
  956.     }
  957.     /**
  958.      * Get sentDate
  959.      *
  960.      * @return \DateTime
  961.      */
  962.     public function getSentDate()
  963.     {
  964.         return $this->sentDate;
  965.     }
  966.     public function getDotpayNumber(): ?string
  967.     {
  968.         return $this->dotpayNumber;
  969.     }
  970.     public function setDotpayNumber(?string $dotpayNumber): self
  971.     {
  972.         $this->dotpayNumber $dotpayNumber;
  973.         return $this;
  974.     }
  975.     /**
  976.      * @return string
  977.      */
  978.     public function getGopay()
  979.     {
  980.         return $this->gopay;
  981.     }
  982.     /**
  983.      * @param string $gopay
  984.      */
  985.     public function setGopay($gopay)
  986.     {
  987.         $this->gopay $gopay;
  988.     }
  989.     public function getDiscount() {
  990.         if ($this->getRebateCode()) {
  991.             return (round(($this->getTotalCostNoRebate() - $this->getTotalCost())/1.21,2));
  992.         }
  993.     }
  994.     public function getProductsForCjWithRebate() {
  995.         if ($this->getRebateCode() and $this->getRebateCode()->getCodeType() == RebateCode::CODE_TYPE_PERCENT) {
  996.             $s '';
  997.             /** @var $product OrderProduct */
  998.             $c 0;
  999.             foreach ($this->getOrderProducts() as $product) {
  1000.                 $c $c 1;
  1001.                 $disc - ($this->getRebateCode()->getPercent()/100);
  1002.                 $pr $product->getPrice()/$disc;
  1003.                 $price round($pr/1.21,2);
  1004.                 $s .= '&item'.$c.'='.$product->getProduct()->getId().'&amt'.$c.'='.$price.'&qty'.$c.'='.$product->getQuantity();
  1005.             }
  1006.             $s .= '&COUPON='.$this->getRebateCode()->getCode().'&DISCOUNT='.$this->getDiscount();
  1007.             return $s;
  1008.         } else {
  1009.             return $this->productsForCj();
  1010.         }
  1011.     }
  1012.     public function productsForCj() {
  1013.         //&item1=[item_id]&amt1=[item_unit_price]&qty1=[item_quantity]
  1014.         $s '';
  1015.         /** @var $product OrderProduct */
  1016.         $c 0;
  1017.         foreach ($this->getOrderProducts() as $product) {
  1018.             $c $c 1;
  1019.             $price round($product->getPrice()/1.21,2);
  1020.             $s .= '&item'.$c.'='.$product->getProduct()->getId().'&amt'.$c.'='.$price.'&qty'.$c.'='.$product->getQuantity();
  1021.         }
  1022.         return $s;
  1023.     }
  1024.     /**
  1025.      * @return mixed
  1026.      */
  1027.     public function getPhoneRequest()
  1028.     {
  1029.         return $this->phoneRequest;
  1030.     }
  1031.     /**
  1032.      * @param mixed $phoneRequest
  1033.      */
  1034.     public function setPhoneRequest($phoneRequest)
  1035.     {
  1036.         $this->phoneRequest $phoneRequest;
  1037.     }
  1038.     /**
  1039.      * @return bool
  1040.      */
  1041.     public function isSendToHeureka()
  1042.     {
  1043.         return $this->sendToHeureka;
  1044.     }
  1045.     /**
  1046.      * @param bool $sendToHeureka
  1047.      */
  1048.     public function setSendToHeureka(bool $sendToHeureka)
  1049.     {
  1050.         $this->sendToHeureka $sendToHeureka;
  1051.     }
  1052.     /**
  1053.      * @return \DateTime
  1054.      */
  1055.     public function getGa4SentData()
  1056.     {
  1057.         return $this->ga4SentData;
  1058.     }
  1059.     /**
  1060.      * @param \DateTime $ga4SentData
  1061.      */
  1062.     public function setGa4SentData(\DateTime $ga4SentData)
  1063.     {
  1064.         $this->ga4SentData $ga4SentData;
  1065.     }
  1066.     public function getSendToHeureka(): ?bool
  1067.     {
  1068.         return $this->sendToHeureka;
  1069.     }
  1070.     /**
  1071.      * @return string
  1072.      */
  1073.     public function getPayURedirectUrl()
  1074.     {
  1075.         return $this->payURedirectUrl;
  1076.     }
  1077.     /**
  1078.      * @param string $payURedirectUrl
  1079.      */
  1080.     public function setPayURedirectUrl($payURedirectUrl)
  1081.     {
  1082.         $this->payURedirectUrl $payURedirectUrl;
  1083.     }
  1084.     /**
  1085.      * @return string
  1086.      */
  1087.     public function getPayUOrderId()
  1088.     {
  1089.         return $this->payUOrderId;
  1090.     }
  1091.     /**
  1092.      * @param string $payUOrderId
  1093.      */
  1094.     public function setPayUOrderId($payUOrderId)
  1095.     {
  1096.         $this->payUOrderId $payUOrderId;
  1097.     }
  1098.     /**
  1099.      * @return string
  1100.      */
  1101.     public function getPayUPaymentStatus()
  1102.     {
  1103.         return $this->payUPaymentStatus;
  1104.     }
  1105.     /**
  1106.      * @param string $payUPaymentStatus
  1107.      */
  1108.     public function setPayUPaymentStatus($payUPaymentStatus): void
  1109.     {
  1110.         $this->payUPaymentStatus $payUPaymentStatus;
  1111.     }
  1112. }