39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
namespace IpSupply\SyncOrder\Sync;
|
|
|
|
class ShippingAddress implements \JsonSerializable
|
|
{
|
|
public $name = '';
|
|
public $street1 = '';
|
|
public $street2 = '';
|
|
public $cityName = 0;
|
|
public $stateOrProvince = '';
|
|
public $country = '';
|
|
public $countryName = '';
|
|
public $phone = '';
|
|
public $email = '';
|
|
public $postalCode = '';
|
|
|
|
function __construct($address)
|
|
{
|
|
if ($address instanceof \Magento\Sales\Model\Order\Address) {
|
|
$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->phone = $address->getTelephone();
|
|
$this->postalCode = $address->getPostcode();
|
|
$this->countryName = $address->getCountryId();
|
|
} else {
|
|
// do something else
|
|
}
|
|
}
|
|
|
|
public function jsonSerialize()
|
|
{
|
|
return get_object_vars($this);
|
|
}
|
|
}
|