| @@ 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 use the Field 61 for cancellations |
|
| @@ 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. |
|
| @@ 355-365 (lines=11) @@ | ||
| 352 | * |
|
| 353 | * @return string |
|
| 354 | */ |
|
| 355 | protected function parseStatementNumber() |
|
| 356 | { |
|
| 357 | $results = []; |
|
| 358 | if (preg_match('/:28C?:(.*)/', $this->getCurrentStatementData(), $results) |
|
| 359 | && !empty($results[1]) |
|
| 360 | ) { |
|
| 361 | return trim($results[1]); |
|
| 362 | } |
|
| 363 | ||
| 364 | return ''; |
|
| 365 | } |
|
| 366 | ||
| 367 | // transaction parsers, these work with getCurrentTransactionData |
|
| 368 | /** |
|
| @@ 373-383 (lines=11) @@ | ||
| 370 | * |
|
| 371 | * @return string |
|
| 372 | */ |
|
| 373 | protected function parseTransactionAccount() |
|
| 374 | { |
|
| 375 | $results = []; |
|
| 376 | if (preg_match('/^:86: ?([\d\.]+)\s/im', $this->getCurrentTransactionData(), $results) |
|
| 377 | && !empty($results[1]) |
|
| 378 | ) { |
|
| 379 | return $this->sanitizeAccount($results[1]); |
|
| 380 | } |
|
| 381 | ||
| 382 | return ''; |
|
| 383 | } |
|
| 384 | ||
| 385 | /** |
|
| 386 | * uses the 86 field to determine accountname of the transaction. |
|
| @@ 390-400 (lines=11) @@ | ||
| 387 | * |
|
| 388 | * @return string |
|
| 389 | */ |
|
| 390 | protected function parseTransactionAccountName() |
|
| 391 | { |
|
| 392 | $results = []; |
|
| 393 | if (preg_match('/:86: ?[\d\.]+ (.+)/', $this->getCurrentTransactionData(), $results) |
|
| 394 | && !empty($results[1]) |
|
| 395 | ) { |
|
| 396 | return $this->sanitizeAccountName($results[1]); |
|
| 397 | } |
|
| 398 | ||
| 399 | return ''; |
|
| 400 | } |
|
| 401 | ||
| 402 | /** |
|
| 403 | * uses the 61 field to determine amount/value of the transaction. |
|
| @@ 407-417 (lines=11) @@ | ||
| 404 | * |
|
| 405 | * @return float |
|
| 406 | */ |
|
| 407 | protected function parseTransactionPrice() |
|
| 408 | { |
|
| 409 | $results = []; |
|
| 410 | if (preg_match('/^:61:.*[CD]([\d,\.]+)N/i', $this->getCurrentTransactionData(), $results) |
|
| 411 | && !empty($results[1]) |
|
| 412 | ) { |
|
| 413 | return $this->sanitizePrice($results[1]); |
|
| 414 | } |
|
| 415 | ||
| 416 | return 0; |
|
| 417 | } |
|
| 418 | ||
| 419 | /** |
|
| 420 | * uses the 61 field to determine debit or credit of the transaction. |
|
| @@ 424-434 (lines=11) @@ | ||
| 421 | * |
|
| 422 | * @return string |
|
| 423 | */ |
|
| 424 | protected function parseTransactionDebitCredit() |
|
| 425 | { |
|
| 426 | $results = []; |
|
| 427 | if (preg_match('/^:61:\d+([CD])\d+/', $this->getCurrentTransactionData(), $results) |
|
| 428 | && !empty($results[1]) |
|
| 429 | ) { |
|
| 430 | return $this->sanitizeDebitCredit($results[1]); |
|
| 431 | } |
|
| 432 | ||
| 433 | return ''; |
|
| 434 | } |
|
| 435 | ||
| 436 | /** |
|
| 437 | * Parses the Cancellation flag of a Transaction |
|
| @@ 505-515 (lines=11) @@ | ||
| 502 | * |
|
| 503 | * @return string |
|
| 504 | */ |
|
| 505 | protected function parseTransactionCode() |
|
| 506 | { |
|
| 507 | $results = []; |
|
| 508 | if (preg_match('/^:61:.*?N(.{3}).*/', $this->getCurrentTransactionData(), $results) |
|
| 509 | && !empty($results[1]) |
|
| 510 | ) { |
|
| 511 | return trim($results[1]); |
|
| 512 | } |
|
| 513 | ||
| 514 | return ''; |
|
| 515 | } |
|
| 516 | ||
| 517 | /** |
|
| 518 | * @param string $string |
|
| @@ 84-92 (lines=9) @@ | ||
| 81 | * |
|
| 82 | * {@inheritdoc} |
|
| 83 | */ |
|
| 84 | protected function parseTransactionEntryTimestamp() |
|
| 85 | { |
|
| 86 | $results = []; |
|
| 87 | if (preg_match('/^:60F:[C|D]([\d]{6})/m', $this->getCurrentStatementData(), $results) && !empty($results[1])) { |
|
| 88 | return $this->sanitizeTimestamp($results[1], 'ymd'); |
|
| 89 | } |
|
| 90 | ||
| 91 | return 0; |
|
| 92 | } |
|
| 93 | ||
| 94 | /** |
|
| 95 | * Overloaded: Rabo has different way of storing transaction value timestamps (ymd). |
|
| @@ 99-107 (lines=9) @@ | ||
| 96 | * |
|
| 97 | * {@inheritdoc} |
|
| 98 | */ |
|
| 99 | protected function parseTransactionValueTimestamp() |
|
| 100 | { |
|
| 101 | $results = []; |
|
| 102 | if (preg_match('/^:61:([\d]{6})[C|D]/', $this->getCurrentTransactionData(), $results) && !empty($results[1])) { |
|
| 103 | return $this->sanitizeTimestamp($results[1], 'ymd'); |
|
| 104 | } |
|
| 105 | ||
| 106 | return 0; |
|
| 107 | } |
|
| 108 | ||
| 109 | /** |
|
| 110 | * Overloaded: Rabo uses longer strings for accountnumbers. |
|