src/Helper/Monetico/Request/OrderContextShipping.php line 103

  1. <?php
  2. namespace App\Helper\Monetico\Request;
  3. class OrderContextShipping implements \JsonSerializable
  4. {
  5.     /**
  6.      * @var ?string
  7.      */
  8.     private $civility;
  9.     /**
  10.      * @var ?string
  11.      */
  12.     private $name;
  13.     /**
  14.      * @var ?string
  15.      */
  16.     private $firstName;
  17.     /**
  18.      * @var ?string
  19.      */
  20.     private $lastName;
  21.     /**
  22.      * @var ?string
  23.      */
  24.     private $address;
  25.     /**
  26.      * @var ?string
  27.      */
  28.     private $addressLine1;
  29.     /**
  30.      * @var ?string
  31.      */
  32.     private $addressLine2;
  33.     /**
  34.      * @var ?string
  35.      */
  36.     private $addressLine3;
  37.     /**
  38.      * @var ?string
  39.      */
  40.     private $city;
  41.     /**
  42.      * @var ?string
  43.      */
  44.     private $postalCode;
  45.     /**
  46.      * @var ?string
  47.      */
  48.     private $country;
  49.     /**
  50.      * @var ?string
  51.      */
  52.     private $stateOrProvince;
  53.     /**
  54.      * @var ?string
  55.      */
  56.     private $countrySubdivision;
  57.     /**
  58.      * @var ?string
  59.      */
  60.     private $email;
  61.     /**
  62.      * @var ?string
  63.      */
  64.     private $phone;
  65.     /**
  66.      * @var ?string
  67.      */
  68.     private $shipIndicator;
  69.     /**
  70.      * @var ?string
  71.      */
  72.     private $deliveryTimeframe;
  73.     /**
  74.      * @var ?\DateTime
  75.      */
  76.     private $firstUseDate;
  77.     /**
  78.      * @var ?bool
  79.      */
  80.     private $matchBillingAddress;
  81.     public function jsonSerialize()
  82.     {
  83.         return array_filter([
  84.             "civility" => $this->getCivility(),
  85.             "name" => $this->getName(),
  86.             "firstName" => $this->getFirstName(),
  87.             "lastName" => $this->getLastName(),
  88.             "address" => $this->getAddress(),
  89.             "addressLine1" => $this->getAddressLine1(),
  90.             "addressLine2" => $this->getAddressLine2(),
  91.             "addressLine3" => $this->getAddressLine3(),
  92.             "city" => $this->getCity(),
  93.             "postalCode" => $this->getPostalCode(),
  94.             "country" => $this->getCountry(),
  95.             "stateOrProvince" => $this->getStateOrProvince(),
  96.             "countrySubdivision" => $this->getCountrySubdivision(),
  97.             "email" => $this->getEmail(),
  98.             "phone" => $this->getPhone(),
  99.             "shipIndicator" => $this->getShipIndicator(),
  100.             "deliveryTimeframe" => $this->getDeliveryTimeframe(),
  101.             "firstUseDate" => $this->getFormatFirstUseDate(),
  102.             "matchBillingAddress" => $this->getMatchBillingAddress()
  103.         ], function ($value) {
  104.             return !is_null($value);
  105.         });
  106.     }
  107.     /**
  108.      * @return string|null
  109.      */
  110.     public function getCivility(): ?string
  111.     {
  112.         return $this->civility;
  113.     }
  114.     /**
  115.      * @param string|null $civility
  116.      */
  117.     public function setCivility(?string $civility): void
  118.     {
  119.         $this->civility $civility;
  120.     }
  121.     /**
  122.      * @return string|null
  123.      */
  124.     public function getName(): ?string
  125.     {
  126.         return $this->name;
  127.     }
  128.     /**
  129.      * @param string|null $name
  130.      */
  131.     public function setName(?string $name): void
  132.     {
  133.         $this->name $name;
  134.     }
  135.     /**
  136.      * @return string|null
  137.      */
  138.     public function getFirstName(): ?string
  139.     {
  140.         return $this->firstName;
  141.     }
  142.     /**
  143.      * @param string|null $firstName
  144.      */
  145.     public function setFirstName(?string $firstName): void
  146.     {
  147.         $this->firstName $firstName;
  148.     }
  149.     /**
  150.      * @return string|null
  151.      */
  152.     public function getLastName(): ?string
  153.     {
  154.         return $this->lastName;
  155.     }
  156.     /**
  157.      * @param string|null $lastName
  158.      */
  159.     public function setLastName(?string $lastName): void
  160.     {
  161.         $this->lastName $lastName;
  162.     }
  163.     /**
  164.      * @return string|null
  165.      */
  166.     public function getAddress(): ?string
  167.     {
  168.         return $this->address;
  169.     }
  170.     /**
  171.      * @param string|null $address
  172.      */
  173.     public function setAddress(?string $address): void
  174.     {
  175.         $this->address $address;
  176.     }
  177.     /**
  178.      * @return string|null
  179.      */
  180.     public function getAddressLine1(): ?string
  181.     {
  182.         return $this->addressLine1;
  183.     }
  184.     /**
  185.      * @param string|null $addressLine1
  186.      */
  187.     public function setAddressLine1(?string $addressLine1): void
  188.     {
  189.         $this->addressLine1 $addressLine1;
  190.     }
  191.     /**
  192.      * @return string|null
  193.      */
  194.     public function getAddressLine2(): ?string
  195.     {
  196.         return $this->addressLine2;
  197.     }
  198.     /**
  199.      * @param string|null $addressLine2
  200.      */
  201.     public function setAddressLine2(?string $addressLine2): void
  202.     {
  203.         $this->addressLine2 $addressLine2;
  204.     }
  205.     /**
  206.      * @return string|null
  207.      */
  208.     public function getAddressLine3(): ?string
  209.     {
  210.         return $this->addressLine3;
  211.     }
  212.     /**
  213.      * @param string|null $addressLine3
  214.      */
  215.     public function setAddressLine3(?string $addressLine3): void
  216.     {
  217.         $this->addressLine3 $addressLine3;
  218.     }
  219.     /**
  220.      * @return string|null
  221.      */
  222.     public function getCity(): ?string
  223.     {
  224.         return $this->city;
  225.     }
  226.     /**
  227.      * @param string|null $city
  228.      */
  229.     public function setCity(?string $city): void
  230.     {
  231.         $this->city $city;
  232.     }
  233.     /**
  234.      * @return string|null
  235.      */
  236.     public function getPostalCode(): ?string
  237.     {
  238.         return $this->postalCode;
  239.     }
  240.     /**
  241.      * @param string|null $postalCode
  242.      */
  243.     public function setPostalCode(?string $postalCode): void
  244.     {
  245.         $this->postalCode $postalCode;
  246.     }
  247.     /**
  248.      * @return string|null
  249.      */
  250.     public function getCountry(): ?string
  251.     {
  252.         return $this->country;
  253.     }
  254.     /**
  255.      * @param string|null $country
  256.      */
  257.     public function setCountry(?string $country): void
  258.     {
  259.         $this->country $country;
  260.     }
  261.     /**
  262.      * @return string|null
  263.      */
  264.     public function getStateOrProvince(): ?string
  265.     {
  266.         return $this->stateOrProvince;
  267.     }
  268.     /**
  269.      * @param string|null $stateOrProvince
  270.      */
  271.     public function setStateOrProvince(?string $stateOrProvince): void
  272.     {
  273.         $this->stateOrProvince $stateOrProvince;
  274.     }
  275.     /**
  276.      * @return string|null
  277.      */
  278.     public function getCountrySubdivision(): ?string
  279.     {
  280.         return $this->countrySubdivision;
  281.     }
  282.     /**
  283.      * @param string|null $countrySubdivision
  284.      */
  285.     public function setCountrySubdivision(?string $countrySubdivision): void
  286.     {
  287.         $this->countrySubdivision $countrySubdivision;
  288.     }
  289.     /**
  290.      * @return string|null
  291.      */
  292.     public function getEmail(): ?string
  293.     {
  294.         return $this->email;
  295.     }
  296.     /**
  297.      * @param string|null $email
  298.      */
  299.     public function setEmail(?string $email): void
  300.     {
  301.         $this->email $email;
  302.     }
  303.     /**
  304.      * @return string|null
  305.      */
  306.     public function getPhone(): ?string
  307.     {
  308.         return $this->phone;
  309.     }
  310.     /**
  311.      * @param string|null $phone
  312.      */
  313.     public function setPhone(?string $phone): void
  314.     {
  315.         $this->phone $phone;
  316.     }
  317.     /**
  318.      * @return string|null
  319.      */
  320.     public function getShipIndicator(): ?string
  321.     {
  322.         return $this->shipIndicator;
  323.     }
  324.     /**
  325.      * @param string|null $shipIndicator
  326.      */
  327.     public function setShipIndicator(?string $shipIndicator): void
  328.     {
  329.         $this->shipIndicator $shipIndicator;
  330.     }
  331.     /**
  332.      * @return string|null
  333.      */
  334.     public function getDeliveryTimeframe(): ?string
  335.     {
  336.         return $this->deliveryTimeframe;
  337.     }
  338.     /**
  339.      * @param string|null $deliveryTimeframe
  340.      */
  341.     public function setDeliveryTimeframe(?string $deliveryTimeframe): void
  342.     {
  343.         $this->deliveryTimeframe $deliveryTimeframe;
  344.     }
  345.     /**
  346.      * @return \DateTime|null
  347.      */
  348.     public function getFirstUseDate(): ?\DateTime
  349.     {
  350.         return $this->firstUseDate;
  351.     }
  352.     /**
  353.      * @return string|null
  354.      */
  355.     public function getFormatFirstUseDate(): ?string
  356.     {
  357.         if ($this->getFirstUseDate() instanceof \DateTime) {
  358.             return $this->getFirstUseDate()->format("Y-m-d");
  359.         }
  360.         return null;
  361.     }
  362.     /**
  363.      * @param \DateTime|null $firstUseDate
  364.      */
  365.     public function setFirstUseDate(?\DateTime $firstUseDate): void
  366.     {
  367.         $this->firstUseDate $firstUseDate;
  368.     }
  369.     /**
  370.      * @return bool|null
  371.      */
  372.     public function getMatchBillingAddress(): ?bool
  373.     {
  374.         return $this->matchBillingAddress;
  375.     }
  376.     /**
  377.      * @param bool|null $matchBillingAddress
  378.      */
  379.     public function setMatchBillingAddress(?bool $matchBillingAddress): void
  380.     {
  381.         $this->matchBillingAddress $matchBillingAddress;
  382.     }
  383. }