1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Fhp\Model\StatementOfAccount; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class Transaction |
7
|
|
|
* @package Fhp\Model\StatementOfAccount |
8
|
|
|
*/ |
9
|
|
|
class Transaction |
10
|
|
|
{ |
11
|
|
|
const CD_CREDIT = 'credit'; |
12
|
|
|
const CD_DEBIT = 'debit'; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @var \DateTime|null |
16
|
|
|
*/ |
17
|
|
|
protected $bookingDate; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @var \DateTime|null |
21
|
|
|
*/ |
22
|
|
|
protected $valutaDate; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var float |
26
|
|
|
*/ |
27
|
|
|
protected $amount; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var string |
31
|
|
|
*/ |
32
|
|
|
protected $creditDebit; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var string |
36
|
|
|
*/ |
37
|
|
|
protected $bookingText; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var string |
41
|
|
|
*/ |
42
|
|
|
protected $description1; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var string |
46
|
|
|
*/ |
47
|
|
|
protected $description2; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Array keys are identifiers like "SVWZ" for the main description. |
51
|
|
|
* @var array |
52
|
|
|
*/ |
53
|
|
|
protected $structuredDescription; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @var string |
57
|
|
|
*/ |
58
|
|
|
protected $bankCode; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var string |
62
|
|
|
*/ |
63
|
|
|
protected $accountNumber; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @var string |
67
|
|
|
*/ |
68
|
|
|
protected $name; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Get booking date. |
72
|
|
|
* |
73
|
|
|
* @deprecated Use getBookingDate() instead |
74
|
|
|
* @codeCoverageIgnore |
75
|
|
|
* @return \DateTime|null |
76
|
|
|
*/ |
77
|
|
|
public function getDate() |
78
|
|
|
{ |
79
|
|
|
return $this->getBookingDate(); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Get booking date |
84
|
|
|
* |
85
|
|
|
* @return \DateTime|null |
86
|
|
|
*/ |
87
|
1 |
|
public function getBookingDate() |
88
|
|
|
{ |
89
|
1 |
|
return $this->bookingDate; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* Get date |
94
|
|
|
* |
95
|
|
|
* @return \DateTime|null |
96
|
|
|
*/ |
97
|
1 |
|
public function getValutaDate() |
98
|
|
|
{ |
99
|
1 |
|
return $this->valutaDate; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Set booking date |
104
|
|
|
* |
105
|
|
|
* @param \DateTime|null $date |
106
|
|
|
* |
107
|
|
|
* @return $this |
108
|
|
|
*/ |
109
|
1 |
|
public function setBookingDate(\DateTime $date = null) |
110
|
|
|
{ |
111
|
1 |
|
$this->bookingDate = $date; |
112
|
|
|
|
113
|
1 |
|
return $this; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Set valuta date |
118
|
|
|
* |
119
|
|
|
* @param \DateTime|null $date |
120
|
|
|
* |
121
|
|
|
* @return $this |
122
|
|
|
*/ |
123
|
1 |
|
public function setValutaDate(\DateTime $date = null) |
124
|
|
|
{ |
125
|
1 |
|
$this->valutaDate = $date; |
126
|
|
|
|
127
|
1 |
|
return $this; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* Get amount |
132
|
|
|
* |
133
|
|
|
* @return float |
134
|
|
|
*/ |
135
|
1 |
|
public function getAmount() |
136
|
|
|
{ |
137
|
1 |
|
return $this->amount; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* Set amount |
142
|
|
|
* |
143
|
|
|
* @param float $amount |
144
|
|
|
* |
145
|
|
|
* @return $this |
146
|
|
|
*/ |
147
|
1 |
|
public function setAmount($amount) |
148
|
|
|
{ |
149
|
1 |
|
$this->amount = (float) $amount; |
150
|
|
|
|
151
|
1 |
|
return $this; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* Get creditDebit |
156
|
|
|
* |
157
|
|
|
* @return string |
158
|
|
|
*/ |
159
|
1 |
|
public function getCreditDebit() |
160
|
|
|
{ |
161
|
1 |
|
return $this->creditDebit; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* Set creditDebit |
166
|
|
|
* |
167
|
|
|
* @param string $creditDebit |
168
|
|
|
* |
169
|
|
|
* @return $this |
170
|
|
|
*/ |
171
|
1 |
|
public function setCreditDebit($creditDebit) |
172
|
|
|
{ |
173
|
1 |
|
$this->creditDebit = $creditDebit; |
174
|
|
|
|
175
|
1 |
|
return $this; |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* Get bookingText |
180
|
|
|
* |
181
|
|
|
* @return string |
182
|
|
|
*/ |
183
|
1 |
|
public function getBookingText() |
184
|
|
|
{ |
185
|
1 |
|
return $this->bookingText; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* Set bookingText |
190
|
|
|
* |
191
|
|
|
* @param string $bookingText |
192
|
|
|
* |
193
|
|
|
* @return $this |
194
|
|
|
*/ |
195
|
1 |
|
public function setBookingText($bookingText) |
196
|
|
|
{ |
197
|
1 |
|
$this->bookingText = (string) $bookingText; |
198
|
|
|
|
199
|
1 |
|
return $this; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* Get description1 |
204
|
|
|
* |
205
|
|
|
* @return string |
206
|
|
|
*/ |
207
|
1 |
|
public function getDescription1() |
208
|
|
|
{ |
209
|
1 |
|
return $this->description1; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* Set description1 |
214
|
|
|
* |
215
|
|
|
* @param string $description1 |
216
|
|
|
* |
217
|
|
|
* @return $this |
218
|
|
|
*/ |
219
|
1 |
|
public function setDescription1($description1) |
220
|
|
|
{ |
221
|
1 |
|
$this->description1 = (string) $description1; |
222
|
|
|
|
223
|
1 |
|
return $this; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* Get description2 |
228
|
|
|
* |
229
|
|
|
* @return string |
230
|
|
|
*/ |
231
|
1 |
|
public function getDescription2() |
232
|
|
|
{ |
233
|
1 |
|
return $this->description2; |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* Set description2 |
238
|
|
|
* |
239
|
|
|
* @param string $description2 |
240
|
|
|
* |
241
|
|
|
* @return $this |
242
|
|
|
*/ |
243
|
1 |
|
public function setDescription2($description2) |
244
|
|
|
{ |
245
|
1 |
|
$this->description2 = (string) $description2; |
246
|
|
|
|
247
|
1 |
|
return $this; |
248
|
|
|
} |
249
|
|
|
|
250
|
|
|
/** |
251
|
|
|
* Get structuredDescription |
252
|
|
|
* |
253
|
|
|
* @return array |
254
|
|
|
*/ |
255
|
|
|
public function getStructuredDescription() |
256
|
|
|
{ |
257
|
|
|
return $this->structuredDescription; |
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
/** |
261
|
|
|
* Set structuredDescription |
262
|
|
|
* |
263
|
|
|
* @param array $structuredDescription |
264
|
|
|
* |
265
|
|
|
* @return $this |
266
|
|
|
*/ |
267
|
|
|
public function setStructuredDescription($structuredDescription) |
268
|
|
|
{ |
269
|
|
|
$this->structuredDescription = $structuredDescription; |
270
|
|
|
|
271
|
|
|
return $this; |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
/** |
275
|
|
|
* Get the main description (SVWZ) |
276
|
|
|
* |
277
|
|
|
* @return string |
278
|
|
|
*/ |
279
|
|
|
public function getMainDescription() |
280
|
|
|
{ |
281
|
|
|
if (array_key_exists('SVWZ', $this->structuredDescription)) { |
282
|
|
|
return $this->structuredDescription['SVWZ']; |
283
|
|
|
} else { |
284
|
|
|
return ""; |
285
|
|
|
} |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
/** |
289
|
|
|
* Get bankCode |
290
|
|
|
* |
291
|
|
|
* @return string |
292
|
|
|
*/ |
293
|
1 |
|
public function getBankCode() |
294
|
|
|
{ |
295
|
1 |
|
return $this->bankCode; |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* Set bankCode |
300
|
|
|
* |
301
|
|
|
* @param string $bankCode |
302
|
|
|
* |
303
|
|
|
* @return $this |
304
|
|
|
*/ |
305
|
1 |
|
public function setBankCode($bankCode) |
306
|
|
|
{ |
307
|
1 |
|
$this->bankCode = (string) $bankCode; |
308
|
|
|
|
309
|
1 |
|
return $this; |
310
|
|
|
} |
311
|
|
|
|
312
|
|
|
/** |
313
|
|
|
* Get accountNumber |
314
|
|
|
* |
315
|
|
|
* @return string |
316
|
|
|
*/ |
317
|
1 |
|
public function getAccountNumber() |
318
|
|
|
{ |
319
|
1 |
|
return $this->accountNumber; |
320
|
|
|
} |
321
|
|
|
|
322
|
|
|
/** |
323
|
|
|
* Set accountNumber |
324
|
|
|
* |
325
|
|
|
* @param string $accountNumber |
326
|
|
|
* |
327
|
|
|
* @return $this |
328
|
|
|
*/ |
329
|
1 |
|
public function setAccountNumber($accountNumber) |
330
|
|
|
{ |
331
|
1 |
|
$this->accountNumber = (string) $accountNumber; |
332
|
|
|
|
333
|
1 |
|
return $this; |
334
|
|
|
} |
335
|
|
|
|
336
|
|
|
/** |
337
|
|
|
* Get name |
338
|
|
|
* |
339
|
|
|
* @return string |
340
|
|
|
*/ |
341
|
1 |
|
public function getName() |
342
|
|
|
{ |
343
|
1 |
|
return $this->name; |
344
|
|
|
} |
345
|
|
|
|
346
|
|
|
/** |
347
|
|
|
* Set name |
348
|
|
|
* |
349
|
|
|
* @param string $name |
350
|
|
|
* |
351
|
|
|
* @return $this |
352
|
|
|
*/ |
353
|
1 |
|
public function setName($name) |
354
|
|
|
{ |
355
|
1 |
|
$this->name = (string) $name; |
356
|
|
|
|
357
|
1 |
|
return $this; |
358
|
|
|
} |
359
|
|
|
} |
360
|
|
|
|