|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Generalization over Omnipay and Payum |
|
4
|
|
|
* |
|
5
|
|
|
* @link https://github.com/hiqdev/php-merchant |
|
6
|
|
|
* @package php-merchant |
|
7
|
|
|
* @license BSD-3-Clause |
|
8
|
|
|
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/) |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace hiqdev\php\merchant; |
|
12
|
|
|
|
|
13
|
|
|
use Money\Currency; |
|
14
|
|
|
use Money\Money; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Class Invoice. |
|
18
|
|
|
* |
|
19
|
|
|
* Many methods depend on [[amount]], so make sure to set as early as possible. |
|
20
|
|
|
* |
|
21
|
|
|
* @author Dmytro Naumenko <[email protected]> |
|
22
|
|
|
*/ |
|
23
|
|
|
final class Invoice implements InvoiceInterface |
|
24
|
|
|
{ |
|
25
|
|
|
private $id; |
|
26
|
|
|
private $client; |
|
27
|
|
|
private $amount; |
|
28
|
|
|
private $description; |
|
29
|
|
|
private $returnUrl; |
|
30
|
|
|
private $notifyUrl; |
|
31
|
|
|
private $cancelUrl; |
|
32
|
|
|
private $returnMethod; |
|
33
|
|
|
private $notifyMethod; |
|
34
|
|
|
private $cancelMethod; |
|
35
|
|
|
private $currency; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @return string |
|
39
|
|
|
*/ |
|
40
|
11 |
|
public function getId() |
|
41
|
|
|
{ |
|
42
|
11 |
|
return $this->id; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @param string $id |
|
47
|
|
|
* @return Invoice |
|
48
|
|
|
*/ |
|
49
|
11 |
|
public function setId($id) |
|
50
|
|
|
{ |
|
51
|
11 |
|
$this->id = (string) $id; |
|
52
|
|
|
|
|
53
|
11 |
|
return $this; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
3 |
|
public function getClient() |
|
57
|
|
|
{ |
|
58
|
3 |
|
return $this->client; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
9 |
|
public function setClient($client) |
|
62
|
|
|
{ |
|
63
|
9 |
|
$this->client = (string) $client; |
|
64
|
|
|
|
|
65
|
9 |
|
return $this; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
11 |
|
public function getAmount(): Money |
|
69
|
|
|
{ |
|
70
|
11 |
|
return $this->amount; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
11 |
|
public function setAmount(Money $amount) |
|
74
|
|
|
{ |
|
75
|
11 |
|
$this->amount = $amount; |
|
76
|
11 |
|
$this->currency = $amount->getCurrency(); |
|
77
|
|
|
|
|
78
|
11 |
|
return $this; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
10 |
|
public function getDescription() |
|
82
|
|
|
{ |
|
83
|
10 |
|
return $this->description; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
11 |
|
public function setDescription($description) |
|
87
|
|
|
{ |
|
88
|
11 |
|
$this->description = (string) $description; |
|
89
|
|
|
|
|
90
|
11 |
|
return $this; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
9 |
|
public function getReturnUrl() |
|
94
|
|
|
{ |
|
95
|
9 |
|
return $this->returnUrl; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
11 |
|
public function setReturnUrl($returnUrl) |
|
99
|
|
|
{ |
|
100
|
11 |
|
$this->returnUrl = $returnUrl; |
|
101
|
|
|
|
|
102
|
11 |
|
return $this; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
9 |
|
public function getNotifyUrl() |
|
106
|
|
|
{ |
|
107
|
9 |
|
return $this->notifyUrl; |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
11 |
|
public function setNotifyUrl($notifyUrl) |
|
111
|
|
|
{ |
|
112
|
11 |
|
$this->notifyUrl = $notifyUrl; |
|
113
|
|
|
|
|
114
|
11 |
|
return $this; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
9 |
|
public function getCancelUrl() |
|
118
|
|
|
{ |
|
119
|
9 |
|
return $this->cancelUrl; |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
11 |
|
public function setCancelUrl($cancelUrl) |
|
123
|
|
|
{ |
|
124
|
11 |
|
$this->cancelUrl = $cancelUrl; |
|
125
|
|
|
|
|
126
|
11 |
|
return $this; |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
/** |
|
130
|
|
|
* @return Currency |
|
131
|
|
|
*/ |
|
132
|
11 |
|
public function getCurrency(): Currency |
|
133
|
|
|
{ |
|
134
|
11 |
|
return $this->currency; |
|
135
|
|
|
} |
|
136
|
|
|
|
|
137
|
|
|
/** |
|
138
|
|
|
* @return string |
|
139
|
|
|
*/ |
|
140
|
2 |
|
public function getReturnMethod() |
|
141
|
|
|
{ |
|
142
|
2 |
|
return $this->returnMethod; |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* @param string $returnMethod |
|
147
|
|
|
* @return InvoiceInterface |
|
148
|
|
|
*/ |
|
149
|
3 |
|
public function setReturnMethod($returnMethod) |
|
150
|
|
|
{ |
|
151
|
3 |
|
$this->returnMethod = $returnMethod; |
|
152
|
|
|
|
|
153
|
3 |
|
return $this; |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
|
/** |
|
157
|
|
|
* @return string |
|
158
|
|
|
*/ |
|
159
|
2 |
|
public function getNotifyMethod() |
|
160
|
|
|
{ |
|
161
|
2 |
|
return $this->notifyMethod; |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
|
|
/** |
|
165
|
|
|
* @param string $notifyMethod |
|
166
|
|
|
* @return InvoiceInterface |
|
167
|
|
|
*/ |
|
168
|
3 |
|
public function setNotifyMethod($notifyMethod) |
|
169
|
|
|
{ |
|
170
|
3 |
|
$this->notifyMethod = $notifyMethod; |
|
171
|
|
|
|
|
172
|
3 |
|
return $this; |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
/** |
|
176
|
|
|
* @return string |
|
177
|
|
|
*/ |
|
178
|
2 |
|
public function getCancelMethod() |
|
179
|
|
|
{ |
|
180
|
2 |
|
return $this->cancelMethod; |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
/** |
|
184
|
|
|
* @param string $cancelMethod |
|
185
|
|
|
* @return InvoiceInterface |
|
186
|
|
|
*/ |
|
187
|
3 |
|
public function setCancelMethod($cancelMethod) |
|
188
|
|
|
{ |
|
189
|
3 |
|
$this->cancelMethod = $cancelMethod; |
|
190
|
|
|
|
|
191
|
3 |
|
return $this; |
|
192
|
|
|
} |
|
193
|
|
|
} |
|
194
|
|
|
|