1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Transaction. |
4
|
|
|
* |
5
|
|
|
* @author Pronamic <[email protected]> |
6
|
|
|
* @copyright 2005-2021 Pronamic |
7
|
|
|
* @license GPL-3.0-or-later |
8
|
|
|
* @package Pronamic\WordPress\Pay |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Pronamic\WordPress\Pay\Gateways\IDealAdvancedV3; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Title: Transaction |
15
|
|
|
* Description: |
16
|
|
|
* Copyright: 2005-2021 Pronamic |
17
|
|
|
* Company: Pronamic |
18
|
|
|
* |
19
|
|
|
* @author Remco Tolsma |
20
|
|
|
* @version 2.0.0 |
21
|
|
|
*/ |
22
|
|
|
class Transaction { |
23
|
|
|
/** |
24
|
|
|
* Transaction ID |
25
|
|
|
* |
26
|
|
|
* @var string|null |
27
|
|
|
*/ |
28
|
|
|
private $id; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Purchase ID |
32
|
|
|
* |
33
|
|
|
* @var string|null |
34
|
|
|
*/ |
35
|
|
|
private $purchase_id; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Amount |
39
|
|
|
* |
40
|
|
|
* @var string|null |
41
|
|
|
*/ |
42
|
|
|
private $amount; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Currency |
46
|
|
|
* |
47
|
|
|
* @var string|null |
48
|
|
|
*/ |
49
|
|
|
private $currency; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Timeframe during which the transaction is allowed to take |
53
|
|
|
* place. Notation PnYnMnDTnHnMnS, where every n |
54
|
|
|
* indicates the number of years, months, days, hours, minutes |
55
|
|
|
* and seconds respectively. E.g. PT1H indicates an expiration |
56
|
|
|
* period of 1 hour. PT3M30S indicates a period of 3 and a half |
57
|
|
|
* minutes. Maximum allowed is PT1H; minimum allowed is |
58
|
|
|
* PT1M. |
59
|
|
|
* |
60
|
|
|
* @var string|null |
61
|
|
|
*/ |
62
|
|
|
private $expiration_period; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Language |
66
|
|
|
* |
67
|
|
|
* @var string|null |
68
|
|
|
*/ |
69
|
|
|
private $language; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Description |
73
|
|
|
* |
74
|
|
|
* @var string|null |
75
|
|
|
*/ |
76
|
|
|
private $description; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Mandatory code to identify the customer when he/she is |
80
|
|
|
* redirected back to the merchantReturnURL |
81
|
|
|
* |
82
|
|
|
* @var string|null |
83
|
|
|
*/ |
84
|
|
|
private $entrance_code; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* The status of this transaction |
88
|
|
|
* |
89
|
|
|
* @var string|null |
90
|
|
|
*/ |
91
|
|
|
private $status; |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* The consumer name |
95
|
|
|
* |
96
|
|
|
* @var string|null |
97
|
|
|
*/ |
98
|
|
|
private $consumer_name; |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Consumer IBAN |
102
|
|
|
* |
103
|
|
|
* @var string|null |
104
|
|
|
*/ |
105
|
|
|
private $consumer_iban; |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Consumer BIC |
109
|
|
|
* |
110
|
|
|
* @var string|null |
111
|
|
|
*/ |
112
|
|
|
private $consumer_bic; |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* Constructs and initializes an transaction |
116
|
|
|
* |
117
|
|
|
* @return void |
118
|
|
|
*/ |
119
|
|
|
public function __construct() { |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Get the ID of this transaction |
124
|
|
|
* |
125
|
|
|
* @return string|null |
126
|
|
|
*/ |
127
|
|
|
public function get_id() { |
128
|
|
|
return $this->id; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* Set the ID of this transaction |
133
|
|
|
* |
134
|
|
|
* @param string|null $id Transaction ID. |
135
|
|
|
* @return void |
136
|
|
|
*/ |
137
|
|
|
public function set_id( $id ) { |
138
|
|
|
$this->id = $id; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* Get the purchase ID of this transaction |
143
|
|
|
* |
144
|
|
|
* The purchase number according to the online shop’s system |
145
|
|
|
* |
146
|
|
|
* @return string|null |
147
|
|
|
*/ |
148
|
|
|
public function get_purchase_id() { |
149
|
|
|
return $this->purchase_id; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* Set the purchase id of this transaction |
154
|
|
|
* |
155
|
|
|
* The purchase number according to the online shop’s system |
156
|
|
|
* |
157
|
|
|
* @param string|null $id Purchase ID. |
158
|
|
|
* @return void |
159
|
|
|
*/ |
160
|
|
|
public function set_purchase_id( $id ) { |
161
|
|
|
$this->purchase_id = $id; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* Get the amount of this transaction |
166
|
|
|
* |
167
|
|
|
* @return string|null |
168
|
|
|
*/ |
169
|
|
|
public function get_amount() { |
170
|
|
|
return $this->amount; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* Set the amount of this transaction |
175
|
|
|
* |
176
|
|
|
* @param string|null $amount Amount. |
177
|
|
|
* @return void |
178
|
|
|
*/ |
179
|
|
|
public function set_amount( $amount ) { |
180
|
|
|
$this->amount = $amount; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* Get the currency of this transaction |
185
|
|
|
* |
186
|
|
|
* @return string|null |
187
|
|
|
*/ |
188
|
|
|
public function get_currency() { |
189
|
|
|
return $this->currency; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* Set the currency of this transaction |
194
|
|
|
* |
195
|
|
|
* @param string|null $currency Currency. |
196
|
|
|
* @return void |
197
|
|
|
*/ |
198
|
|
|
public function set_currency( $currency ) { |
199
|
|
|
$this->currency = $currency; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* Get the expiration period of this transaction |
204
|
|
|
* |
205
|
|
|
* @return string|null |
206
|
|
|
*/ |
207
|
|
|
public function get_expiration_period() { |
208
|
|
|
return $this->expiration_period; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* Set the expiration period of this transaction |
213
|
|
|
* |
214
|
|
|
* @param string|null $expiration_period Expiration period in date interval specification notation (e.g. `PT30M`). |
215
|
|
|
* @return void |
216
|
|
|
*/ |
217
|
|
|
public function set_expiration_period( $expiration_period ) { |
218
|
|
|
$this->expiration_period = $expiration_period; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* Get the language of this transaction |
223
|
|
|
* |
224
|
|
|
* @return string|null |
225
|
|
|
*/ |
226
|
|
|
public function get_language() { |
227
|
|
|
return $this->language; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* Set the language of this transaction |
232
|
|
|
* |
233
|
|
|
* @param string|null $language Language. |
234
|
|
|
* @return void |
235
|
|
|
*/ |
236
|
|
|
public function set_language( $language ) { |
237
|
|
|
$this->language = $language; |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* Get the description of this transaction |
242
|
|
|
* |
243
|
|
|
* @return string|null |
244
|
|
|
*/ |
245
|
|
|
public function get_description() { |
246
|
|
|
return $this->description; |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
/** |
250
|
|
|
* Set the description of this transaction |
251
|
|
|
* AN..max32 (AN = Alphanumerical, free text) |
252
|
|
|
* |
253
|
|
|
* @param string|null $description Description. |
254
|
|
|
* @return void |
255
|
|
|
*/ |
256
|
|
|
public function set_description( $description ) { |
257
|
|
|
if ( null !== $description ) { |
258
|
|
|
$description = substr( $description, 0, 32 ); |
259
|
|
|
} |
260
|
|
|
|
261
|
|
|
$this->description = $description; |
262
|
|
|
} |
263
|
|
|
|
264
|
|
|
/** |
265
|
|
|
* Get the entrance code of this transaction |
266
|
|
|
* |
267
|
|
|
* A code determined by the online shop with which the purchase can be |
268
|
|
|
* authenticated upon redirection to the online shop (see section 4.2.2 |
269
|
|
|
* for details). |
270
|
|
|
* |
271
|
|
|
* @return string|null |
272
|
|
|
*/ |
273
|
|
|
public function get_entrance_code() { |
274
|
|
|
return $this->entrance_code; |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
/** |
278
|
|
|
* Set the entrance code |
279
|
|
|
* ANS..max40 (ANS = Strictly alphanumerical (letters and numbers only)) |
280
|
|
|
* |
281
|
|
|
* A code determined by the online shop with which the purchase can be |
282
|
|
|
* authenticated upon redirection to the online shop (see section 4.2.2 |
283
|
|
|
* for details). |
284
|
|
|
* |
285
|
|
|
* @param string|null $entrance_code Entrance code. |
286
|
|
|
* @return void |
287
|
|
|
*/ |
288
|
|
|
public function set_entrance_code( $entrance_code ) { |
289
|
|
|
if ( null !== $entrance_code ) { |
290
|
|
|
$entrance_code = substr( $entrance_code, 0, 40 ); |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
$this->entrance_code = $entrance_code; |
294
|
|
|
} |
295
|
|
|
|
296
|
|
|
/** |
297
|
|
|
* Get the status of this transaction |
298
|
|
|
* |
299
|
|
|
* @return string|null |
300
|
|
|
*/ |
301
|
|
|
public function get_status() { |
302
|
|
|
return $this->status; |
303
|
|
|
} |
304
|
|
|
|
305
|
|
|
/** |
306
|
|
|
* Set the status |
307
|
|
|
* |
308
|
|
|
* @param string|null $status Status. |
309
|
|
|
* @return void |
310
|
|
|
*/ |
311
|
|
|
public function set_status( $status ) { |
312
|
|
|
$this->status = $status; |
313
|
|
|
} |
314
|
|
|
|
315
|
|
|
/** |
316
|
|
|
* Get the consumer name |
317
|
|
|
* |
318
|
|
|
* @return string|null |
319
|
|
|
*/ |
320
|
|
|
public function get_consumer_name() { |
321
|
|
|
return $this->consumer_name; |
322
|
|
|
} |
323
|
|
|
|
324
|
|
|
/** |
325
|
|
|
* Set the consumer name |
326
|
|
|
* |
327
|
|
|
* @param string|null $name Consumer name. |
328
|
|
|
* @return void |
329
|
|
|
*/ |
330
|
|
|
public function set_consumer_name( $name ) { |
331
|
|
|
$this->consumer_name = $name; |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
/** |
335
|
|
|
* Get the consumer IBAN number |
336
|
|
|
* |
337
|
|
|
* @return string|null |
338
|
|
|
*/ |
339
|
|
|
public function get_consumer_iban() { |
340
|
|
|
return $this->consumer_iban; |
341
|
|
|
} |
342
|
|
|
|
343
|
|
|
/** |
344
|
|
|
* Set the consumer IBAN number |
345
|
|
|
* |
346
|
|
|
* @param string|null $iban Consumer IBAN. |
347
|
|
|
* @return void |
348
|
|
|
*/ |
349
|
|
|
public function set_consumer_iban( $iban ) { |
350
|
|
|
$this->consumer_iban = $iban; |
351
|
|
|
} |
352
|
|
|
|
353
|
|
|
/** |
354
|
|
|
* Get the consumer BIC number |
355
|
|
|
* |
356
|
|
|
* @return string|null |
357
|
|
|
*/ |
358
|
|
|
public function get_consumer_bic() { |
359
|
|
|
return $this->consumer_bic; |
360
|
|
|
} |
361
|
|
|
|
362
|
|
|
/** |
363
|
|
|
* Set the consumer BIC number |
364
|
|
|
* |
365
|
|
|
* @param string|null $bic Consumer BIC. |
366
|
|
|
* @return void |
367
|
|
|
*/ |
368
|
|
|
public function set_consumer_bic( $bic ) { |
369
|
|
|
$this->consumer_bic = $bic; |
370
|
|
|
} |
371
|
|
|
} |
372
|
|
|
|