|
1
|
|
|
<?php |
|
2
|
|
|
namespace PHPSC\PagSeguro\Requests\Checkout; |
|
3
|
|
|
|
|
4
|
|
|
use JMS\Serializer\Annotation as Serializer; |
|
5
|
|
|
use PHPSC\PagSeguro\Customer\Customer; |
|
6
|
|
|
use PHPSC\PagSeguro\SerializerTrait; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* @Serializer\AccessType("public_method") |
|
10
|
|
|
* @Serializer\ReadOnly |
|
11
|
|
|
* @Serializer\XmlRoot("checkout") |
|
12
|
|
|
* |
|
13
|
|
|
* @author Luís Otávio Cobucci Oblonczyk <[email protected]> |
|
14
|
|
|
*/ |
|
15
|
|
|
class Checkout |
|
16
|
|
|
{ |
|
17
|
|
|
use SerializerTrait; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @Serializer\Inline |
|
21
|
|
|
* @Serializer\Type("PHPSC\PagSeguro\Requests\Checkout\Order") |
|
22
|
|
|
* |
|
23
|
|
|
* @var Order |
|
24
|
|
|
*/ |
|
25
|
|
|
private $order; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @Serializer\SerializedName("sender") |
|
29
|
|
|
* @Serializer\Type("PHPSC\PagSeguro\Customer\Customer") |
|
30
|
|
|
* |
|
31
|
|
|
* @var Customer |
|
32
|
|
|
*/ |
|
33
|
|
|
private $customer; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @Serializer\XmlElement(cdata=false) |
|
37
|
|
|
* @Serializer\SerializedName("redirectURL") |
|
38
|
|
|
* |
|
39
|
|
|
* @var string |
|
40
|
|
|
*/ |
|
41
|
|
|
private $redirectTo; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @Serializer\Type("integer") |
|
45
|
|
|
* |
|
46
|
|
|
* @var int |
|
47
|
|
|
*/ |
|
48
|
|
|
private $maxUses; |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @Serializer\Type("integer") |
|
52
|
|
|
* |
|
53
|
|
|
* @var int |
|
54
|
|
|
*/ |
|
55
|
|
|
private $maxAge; |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @Serializer\XmlElement(cdata=false) |
|
59
|
|
|
* |
|
60
|
|
|
* @var string |
|
61
|
|
|
*/ |
|
62
|
|
|
private $notificationURL; |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @param Order $order |
|
66
|
|
|
*/ |
|
67
|
26 |
|
public function __construct(Order $order = null) |
|
68
|
|
|
{ |
|
69
|
26 |
|
$this->order = $order ?: new Order(); |
|
70
|
26 |
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @return Order |
|
74
|
|
|
*/ |
|
75
|
7 |
|
public function getOrder() |
|
76
|
|
|
{ |
|
77
|
7 |
|
return $this->order; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @return Customer |
|
82
|
|
|
*/ |
|
83
|
5 |
|
public function getCustomer() |
|
84
|
|
|
{ |
|
85
|
5 |
|
return $this->customer; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @param Customer $customer |
|
90
|
|
|
*/ |
|
91
|
5 |
|
public function setCustomer(Customer $customer) |
|
92
|
|
|
{ |
|
93
|
5 |
|
$this->customer = $customer; |
|
94
|
5 |
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* @return string |
|
98
|
|
|
*/ |
|
99
|
5 |
|
public function getRedirectTo() |
|
100
|
|
|
{ |
|
101
|
5 |
|
return $this->redirectTo; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @param string $redirectTo |
|
106
|
|
|
*/ |
|
107
|
4 |
|
public function setRedirectTo($redirectTo) |
|
108
|
|
|
{ |
|
109
|
4 |
|
$this->redirectTo = $redirectTo; |
|
110
|
4 |
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* @return int |
|
114
|
|
|
*/ |
|
115
|
5 |
|
public function getMaxUses() |
|
116
|
|
|
{ |
|
117
|
5 |
|
return $this->maxUses; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* @param int $maxUses |
|
122
|
|
|
*/ |
|
123
|
4 |
|
public function setMaxUses($maxUses) |
|
124
|
|
|
{ |
|
125
|
4 |
|
$this->maxUses = $maxUses; |
|
126
|
4 |
|
} |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* @return int |
|
130
|
|
|
*/ |
|
131
|
5 |
|
public function getMaxAge() |
|
132
|
|
|
{ |
|
133
|
5 |
|
return $this->maxAge; |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
/** |
|
137
|
|
|
* @param int $maxAge |
|
138
|
|
|
*/ |
|
139
|
4 |
|
public function setMaxAge($maxAge) |
|
140
|
|
|
{ |
|
141
|
4 |
|
$this->maxAge = $maxAge; |
|
142
|
4 |
|
} |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* @return string |
|
146
|
|
|
*/ |
|
147
|
4 |
|
public function getNotificationURL() |
|
148
|
|
|
{ |
|
149
|
4 |
|
return $this->notificationURL; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* @param string $notificationURL |
|
154
|
|
|
*/ |
|
155
|
1 |
|
public function setNotificationURL($notificationURL) |
|
156
|
|
|
{ |
|
157
|
1 |
|
$this->notificationURL = $notificationURL; |
|
158
|
1 |
|
} |
|
159
|
|
|
} |
|
160
|
|
|
|