src/Entity/OnlineOrderSettings.php line 7

Open in your IDE?
  1. <?php
  2. namespace Slivki\Entity;
  3. use Slivki\Enum\Order\PaymentType;
  4. class OnlineOrderSettings extends Entity
  5. {
  6.     protected $offer;
  7.     protected $minDeliverySum;
  8.     protected $minSumForFreeDelivery;
  9.     protected $deliveryPrice;
  10.     protected $pickupEnabled;
  11.     protected $deliveryEnabled;
  12.     protected $allowedPaymentMethods;
  13.     protected $orderPeriodInDays;
  14.     protected $pickupDiscountPercent;
  15.     protected $email;
  16.     protected $splitPayment;
  17.     protected $domain;
  18.     protected $merchantID;
  19.     protected $secretKey;
  20.     protected $schedule;
  21.     protected $deliveryTimeFrom;
  22.     protected $deliveryTimeTill;
  23.     protected $deliverySchedule;
  24.     protected $deliveryLeadType;
  25.     protected $deliveryLeadTime;
  26.     protected $deliveryIntervalBetweenOrdersType;
  27.     protected $deliveryIntervalBetweenOrdersTime;
  28.     protected $deliveryDisableType;
  29.     protected $deliveryDisableTime;
  30.     protected $deliveryNearlyEnabled;
  31.     protected ?string $deliveryPriceInfo null;
  32.     protected ?string $deliveryWorkingTime null;
  33.     protected ?string $pickupCookingTime null;
  34.     protected ?array $receivingOrdersSchedule null;
  35.     protected bool $pendingOrderAllowed false;
  36.     protected ?int $pickupLeadTime null;
  37.     protected ?string $priceCodeDependsOnOrder null;
  38.     public function getOffer(): Offer
  39.     {
  40.         return $this->offer;
  41.     }
  42.     public function setOffer(Offer $offer): void
  43.     {
  44.         $this->offer $offer;
  45.     }
  46.     public function getMinDeliverySum() {
  47.         return $this->minDeliverySum;
  48.     }
  49.     public function setMinDeliverySum($minDeliverySum) {
  50.         $this->minDeliverySum $minDeliverySum;
  51.     }
  52.     public function getMinSumForFreeDelivery() {
  53.         return $this->minSumForFreeDelivery;
  54.     }
  55.     public function setMinSumForFreeDelivery($minSumForFreeDelivery) {
  56.         $this->minSumForFreeDelivery $minSumForFreeDelivery;
  57.     }
  58.     public function getDeliveryPrice(): ?float
  59.     {
  60.         return $this->deliveryPrice;
  61.     }
  62.     public function setDeliveryPrice($deliveryPrice) {
  63.         $this->deliveryPrice $deliveryPrice;
  64.     }
  65.     public function isPickupEnabled() {
  66.         return $this->pickupEnabled;
  67.     }
  68.     public function setPickupEnabled($pickupEnabled) {
  69.         $this->pickupEnabled $pickupEnabled;
  70.     }
  71.     public function isDeliveryEnabled() {
  72.         return $this->deliveryEnabled;
  73.     }
  74.     public function setDeliveryEnabled($deliveryEnabled) {
  75.         $this->deliveryEnabled $deliveryEnabled;
  76.     }
  77.     public function getAllowedPaymentMethods() {
  78.         if (!$this->allowedPaymentMethods) {
  79.             return [];
  80.         }
  81.         return json_decode($this->allowedPaymentMethodstrue);
  82.     }
  83.     public function getAllowedPaymentMethodsString(): string
  84.     {
  85.         $allowedPaymentMethods $this->getAllowedPaymentMethods();
  86.         if (=== \count($allowedPaymentMethods)) {
  87.             return '';
  88.         }
  89.         $allowedPaymentMethodsStrings = [];
  90.         if ($allowedPaymentMethods['delivery'][PaymentType::ONLINE]) {
  91.             $allowedPaymentMethodsStrings[] = 'онлайн';
  92.         }
  93.         if ($allowedPaymentMethods['delivery'][PaymentType::CASH] && $allowedPaymentMethods['pickup'][PaymentType::CASH]) {
  94.             $allowedPaymentMethodsStrings[] = 'наличными на месте или курьеру';
  95.         } elseif ($allowedPaymentMethods['delivery'][PaymentType::CASH]) {
  96.             $allowedPaymentMethodsStrings[] = 'наличными курьеру';
  97.         } elseif ($allowedPaymentMethods['pickup'][PaymentType::CASH]) {
  98.             $allowedPaymentMethodsStrings[] = 'наличными на месте';
  99.         }
  100.         if ($allowedPaymentMethods['pickup'][PaymentType::TERMINAL]) {
  101.             $allowedPaymentMethodsStrings[] = 'картой на месте';
  102.         }
  103.         if ($allowedPaymentMethods['delivery'][PaymentType::TERMINAL]) {
  104.             $allowedPaymentMethodsStrings[] = 'через терминал курьеру';
  105.         }
  106.         return \implode(', '$allowedPaymentMethodsStrings);
  107.     }
  108.     public function setAllowedPaymentMethods($allowedPaymentMethods) {
  109.         $this->allowedPaymentMethods $allowedPaymentMethods;
  110.     }
  111.     public function getOrderPeriodInDays() {
  112.         return $this->orderPeriodInDays;
  113.     }
  114.     public function setOrderPeriodInDays($orderPeriodInDays) {
  115.         $this->orderPeriodInDays $orderPeriodInDays;
  116.     }
  117.     public function getPickupDiscountPercent() {
  118.         return $this->pickupDiscountPercent;
  119.     }
  120.     public function setPickupDiscountPercent($pickupDiscountPercent) {
  121.         $this->pickupDiscountPercent $pickupDiscountPercent;
  122.     }
  123.     public function getEmail() {
  124.         return $this->email;
  125.     }
  126.     public function setEmail($email) {
  127.         $this->email $email;
  128.     }
  129.     public function isSplitPayment() {
  130.         return $this->splitPayment;
  131.     }
  132.     public function setSplitPayment($splitPayment) {
  133.         $this->splitPayment $splitPayment;
  134.     }
  135.     public function getDomain() {
  136.         return $this->domain;
  137.     }
  138.     public function setDomain($domain) {
  139.         $this->domain $domain;
  140.     }
  141.     public function getMerchantID() {
  142.         return $this->merchantID;
  143.     }
  144.     public function setMerchantID($merchantID) {
  145.         $this->merchantID $merchantID;
  146.         return $this;
  147.     }
  148.     public function getSecretKey() {
  149.         return $this->secretKey;
  150.     }
  151.     public function setSecretKey($secretKey) {
  152.         $this->secretKey $secretKey;
  153.     }
  154.     public function getDeliveryTimeFrom(): ?string
  155.     {
  156.         return $this->deliveryTimeFrom;
  157.     }
  158.     public function setDeliveryTimeFrom($deliveryTimeFrom): void
  159.     {
  160.         $this->deliveryTimeFrom $deliveryTimeFrom;
  161.     }
  162.     public function getDeliveryTimeTill(): ?string
  163.     {
  164.         return $this->deliveryTimeTill;
  165.     }
  166.     public function setDeliveryTimeTill($deliveryTimeTill): void
  167.     {
  168.         $this->deliveryTimeTill $deliveryTimeTill;
  169.     }
  170.     public function getSchedule()
  171.     {
  172.         return $this->schedule;
  173.     }
  174.     public function setSchedule($schedule)
  175.     {
  176.         $this->schedule $schedule;
  177.     }
  178.     public function getDeliverySchedule()
  179.     {
  180.         return $this->deliverySchedule;
  181.     }
  182.     public function setDeliverySchedule($deliverySchedule)
  183.     {
  184.         $this->deliverySchedule $deliverySchedule;
  185.     }
  186.     public function getDeliveryLeadType()
  187.     {
  188.         return $this->deliveryLeadType;
  189.     }
  190.     public function setDeliveryLeadType($deliveryLeadType)
  191.     {
  192.         $this->deliveryLeadType $deliveryLeadType;
  193.     }
  194.     public function getDeliveryLeadTime()
  195.     {
  196.         return $this->deliveryLeadTime;
  197.     }
  198.     public function setDeliveryLeadTime($deliveryLeadTime)
  199.     {
  200.         $this->deliveryLeadTime $deliveryLeadTime;
  201.     }
  202.     public function getDeliveryIntervalBetweenOrdersType()
  203.     {
  204.         return $this->deliveryIntervalBetweenOrdersType;
  205.     }
  206.     public function setDeliveryIntervalBetweenOrdersType($deliveryIntervalBetweenOrdersType)
  207.     {
  208.         $this->deliveryIntervalBetweenOrdersType $deliveryIntervalBetweenOrdersType;
  209.     }
  210.     public function getDeliveryIntervalBetweenOrdersTime()
  211.     {
  212.         return $this->deliveryIntervalBetweenOrdersTime;
  213.     }
  214.     public function setDeliveryIntervalBetweenOrdersTime($deliveryIntervalBetweenOrdersTime)
  215.     {
  216.         $this->deliveryIntervalBetweenOrdersTime $deliveryIntervalBetweenOrdersTime;
  217.     }
  218.     public function getDeliveryDisableType()
  219.     {
  220.         return $this->deliveryDisableType;
  221.     }
  222.     public function setDeliveryDisableType($deliveryDisableType)
  223.     {
  224.         $this->deliveryDisableType $deliveryDisableType;
  225.     }
  226.     public function getDeliveryDisableTime()
  227.     {
  228.         return $this->deliveryDisableTime;
  229.     }
  230.     public function setDeliveryDisableTime($deliveryDisableTime)
  231.     {
  232.         $this->deliveryDisableTime $deliveryDisableTime;
  233.     }
  234.     public function isDeliveryNearlyEnabled() {
  235.         return $this->deliveryNearlyEnabled;
  236.     }
  237.     public function setDeliveryNearlyEnabled($deliveryNearlyEnabled) {
  238.         $this->deliveryNearlyEnabled $deliveryNearlyEnabled;
  239.     }
  240.     public function getDeliveryPriceInfo(): ?string
  241.     {
  242.         return $this->deliveryPriceInfo;
  243.     }
  244.     public function setDeliveryPriceInfo(?string $deliveryPriceInfo): void
  245.     {
  246.         $this->deliveryPriceInfo $deliveryPriceInfo;
  247.     }
  248.     public function getDeliveryWorkingTime(): ?string
  249.     {
  250.         return $this->deliveryWorkingTime;
  251.     }
  252.     public function setDeliveryWorkingTime(?string $deliveryWorkingTime): void
  253.     {
  254.         $this->deliveryWorkingTime $deliveryWorkingTime;
  255.     }
  256.     public function getPickupCookingTime(): ?string
  257.     {
  258.         return $this->pickupCookingTime;
  259.     }
  260.     public function setPickupCookingTime(?string $pickupCookingTime): void
  261.     {
  262.         $this->pickupCookingTime $pickupCookingTime;
  263.     }
  264.     public function getReceivingOrdersSchedule(): ?array
  265.     {
  266.         return $this->receivingOrdersSchedule;
  267.     }
  268.     public function setReceivingOrdersSchedule(?array $receivingOrdersSchedule): void
  269.     {
  270.         $this->receivingOrdersSchedule $receivingOrdersSchedule;
  271.     }
  272.     public function isPendingOrderAllowed(): bool
  273.     {
  274.         return $this->pendingOrderAllowed;
  275.     }
  276.     public function setPendingOrderAllowed(bool $pendingOrderAllowed): void
  277.     {
  278.         $this->pendingOrderAllowed $pendingOrderAllowed;
  279.     }
  280.     public function getPickupLeadTime(): ?int
  281.     {
  282.         return $this->pickupLeadTime;
  283.     }
  284.     public function setPickupLeadTime(?int $pickupLeadTime): void
  285.     {
  286.         $this->pickupLeadTime $pickupLeadTime;
  287.     }
  288.     public function getPriceCodeDependsOnOrder(): ?string
  289.     {
  290.         return $this->priceCodeDependsOnOrder;
  291.     }
  292.     public function setPriceCodeDependsOnOrder(?string $priceCodeDependsOnOrder): void
  293.     {
  294.         $this->priceCodeDependsOnOrder $priceCodeDependsOnOrder;
  295.     }
  296.     public function jsonSerialize(): array
  297.     {
  298.         return [
  299.             'ID' => $this->ID,
  300.             'minDeliverySum' => $this->minDeliverySum,
  301.             'minSumForFreeDelivery' => $this->minSumForFreeDelivery,
  302.             'deliveryPrice' => $this->deliveryPrice,
  303.             'deliveryPriceInfo' => $this->deliveryPriceInfo,
  304.             'pickupEnabled' => $this->pickupEnabled,
  305.             'deliveryEnabled' => $this->deliveryEnabled,
  306.             'allowedPaymentMethods' => $this->allowedPaymentMethods,
  307.             'orderPeriodInDays' => $this->orderPeriodInDays,
  308.             'pickupDiscountPercent' => $this->pickupDiscountPercent,
  309.             'email' => $this->email,
  310.             'splitPayment' => $this->splitPayment,
  311.             'domain' => $this->domain,
  312.             'merchantID' => $this->merchantID,
  313.             'secretKey' => $this->secretKey,
  314.             'schedule' => $this->schedule,
  315.             'deliveryTimeFrom' => $this->deliveryTimeFrom,
  316.             'deliveryTimeTill' => $this->deliveryTimeTill,
  317.             'deliverySchedule' => $this->deliverySchedule,
  318.             'deliveryLeadType' => $this->deliveryLeadType,
  319.             'deliveryLeadTime' => $this->deliveryLeadTime,
  320.             'deliveryIntervalBetweenOrdersType' => $this->deliveryIntervalBetweenOrdersType,
  321.             'deliveryIntervalBetweenOrdersTime' => $this->deliveryIntervalBetweenOrdersTime,
  322.             'deliveryDisableType' => $this->deliveryDisableType,
  323.             'deliveryDisableTime' => $this->deliveryDisableTime,
  324.             'deliveryNearlyEnabled' => $this->deliveryNearlyEnabled,
  325.             'deliveryWorkingTime' => $this->deliveryWorkingTime,
  326.             'pickupCookingTime' => $this->pickupCookingTime,
  327.             'receivingOrdersSchedule' => $this->receivingOrdersSchedule,
  328.             'pendingOrderAllowed' => $this->pendingOrderAllowed,
  329.             'pickupLeadTime' => $this->pickupLeadTime,
  330.             'priceCodeDependsOnOrder' => $this->priceCodeDependsOnOrder,
  331.         ];
  332.     }
  333. }