1
0
Files
PayPal-PHP-Server-SDK/src/Models/AddressDetails.php
2024-10-18 19:06:27 +00:00

373 lines
9.6 KiB
PHP

<?php
declare(strict_types=1);
/*
* PaypalServerSdkLib
*
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
*/
namespace PaypalServerSdkLib\Models;
use stdClass;
/**
* Address request details.
*/
class AddressDetails implements \JsonSerializable
{
/**
* @var string|null
*/
private $addressLine1;
/**
* @var string|null
*/
private $addressLine2;
/**
* @var string|null
*/
private $adminArea2;
/**
* @var string|null
*/
private $adminArea1;
/**
* @var string|null
*/
private $postalCode;
/**
* @var string
*/
private $countryCode;
/**
* @var Name|null
*/
private $name;
/**
* @var string|null
*/
private $id;
/**
* @var string|null
*/
private $company;
/**
* @var string|null
*/
private $phone;
/**
* @var Phone|null
*/
private $phoneNumber;
/**
* @param string $countryCode
*/
public function __construct(string $countryCode)
{
$this->countryCode = $countryCode;
}
/**
* Returns Address Line 1.
* The first line of the address, such as number and street, for example, `173 Drury Lane`. Needed for
* data entry, and Compliance and Risk checks. This field needs to pass the full address.
*/
public function getAddressLine1(): ?string
{
return $this->addressLine1;
}
/**
* Sets Address Line 1.
* The first line of the address, such as number and street, for example, `173 Drury Lane`. Needed for
* data entry, and Compliance and Risk checks. This field needs to pass the full address.
*
* @maps address_line_1
*/
public function setAddressLine1(?string $addressLine1): void
{
$this->addressLine1 = $addressLine1;
}
/**
* Returns Address Line 2.
* The second line of the address, for example, a suite or apartment number.
*/
public function getAddressLine2(): ?string
{
return $this->addressLine2;
}
/**
* Sets Address Line 2.
* The second line of the address, for example, a suite or apartment number.
*
* @maps address_line_2
*/
public function setAddressLine2(?string $addressLine2): void
{
$this->addressLine2 = $addressLine2;
}
/**
* Returns Admin Area 2.
* A city, town, or village. Smaller than `admin_area_level_1`.
*/
public function getAdminArea2(): ?string
{
return $this->adminArea2;
}
/**
* Sets Admin Area 2.
* A city, town, or village. Smaller than `admin_area_level_1`.
*
* @maps admin_area_2
*/
public function setAdminArea2(?string $adminArea2): void
{
$this->adminArea2 = $adminArea2;
}
/**
* Returns Admin Area 1.
* The highest-level sub-division in a country, which is usually a province, state, or ISO-3166-2
* subdivision. This data is formatted for postal delivery, for example, `CA` and not `California`.
* Value, by country, is:<ul><li>UK. A county.</li><li>US. A state.</li><li>Canada. A province.
* </li><li>Japan. A prefecture.</li><li>Switzerland. A *kanton*.</li></ul>
*/
public function getAdminArea1(): ?string
{
return $this->adminArea1;
}
/**
* Sets Admin Area 1.
* The highest-level sub-division in a country, which is usually a province, state, or ISO-3166-2
* subdivision. This data is formatted for postal delivery, for example, `CA` and not `California`.
* Value, by country, is:<ul><li>UK. A county.</li><li>US. A state.</li><li>Canada. A province.
* </li><li>Japan. A prefecture.</li><li>Switzerland. A *kanton*.</li></ul>
*
* @maps admin_area_1
*/
public function setAdminArea1(?string $adminArea1): void
{
$this->adminArea1 = $adminArea1;
}
/**
* Returns Postal Code.
* The postal code, which is the ZIP code or equivalent. Typically required for countries with a postal
* code or an equivalent. See [postal code](https://en.wikipedia.org/wiki/Postal_code).
*/
public function getPostalCode(): ?string
{
return $this->postalCode;
}
/**
* Sets Postal Code.
* The postal code, which is the ZIP code or equivalent. Typically required for countries with a postal
* code or an equivalent. See [postal code](https://en.wikipedia.org/wiki/Postal_code).
*
* @maps postal_code
*/
public function setPostalCode(?string $postalCode): void
{
$this->postalCode = $postalCode;
}
/**
* Returns Country Code.
* The [2-character ISO 3166-1 code](/api/rest/reference/country-codes/) that identifies the country or
* region.<blockquote><strong>Note:</strong> The country code for Great Britain is <code>GB</code> and
* not <code>UK</code> as used in the top-level domain names for that country. Use the `C2` country
* code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border
* transactions.</blockquote>
*/
public function getCountryCode(): string
{
return $this->countryCode;
}
/**
* Sets Country Code.
* The [2-character ISO 3166-1 code](/api/rest/reference/country-codes/) that identifies the country or
* region.<blockquote><strong>Note:</strong> The country code for Great Britain is <code>GB</code> and
* not <code>UK</code> as used in the top-level domain names for that country. Use the `C2` country
* code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border
* transactions.</blockquote>
*
* @required
* @maps country_code
*/
public function setCountryCode(string $countryCode): void
{
$this->countryCode = $countryCode;
}
/**
* Returns Name.
* The name of the party.
*/
public function getName(): ?Name
{
return $this->name;
}
/**
* Sets Name.
* The name of the party.
*
* @maps name
*/
public function setName(?Name $name): void
{
$this->name = $name;
}
/**
* Returns Id.
* The resource ID of the address.
*/
public function getId(): ?string
{
return $this->id;
}
/**
* Sets Id.
* The resource ID of the address.
*
* @maps id
*/
public function setId(?string $id): void
{
$this->id = $id;
}
/**
* Returns Company.
* The name of the company or business associated to the address.
*/
public function getCompany(): ?string
{
return $this->company;
}
/**
* Sets Company.
* The name of the company or business associated to the address.
*
* @maps company
*/
public function setCompany(?string $company): void
{
$this->company = $company;
}
/**
* Returns Phone.
* The phone number that can go on the mailing label with the address to track the shipping. Phone
* number is in E.164 format.
*/
public function getPhone(): ?string
{
return $this->phone;
}
/**
* Sets Phone.
* The phone number that can go on the mailing label with the address to track the shipping. Phone
* number is in E.164 format.
*
* @maps phone
*/
public function setPhone(?string $phone): void
{
$this->phone = $phone;
}
/**
* Returns Phone Number.
* The phone number, in its canonical international [E.164 numbering plan format](https://www.itu.
* int/rec/T-REC-E.164/en).
*/
public function getPhoneNumber(): ?Phone
{
return $this->phoneNumber;
}
/**
* Sets Phone Number.
* The phone number, in its canonical international [E.164 numbering plan format](https://www.itu.
* int/rec/T-REC-E.164/en).
*
* @maps phone_number
*/
public function setPhoneNumber(?Phone $phoneNumber): void
{
$this->phoneNumber = $phoneNumber;
}
/**
* Encode this object to JSON
*
* @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
* are set. (default: false)
*
* @return array|stdClass
*/
#[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
public function jsonSerialize(bool $asArrayWhenEmpty = false)
{
$json = [];
if (isset($this->addressLine1)) {
$json['address_line_1'] = $this->addressLine1;
}
if (isset($this->addressLine2)) {
$json['address_line_2'] = $this->addressLine2;
}
if (isset($this->adminArea2)) {
$json['admin_area_2'] = $this->adminArea2;
}
if (isset($this->adminArea1)) {
$json['admin_area_1'] = $this->adminArea1;
}
if (isset($this->postalCode)) {
$json['postal_code'] = $this->postalCode;
}
$json['country_code'] = $this->countryCode;
if (isset($this->name)) {
$json['name'] = $this->name;
}
if (isset($this->id)) {
$json['id'] = $this->id;
}
if (isset($this->company)) {
$json['company'] = $this->company;
}
if (isset($this->phone)) {
$json['phone'] = $this->phone;
}
if (isset($this->phoneNumber)) {
$json['phone_number'] = $this->phoneNumber;
}
return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
}
}