src/Helper/Monetico/Request/OrderContextShoppingCart.php line 42

  1. <?php
  2. namespace App\Helper\Monetico\Request;
  3. class OrderContextShoppingCart implements \JsonSerializable
  4. {
  5.     /**
  6.      * @var ?int
  7.      */
  8.     private $giftCardAmount;
  9.     /**
  10.      * @var ?int
  11.      */
  12.     private $giftCardCount;
  13.     /**
  14.      * @var ?string
  15.      */
  16.     private $giftCardCurrency;
  17.     /**
  18.      * @var ?\DateTime?
  19.      */
  20.     private $preOrderDate;
  21.     /**
  22.      * @var ?bool
  23.      */
  24.     private $preorderIndicator;
  25.     /**
  26.      * @var ?bool
  27.      */
  28.     private $reorderIndicator;
  29.     /**
  30.      * @var ?OrderContextShoppingCartItem[]
  31.      */
  32.     private $shoppingCartItems;
  33.     public function jsonSerialize()
  34.     {
  35.         return array_filter([
  36.             "giftCardAmount" => $this->getGiftCardAmount(),
  37.             "giftCardCount" => $this->getGiftCardCount(),
  38.             "giftCardCurrency" => $this->getGiftCardCurrency(),
  39.             "preOrderDate" => $this->getFormatedPreOrderDate(),
  40.             "preorderIndicator" => $this->getPreorderIndicator(),
  41.             "reorderIndicator" => $this->getReorderIndicator(),
  42.             "shoppingCartItems" => $this->getShoppingCartItems()
  43.         ], function ($value) {
  44.             return !is_null($value);
  45.         });
  46.     }
  47.     /**
  48.      * @return int|null
  49.      */
  50.     public function getGiftCardAmount(): ?int
  51.     {
  52.         return $this->giftCardAmount;
  53.     }
  54.     /**
  55.      * @param int|null $giftCardAmount
  56.      */
  57.     public function setGiftCardAmount(?int $giftCardAmount): void
  58.     {
  59.         $this->giftCardAmount $giftCardAmount;
  60.     }
  61.     /**
  62.      * @return int|null
  63.      */
  64.     public function getGiftCardCount(): ?int
  65.     {
  66.         return $this->giftCardCount;
  67.     }
  68.     /**
  69.      * @param int|null $giftCardCount
  70.      */
  71.     public function setGiftCardCount(?int $giftCardCount): void
  72.     {
  73.         $this->giftCardCount $giftCardCount;
  74.     }
  75.     /**
  76.      * @return string|null
  77.      */
  78.     public function getGiftCardCurrency(): ?string
  79.     {
  80.         return $this->giftCardCurrency;
  81.     }
  82.     /**
  83.      * @param string|null $giftCardCurrency
  84.      */
  85.     public function setGiftCardCurrency(?string $giftCardCurrency): void
  86.     {
  87.         $this->giftCardCurrency $giftCardCurrency;
  88.     }
  89.     /**
  90.      * @return \DateTime|null
  91.      */
  92.     public function getPreOrderDate(): ?\DateTime
  93.     {
  94.         return $this->preOrderDate;
  95.     }
  96.     /**
  97.      * @return string|null
  98.      */
  99.     public function getFormatedPreOrderDate(): ?string
  100.     {
  101.         if ($this->getPreOrderDate() instanceof \DateTime) {
  102.             return $this->getPreOrderDate()->format("Y-m-d");
  103.         }
  104.         return null;
  105.     }
  106.     /**
  107.      * @param \DateTime|null $preOrderDate
  108.      */
  109.     public function setPreOrderDate(?\DateTime $preOrderDate): void
  110.     {
  111.         $this->preOrderDate $preOrderDate;
  112.     }
  113.     /**
  114.      * @return bool|null
  115.      */
  116.     public function getPreorderIndicator(): ?bool
  117.     {
  118.         return $this->preorderIndicator;
  119.     }
  120.     /**
  121.      * @param bool|null $preorderIndicator
  122.      */
  123.     public function setPreorderIndicator(?bool $preorderIndicator): void
  124.     {
  125.         $this->preorderIndicator $preorderIndicator;
  126.     }
  127.     /**
  128.      * @return bool|null
  129.      */
  130.     public function getReorderIndicator(): ?bool
  131.     {
  132.         return $this->reorderIndicator;
  133.     }
  134.     /**
  135.      * @param bool|null $reorderIndicator
  136.      */
  137.     public function setReorderIndicator(?bool $reorderIndicator): void
  138.     {
  139.         $this->reorderIndicator $reorderIndicator;
  140.     }
  141.     /**
  142.      * @return \MoneticoDemoWebKit\Monetico\Request\OrderContextShoppingCartItem[]|null
  143.      */
  144.     public function getShoppingCartItems(): ?array
  145.     {
  146.         return $this->shoppingCartItems;
  147.     }
  148.     /**
  149.      * @param \MoneticoDemoWebKit\Monetico\Request\OrderContextShoppingCartItem[]|null $shoppingCartItems
  150.      */
  151.     public function setShoppingCartItems(?array $shoppingCartItems): void
  152.     {
  153.         $this->shoppingCartItems $shoppingCartItems;
  154.     }
  155. }