magento2-docker/app/code/IpSupply/SyncOrder/Sync/ShippingAddress.php

40 lines
1.1 KiB
PHP
Executable File

<?php
namespace IpSupply\SyncOrder\Sync;
class ShippingAddress implements \JsonSerializable
{
public $name = null;
public $street1 = null;
public $street2 = null;
public $cityName = 0;
public $stateOrProvince = null;
public $country = null;
public $countryName = null;
public $phone = null;
public $email = null;
public $postalCode = null;
function __construct(\Magento\Sales\Model\Order\Address|null $address)
{
if (!$address) {
return;
}
$this->email = $address->getEmail();
$this->name = $address->getName();
$this->street1 = $address->getStreetLine(1);
$this->street2 = $address->getStreetLine(2);
$this->country = $address->getCountryId();
$this->cityName = $address->getCity();
$this->stateOrProvince = $address->getRegion();
$this->phone = $address->getTelephone();
$this->postalCode = $address->getPostcode();
$this->countryName = $address->getCountryId();
}
public function jsonSerialize(): mixed
{
return get_object_vars($this);
}
}