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): void |
19
|
|
|
{ |
20
|
2 |
|
$this->name = $name; |
21
|
2 |
|
} |
22
|
|
|
|
23
|
|
|
public function getEmailAddress(): ?string |
24
|
|
|
{ |
25
|
|
|
return $this->emailAddress; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
public function setEmailAddress(?string $emailAddress): void |
29
|
|
|
{ |
30
|
|
|
$this->emailAddress = $emailAddress; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function getPayerId(): ?string |
34
|
|
|
{ |
35
|
|
|
return $this->payerId; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function setPayerId(?string $payerId): void |
39
|
|
|
{ |
40
|
|
|
$this->payerId = $payerId; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function getPhone(): ?Phone |
44
|
|
|
{ |
45
|
|
|
return $this->phone; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function setPhone(?Phone $phone): void |
49
|
|
|
{ |
50
|
|
|
$this->phone = $phone; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function getShippingAddress(): ?ShippingAddress |
54
|
|
|
{ |
55
|
|
|
return $this->shippingAddress; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function setShippingAddress(?ShippingAddress $shippingAddress): void |
59
|
|
|
{ |
60
|
|
|
$this->shippingAddress = $shippingAddress; |
61
|
|
|
} |
62
|
|
|
|
63
|
2 |
|
public function toArray(): array |
64
|
|
|
{ |
65
|
2 |
|
$data = []; |
66
|
|
|
|
67
|
2 |
|
if ($this->name) { |
68
|
2 |
|
$data['name'] = $this->name->toArray(); |
69
|
|
|
} |
70
|
|
|
|
71
|
2 |
|
if ($this->emailAddress) { |
72
|
|
|
$data['email_address'] = $this->emailAddress; |
73
|
|
|
} |
74
|
|
|
|
75
|
2 |
|
if ($this->payerId) { |
76
|
|
|
$data['payer_id'] = $this->payerId; |
77
|
|
|
} |
78
|
|
|
|
79
|
2 |
|
if ($this->phone) { |
80
|
|
|
$data['phone'] = $this->phone->toArray(); |
81
|
|
|
} |
82
|
|
|
|
83
|
2 |
|
if ($this->shippingAddress) { |
84
|
|
|
$data['shipping_address'] = $this->shippingAddress->toArray(); |
85
|
|
|
} |
86
|
|
|
|
87
|
2 |
|
return $data; |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
|