@@ 80-88 (lines=9) @@ | ||
77 | * |
|
78 | * {@inheritdoc} |
|
79 | */ |
|
80 | protected function parseTransactionEntryTimestamp() |
|
81 | { |
|
82 | $results = []; |
|
83 | if (preg_match('/^:60F:[C|D]([\d]{6})/m', $this->getCurrentStatementData(), $results) && !empty($results[1])) { |
|
84 | return $this->sanitizeTimestamp($results[1], 'ymd'); |
|
85 | } |
|
86 | ||
87 | return 0; |
|
88 | } |
|
89 | ||
90 | /** |
|
91 | * Overloaded: Rabo has different way of storing transaction value timestamps (ymd). |
|
@@ 95-103 (lines=9) @@ | ||
92 | * |
|
93 | * {@inheritdoc} |
|
94 | */ |
|
95 | protected function parseTransactionValueTimestamp() |
|
96 | { |
|
97 | $results = []; |
|
98 | if (preg_match('/^:61:([\d]{6})[C|D]/', $this->getCurrentTransactionData(), $results) && !empty($results[1])) { |
|
99 | return $this->sanitizeTimestamp($results[1], 'ymd'); |
|
100 | } |
|
101 | ||
102 | return 0; |
|
103 | } |
|
104 | ||
105 | /** |
|
106 | * Overloaded: Rabo uses longer strings for accountnumbers. |
@@ 71-81 (lines=11) @@ | ||
68 | * |
|
69 | * {@inheritdoc} |
|
70 | */ |
|
71 | protected function parseTransactionPrice() |
|
72 | { |
|
73 | $results = []; |
|
74 | if (preg_match('/^:61:.*[CD][a-zA-Z]?([\d,\.]+)N/i', $this->getCurrentTransactionData(), $results) |
|
75 | && !empty($results[1]) |
|
76 | ) { |
|
77 | return $this->sanitizePrice($results[1]); |
|
78 | } |
|
79 | ||
80 | return 0; |
|
81 | } |
|
82 | ||
83 | /** |
|
84 | * Overloaded: Sparkasse can have the 3rd character of the currencyname after the C/D and an "R" for cancellation befor the C/D. |
|
@@ 88-98 (lines=11) @@ | ||
85 | * |
|
86 | * {@inheritdoc} |
|
87 | */ |
|
88 | protected function parseTransactionDebitCredit() |
|
89 | { |
|
90 | $results = []; |
|
91 | if (preg_match('/^:61:\d+R?([CD]).?\d+/', $this->getCurrentTransactionData(), $results) |
|
92 | && !empty($results[1]) |
|
93 | ) { |
|
94 | return $this->sanitizeDebitCredit($results[1]); |
|
95 | } |
|
96 | ||
97 | return ''; |
|
98 | } |
|
99 | ||
100 | /** |
|
101 | * Overloaded: Sparkasse does not have a header line. |
@@ 28-38 (lines=11) @@ | ||
25 | * |
|
26 | * {@inheritdoc} |
|
27 | */ |
|
28 | protected function parseStatementAccount() |
|
29 | { |
|
30 | $results = []; |
|
31 | if (preg_match('#:25:TRIODOSBANK/([\d\.]+)#', $this->getCurrentStatementData(), $results) |
|
32 | && !empty($results[1]) |
|
33 | ) { |
|
34 | return $this->sanitizeAccount($results[1]); |
|
35 | } |
|
36 | ||
37 | return parent::parseStatementAccount(); |
|
38 | } |
|
39 | ||
40 | /** |
|
41 | * Overloaded: According to spec, field :28: is always 1. |
@@ 38-46 (lines=9) @@ | ||
35 | } |
|
36 | } |
|
37 | ||
38 | protected function parseTransactionAccountName() |
|
39 | { |
|
40 | $results = []; |
|
41 | if (preg_match('/^:86:.*?\/NAAM: (.*?)\s*:\d{2}.?:/ims', $this->getCurrentTransactionData(), $results) |
|
42 | && !empty($results[1]) |
|
43 | ) { |
|
44 | return $results[1]; |
|
45 | } |
|
46 | } |
|
47 | ||
48 | protected function parseTransactionDescription() |
|
49 | { |
@@ 353-363 (lines=11) @@ | ||
350 | * |
|
351 | * @return string |
|
352 | */ |
|
353 | protected function parseStatementNumber() |
|
354 | { |
|
355 | $results = []; |
|
356 | if (preg_match('/:28C?:(.*)/', $this->getCurrentStatementData(), $results) |
|
357 | && !empty($results[1]) |
|
358 | ) { |
|
359 | return trim($results[1]); |
|
360 | } |
|
361 | ||
362 | return ''; |
|
363 | } |
|
364 | ||
365 | // transaction parsers, these work with getCurrentTransactionData |
|
366 | /** |
|
@@ 371-381 (lines=11) @@ | ||
368 | * |
|
369 | * @return string |
|
370 | */ |
|
371 | protected function parseTransactionAccount() |
|
372 | { |
|
373 | $results = []; |
|
374 | if (preg_match('/^:86: ?([\d\.]+)\s/im', $this->getCurrentTransactionData(), $results) |
|
375 | && !empty($results[1]) |
|
376 | ) { |
|
377 | return $this->sanitizeAccount($results[1]); |
|
378 | } |
|
379 | ||
380 | return ''; |
|
381 | } |
|
382 | ||
383 | /** |
|
384 | * uses the 86 field to determine accountname of the transaction. |
|
@@ 388-398 (lines=11) @@ | ||
385 | * |
|
386 | * @return string |
|
387 | */ |
|
388 | protected function parseTransactionAccountName() |
|
389 | { |
|
390 | $results = []; |
|
391 | if (preg_match('/:86: ?[\d\.]+ (.+)/', $this->getCurrentTransactionData(), $results) |
|
392 | && !empty($results[1]) |
|
393 | ) { |
|
394 | return $this->sanitizeAccountName($results[1]); |
|
395 | } |
|
396 | ||
397 | return ''; |
|
398 | } |
|
399 | ||
400 | /** |
|
401 | * uses the 61 field to determine amount/value of the transaction. |
|
@@ 405-415 (lines=11) @@ | ||
402 | * |
|
403 | * @return float |
|
404 | */ |
|
405 | protected function parseTransactionPrice() |
|
406 | { |
|
407 | $results = []; |
|
408 | if (preg_match('/^:61:.*[CD]([\d,\.]+)N/i', $this->getCurrentTransactionData(), $results) |
|
409 | && !empty($results[1]) |
|
410 | ) { |
|
411 | return $this->sanitizePrice($results[1]); |
|
412 | } |
|
413 | ||
414 | return 0; |
|
415 | } |
|
416 | ||
417 | /** |
|
418 | * uses the 61 field to determine debit or credit of the transaction. |
|
@@ 422-432 (lines=11) @@ | ||
419 | * |
|
420 | * @return string |
|
421 | */ |
|
422 | protected function parseTransactionDebitCredit() |
|
423 | { |
|
424 | $results = []; |
|
425 | if (preg_match('/^:61:\d+([CD])\d+/', $this->getCurrentTransactionData(), $results) |
|
426 | && !empty($results[1]) |
|
427 | ) { |
|
428 | return $this->sanitizeDebitCredit($results[1]); |
|
429 | } |
|
430 | ||
431 | return ''; |
|
432 | } |
|
433 | ||
434 | /** |
|
435 | * uses the 86 field to determine retrieve the full description of the transaction. |
|
@@ 494-504 (lines=11) @@ | ||
491 | * |
|
492 | * @return string |
|
493 | */ |
|
494 | protected function parseTransactionCode() |
|
495 | { |
|
496 | $results = []; |
|
497 | if (preg_match('/^:61:.*?N(.{3}).*/', $this->getCurrentTransactionData(), $results) |
|
498 | && !empty($results[1]) |
|
499 | ) { |
|
500 | return trim($results[1]); |
|
501 | } |
|
502 | ||
503 | return ''; |
|
504 | } |
|
505 | ||
506 | /** |
|
507 | * @param string $string |