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 string[] |
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
|
|
|
* See https://www.bayernlb.de/internet/media/de/ir/downloads_1/zahlungsverkehr/formate_1/MT940_942.pdf page 451 / 8.2.6 Geschäftsvorfallcodes |
72
|
|
|
* @var string |
73
|
|
|
*/ |
74
|
|
|
protected $transactionCode; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Get booking date. |
78
|
|
|
* |
79
|
|
|
* @deprecated Use getBookingDate() instead |
80
|
|
|
* @codeCoverageIgnore |
81
|
|
|
* @return \DateTime|null |
82
|
|
|
*/ |
83
|
|
|
public function getDate() |
84
|
|
|
{ |
85
|
|
|
return $this->getBookingDate(); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Get booking date |
90
|
|
|
* |
91
|
|
|
* @return \DateTime|null |
92
|
|
|
*/ |
93
|
1 |
|
public function getBookingDate() |
94
|
|
|
{ |
95
|
1 |
|
return $this->bookingDate; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Get date |
100
|
|
|
* |
101
|
|
|
* @return \DateTime|null |
102
|
|
|
*/ |
103
|
1 |
|
public function getValutaDate() |
104
|
|
|
{ |
105
|
1 |
|
return $this->valutaDate; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Set booking date |
110
|
|
|
* |
111
|
|
|
* @param \DateTime|null $date |
112
|
|
|
* |
113
|
|
|
* @return $this |
114
|
|
|
*/ |
115
|
1 |
|
public function setBookingDate(\DateTime $date = null) |
116
|
|
|
{ |
117
|
1 |
|
$this->bookingDate = $date; |
118
|
|
|
|
119
|
1 |
|
return $this; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Set valuta date |
124
|
|
|
* |
125
|
|
|
* @param \DateTime|null $date |
126
|
|
|
* |
127
|
|
|
* @return $this |
128
|
|
|
*/ |
129
|
1 |
|
public function setValutaDate(\DateTime $date = null) |
130
|
|
|
{ |
131
|
1 |
|
$this->valutaDate = $date; |
132
|
|
|
|
133
|
1 |
|
return $this; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Get amount |
138
|
|
|
* |
139
|
|
|
* @return float |
140
|
|
|
*/ |
141
|
1 |
|
public function getAmount() |
142
|
|
|
{ |
143
|
1 |
|
return $this->amount; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* Set amount |
148
|
|
|
* |
149
|
|
|
* @param float $amount |
150
|
|
|
* |
151
|
|
|
* @return $this |
152
|
|
|
*/ |
153
|
1 |
|
public function setAmount($amount) |
154
|
|
|
{ |
155
|
1 |
|
$this->amount = (float) $amount; |
156
|
|
|
|
157
|
1 |
|
return $this; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* Get creditDebit |
162
|
|
|
* |
163
|
|
|
* @return string |
164
|
|
|
*/ |
165
|
1 |
|
public function getCreditDebit() |
166
|
|
|
{ |
167
|
1 |
|
return $this->creditDebit; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* Set creditDebit |
172
|
|
|
* |
173
|
|
|
* @param string $creditDebit |
174
|
|
|
* |
175
|
|
|
* @return $this |
176
|
|
|
*/ |
177
|
1 |
|
public function setCreditDebit($creditDebit) |
178
|
|
|
{ |
179
|
1 |
|
$this->creditDebit = $creditDebit; |
180
|
|
|
|
181
|
1 |
|
return $this; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* Get bookingText |
186
|
|
|
* |
187
|
|
|
* @return string |
188
|
|
|
*/ |
189
|
1 |
|
public function getBookingText() |
190
|
|
|
{ |
191
|
1 |
|
return $this->bookingText; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* Set bookingText |
196
|
|
|
* |
197
|
|
|
* @param string $bookingText |
198
|
|
|
* |
199
|
|
|
* @return $this |
200
|
|
|
*/ |
201
|
1 |
|
public function setBookingText($bookingText) |
202
|
|
|
{ |
203
|
1 |
|
$this->bookingText = (string) $bookingText; |
204
|
|
|
|
205
|
1 |
|
return $this; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* Get description1 |
210
|
|
|
* |
211
|
|
|
* @return string |
212
|
|
|
*/ |
213
|
1 |
|
public function getDescription1() |
214
|
|
|
{ |
215
|
1 |
|
return $this->description1; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
/** |
219
|
|
|
* Set description1 |
220
|
|
|
* |
221
|
|
|
* @param string $description1 |
222
|
|
|
* |
223
|
|
|
* @return $this |
224
|
|
|
*/ |
225
|
1 |
|
public function setDescription1($description1) |
226
|
|
|
{ |
227
|
1 |
|
$this->description1 = (string) $description1; |
228
|
|
|
|
229
|
1 |
|
return $this; |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
/** |
233
|
|
|
* Get description2 |
234
|
|
|
* |
235
|
|
|
* @return string |
236
|
|
|
*/ |
237
|
1 |
|
public function getDescription2() |
238
|
|
|
{ |
239
|
1 |
|
return $this->description2; |
240
|
|
|
} |
241
|
|
|
|
242
|
|
|
/** |
243
|
|
|
* Set description2 |
244
|
|
|
* |
245
|
|
|
* @param string $description2 |
246
|
|
|
* |
247
|
|
|
* @return $this |
248
|
|
|
*/ |
249
|
1 |
|
public function setDescription2($description2) |
250
|
|
|
{ |
251
|
1 |
|
$this->description2 = (string) $description2; |
252
|
|
|
|
253
|
1 |
|
return $this; |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* Get structuredDescription |
258
|
|
|
* |
259
|
|
|
* @return string[] |
260
|
|
|
*/ |
261
|
|
|
public function getStructuredDescription() |
262
|
|
|
{ |
263
|
|
|
return $this->structuredDescription; |
264
|
|
|
} |
265
|
|
|
|
266
|
|
|
/** |
267
|
|
|
* Set structuredDescription |
268
|
|
|
* |
269
|
|
|
* @param string[] $structuredDescription |
270
|
|
|
* |
271
|
|
|
* @return $this |
272
|
|
|
*/ |
273
|
|
|
public function setStructuredDescription($structuredDescription) |
274
|
|
|
{ |
275
|
|
|
$this->structuredDescription = $structuredDescription; |
276
|
|
|
|
277
|
|
|
return $this; |
278
|
|
|
} |
279
|
|
|
|
280
|
|
|
/** |
281
|
|
|
* Get the main description (SVWZ) |
282
|
|
|
* |
283
|
|
|
* @return string |
284
|
|
|
*/ |
285
|
|
|
public function getMainDescription() |
286
|
|
|
{ |
287
|
|
|
if (array_key_exists('SVWZ', $this->structuredDescription)) { |
288
|
|
|
return $this->structuredDescription['SVWZ']; |
289
|
|
|
} else { |
290
|
|
|
return ""; |
291
|
|
|
} |
292
|
|
|
} |
293
|
|
|
|
294
|
|
|
/** |
295
|
|
|
* Get bankCode |
296
|
|
|
* |
297
|
|
|
* @return string |
298
|
|
|
*/ |
299
|
1 |
|
public function getBankCode() |
300
|
|
|
{ |
301
|
1 |
|
return $this->bankCode; |
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
/** |
305
|
|
|
* Set bankCode |
306
|
|
|
* |
307
|
|
|
* @param string $bankCode |
308
|
|
|
* |
309
|
|
|
* @return $this |
310
|
|
|
*/ |
311
|
1 |
|
public function setBankCode($bankCode) |
312
|
|
|
{ |
313
|
1 |
|
$this->bankCode = (string) $bankCode; |
314
|
|
|
|
315
|
1 |
|
return $this; |
316
|
|
|
} |
317
|
|
|
|
318
|
|
|
/** |
319
|
|
|
* Get accountNumber |
320
|
|
|
* |
321
|
|
|
* @return string |
322
|
|
|
*/ |
323
|
1 |
|
public function getAccountNumber() |
324
|
|
|
{ |
325
|
1 |
|
return $this->accountNumber; |
326
|
|
|
} |
327
|
|
|
|
328
|
|
|
/** |
329
|
|
|
* Set accountNumber |
330
|
|
|
* |
331
|
|
|
* @param string $accountNumber |
332
|
|
|
* |
333
|
|
|
* @return $this |
334
|
|
|
*/ |
335
|
1 |
|
public function setAccountNumber($accountNumber) |
336
|
|
|
{ |
337
|
1 |
|
$this->accountNumber = (string) $accountNumber; |
338
|
|
|
|
339
|
1 |
|
return $this; |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
/** |
343
|
|
|
* Get name |
344
|
|
|
* |
345
|
|
|
* @return string |
346
|
|
|
*/ |
347
|
1 |
|
public function getName() |
348
|
|
|
{ |
349
|
1 |
|
return $this->name; |
350
|
|
|
} |
351
|
|
|
|
352
|
|
|
/** |
353
|
|
|
* Set name |
354
|
|
|
* |
355
|
|
|
* @param string $name |
356
|
|
|
* |
357
|
|
|
* @return $this |
358
|
|
|
*/ |
359
|
1 |
|
public function setName($name) |
360
|
|
|
{ |
361
|
1 |
|
$this->name = (string) $name; |
362
|
|
|
|
363
|
1 |
|
return $this; |
364
|
|
|
} |
365
|
|
|
|
366
|
|
|
/** |
367
|
|
|
* Get see https://www.bayernlb.de/internet/media/de/ir/downloads_1/zahlungsverkehr/formate_1/MT940_942.pdf page 451 / 8.2.6 Geschäftsvorfallcodes |
368
|
|
|
* |
369
|
|
|
* @return string |
370
|
|
|
*/ |
371
|
|
|
public function getTransactionCode() |
372
|
|
|
{ |
373
|
|
|
return $this->transactionCode; |
374
|
|
|
} |
375
|
|
|
|
376
|
|
|
/** |
377
|
|
|
* Set see https://www.bayernlb.de/internet/media/de/ir/downloads_1/zahlungsverkehr/formate_1/MT940_942.pdf page 451 / 8.2.6 Geschäftsvorfallcodes |
378
|
|
|
* |
379
|
|
|
* @param string $transactionCode See https://www.bayernlb.de/internet/media/de/ir/downloads_1/zahlungsverkehr/formate_1/MT940_942.pdf page 451 / 8.2.6 Geschäftsvorfallcodes |
380
|
|
|
* |
381
|
|
|
* @return self |
382
|
|
|
*/ |
383
|
|
|
public function setTransactionCode(string $transactionCode) |
384
|
|
|
{ |
385
|
|
|
$this->transactionCode = $transactionCode; |
386
|
|
|
|
387
|
|
|
return $this; |
388
|
|
|
} |
389
|
|
|
} |
390
|
|
|
|