1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PaymentGateway\PayPalSdk\Subscriptions; |
4
|
|
|
|
5
|
|
|
class ShippingDetailAddressPortable |
6
|
|
|
{ |
7
|
|
|
private string $countryCode; |
8
|
|
|
private ?string $addressLine1 = null; |
9
|
|
|
private ?string $addressLine2 = null; |
10
|
|
|
private ?string $adminArea1 = null; |
11
|
|
|
private ?string $adminArea2 = null; |
12
|
|
|
private ?string $postalCode = null; |
13
|
|
|
|
14
|
9 |
|
public function __construct(string $countryCode) |
15
|
|
|
{ |
16
|
9 |
|
$this->countryCode = $countryCode; |
17
|
9 |
|
} |
18
|
|
|
|
19
|
1 |
|
public function getCountryCode(): string |
20
|
|
|
{ |
21
|
1 |
|
return $this->countryCode; |
22
|
|
|
} |
23
|
|
|
|
24
|
1 |
|
public function setCountryCode(string $countryCode): self |
25
|
|
|
{ |
26
|
1 |
|
$this->countryCode = $countryCode; |
27
|
|
|
|
28
|
1 |
|
return $this; |
29
|
|
|
} |
30
|
|
|
|
31
|
1 |
|
public function getAddressLine1(): ?string |
32
|
|
|
{ |
33
|
1 |
|
return $this->addressLine1; |
34
|
|
|
} |
35
|
|
|
|
36
|
2 |
|
public function setAddressLine1(?string $addressLine1): self |
37
|
|
|
{ |
38
|
2 |
|
$this->addressLine1 = $addressLine1; |
39
|
|
|
|
40
|
2 |
|
return $this; |
41
|
|
|
} |
42
|
|
|
|
43
|
1 |
|
public function getAddressLine2(): ?string |
44
|
|
|
{ |
45
|
1 |
|
return $this->addressLine2; |
46
|
|
|
} |
47
|
|
|
|
48
|
2 |
|
public function setAddressLine2(?string $addressLine2): self |
49
|
|
|
{ |
50
|
2 |
|
$this->addressLine2 = $addressLine2; |
51
|
|
|
|
52
|
2 |
|
return $this; |
53
|
|
|
} |
54
|
|
|
|
55
|
1 |
|
public function getAdminArea1(): ?string |
56
|
|
|
{ |
57
|
1 |
|
return $this->adminArea1; |
58
|
|
|
} |
59
|
|
|
|
60
|
2 |
|
public function setAdminArea1(?string $adminArea1): self |
61
|
|
|
{ |
62
|
2 |
|
$this->adminArea1 = $adminArea1; |
63
|
|
|
|
64
|
2 |
|
return $this; |
65
|
|
|
} |
66
|
|
|
|
67
|
1 |
|
public function getAdminArea2(): ?string |
68
|
|
|
{ |
69
|
1 |
|
return $this->adminArea2; |
70
|
|
|
} |
71
|
|
|
|
72
|
2 |
|
public function setAdminArea2(?string $adminArea2): self |
73
|
|
|
{ |
74
|
2 |
|
$this->adminArea2 = $adminArea2; |
75
|
|
|
|
76
|
2 |
|
return $this; |
77
|
|
|
} |
78
|
|
|
|
79
|
1 |
|
public function getPostalCode(): ?string |
80
|
|
|
{ |
81
|
1 |
|
return $this->postalCode; |
82
|
|
|
} |
83
|
|
|
|
84
|
2 |
|
public function setPostalCode(?string $postalCode): self |
85
|
|
|
{ |
86
|
2 |
|
$this->postalCode = $postalCode; |
87
|
|
|
|
88
|
2 |
|
return $this; |
89
|
|
|
} |
90
|
|
|
|
91
|
7 |
|
public function toArray(): array |
92
|
|
|
{ |
93
|
|
|
$data = [ |
94
|
7 |
|
'country_code' => $this->countryCode, |
95
|
|
|
]; |
96
|
|
|
|
97
|
7 |
|
if ($this->addressLine1) { |
98
|
1 |
|
$data['address_line_1'] = $this->addressLine1; |
99
|
|
|
} |
100
|
|
|
|
101
|
7 |
|
if ($this->addressLine2) { |
102
|
1 |
|
$data['address_line_2'] = $this->addressLine2; |
103
|
|
|
} |
104
|
|
|
|
105
|
7 |
|
if ($this->adminArea1) { |
106
|
1 |
|
$data['admin_area_1'] = $this->adminArea1; |
107
|
|
|
} |
108
|
|
|
|
109
|
7 |
|
if ($this->adminArea2) { |
110
|
1 |
|
$data['admin_area_2'] = $this->adminArea2; |
111
|
|
|
} |
112
|
|
|
|
113
|
7 |
|
if ($this->postalCode) { |
114
|
1 |
|
$data['postal_code'] = $this->postalCode; |
115
|
|
|
} |
116
|
|
|
|
117
|
7 |
|
return $data; |
118
|
|
|
} |
119
|
|
|
} |
120
|
|
|
|