1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PaymentGateway\PayPalSdk\Subscriptions; |
4
|
|
|
|
5
|
|
|
class Subscriber |
6
|
|
|
{ |
7
|
|
|
private ?PayerName $name = null; |
8
|
|
|
private ?string $emailAddress = null; |
9
|
|
|
private ?string $payerId = null; |
10
|
|
|
private ?Phone $phone = null; |
11
|
|
|
private ?ShippingAddress $shippingAddress = null; |
12
|
|
|
|
13
|
|
|
public function getName(): ?PayerName |
14
|
|
|
{ |
15
|
|
|
return $this->name; |
16
|
|
|
} |
17
|
|
|
|
18
|
2 |
|
public function setName(?PayerName $name): self |
19
|
|
|
{ |
20
|
2 |
|
$this->name = $name; |
21
|
|
|
|
22
|
2 |
|
return $this; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
public function getEmailAddress(): ?string |
26
|
|
|
{ |
27
|
|
|
return $this->emailAddress; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
public function setEmailAddress(?string $emailAddress): self |
31
|
|
|
{ |
32
|
|
|
$this->emailAddress = $emailAddress; |
33
|
|
|
|
34
|
|
|
return $this; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function getPayerId(): ?string |
38
|
|
|
{ |
39
|
|
|
return $this->payerId; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function setPayerId(?string $payerId): self |
43
|
|
|
{ |
44
|
|
|
$this->payerId = $payerId; |
45
|
|
|
|
46
|
|
|
return $this; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function getPhone(): ?Phone |
50
|
|
|
{ |
51
|
|
|
return $this->phone; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function setPhone(?Phone $phone): self |
55
|
|
|
{ |
56
|
|
|
$this->phone = $phone; |
57
|
|
|
|
58
|
|
|
return $this; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function getShippingAddress(): ?ShippingAddress |
62
|
|
|
{ |
63
|
|
|
return $this->shippingAddress; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function setShippingAddress(?ShippingAddress $shippingAddress): self |
67
|
|
|
{ |
68
|
|
|
$this->shippingAddress = $shippingAddress; |
69
|
|
|
|
70
|
|
|
return $this; |
71
|
|
|
} |
72
|
|
|
|
73
|
2 |
|
public function toArray(): array |
74
|
|
|
{ |
75
|
2 |
|
$data = []; |
76
|
|
|
|
77
|
2 |
|
if ($this->name) { |
78
|
2 |
|
$data['name'] = $this->name->toArray(); |
79
|
|
|
} |
80
|
|
|
|
81
|
2 |
|
if ($this->emailAddress) { |
82
|
|
|
$data['email_address'] = $this->emailAddress; |
83
|
|
|
} |
84
|
|
|
|
85
|
2 |
|
if ($this->payerId) { |
86
|
|
|
$data['payer_id'] = $this->payerId; |
87
|
|
|
} |
88
|
|
|
|
89
|
2 |
|
if ($this->phone) { |
90
|
|
|
$data['phone'] = $this->phone->toArray(); |
91
|
|
|
} |
92
|
|
|
|
93
|
2 |
|
if ($this->shippingAddress) { |
94
|
|
|
$data['shipping_address'] = $this->shippingAddress->toArray(); |
95
|
|
|
} |
96
|
|
|
|
97
|
2 |
|
return $data; |
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
|