From 2520146583b94a874d79e5f3536bfa7735c86fde Mon Sep 17 00:00:00 2001 From: Lars Herrmann <48913533+larsiinger@users.noreply.github.com> Date: Mon, 6 Nov 2023 14:33:12 +0100 Subject: [PATCH] added new blz for Commerzbank (#51) * added BLZ 25040066 * added unique identifier 01LGX08DLMWH5GWA --------- Co-authored-by: Lars Herrmann --- lib/Jejik/MT940/Parser/Commerzbank.php | 7 +++-- .../MT940/Fixture/document/commerzbank.txt | 14 +++++++++ .../Tests/MT940/Parser/CommerzbankTest.php | 29 +++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 tests/Jejik/Tests/MT940/Fixture/document/commerzbank.txt create mode 100644 tests/Jejik/Tests/MT940/Parser/CommerzbankTest.php diff --git a/lib/Jejik/MT940/Parser/Commerzbank.php b/lib/Jejik/MT940/Parser/Commerzbank.php index 917343b..ad178de 100755 --- a/lib/Jejik/MT940/Parser/Commerzbank.php +++ b/lib/Jejik/MT940/Parser/Commerzbank.php @@ -28,11 +28,13 @@ public function accept(string $text): bool $allowedUniqueIdentifiers = [ ':20:012CIXCIA7V1OGWA', ':20:0157VSNLKBG9WGWA', + ':20:01LGX08DLMWH5GWA', ]; // unique identifier check $mt940Identifier = substr($text, 0, 20); - if (in_array($mt940Identifier, $allowedUniqueIdentifiers)) { + + if (in_array($mt940Identifier, $allowedUniqueIdentifiers, true)) { return true; } @@ -49,7 +51,8 @@ public function getAllowedBLZ(): array return [ '70040041', '66280053', - '28540034' + '28540034', + '25040066', ]; } } diff --git a/tests/Jejik/Tests/MT940/Fixture/document/commerzbank.txt b/tests/Jejik/Tests/MT940/Fixture/document/commerzbank.txt new file mode 100644 index 0000000..74efa33 --- /dev/null +++ b/tests/Jejik/Tests/MT940/Fixture/document/commerzbank.txt @@ -0,0 +1,14 @@ +:20:01LGX08DLMWH5GWA +:25:25040066/0123456789 +:28C:00143/1 +:60F:C200605EUR0,00 +:61:2006080608D12,35 NRTIKREF+//2016021783252833 +/OCMT/EUR11,85//CHGS/EUR0,50/ +:86:109?00SEPA-LASTSCHR. RETOURE CORE?109075/629?20EREF+A1.200080779. +400143254?21.4961336 KREF+SEPA-DA202006?2201221740-34972000-P1 MR +EF+2?230852HW2723821 CRED+DE41EON0?240000129793 OAMT+11,85 SVWZ+? +25SONSTIGE GRUENDE ENDABRECHN?26UNG NR. 500106875 ZU VERTRA?2740 +0143254, KUNDENNUM MER 2?2802227779?30CSDBDE71XXX?31DE50712345600 +200691329?32TESTER?33EL +:62F:C200608EUR0,00 +- diff --git a/tests/Jejik/Tests/MT940/Parser/CommerzbankTest.php b/tests/Jejik/Tests/MT940/Parser/CommerzbankTest.php new file mode 100644 index 0000000..324dba8 --- /dev/null +++ b/tests/Jejik/Tests/MT940/Parser/CommerzbankTest.php @@ -0,0 +1,29 @@ +reader = new Reader(); + $this->reader->addParser('Commerzbank', Commerzbank::class); + + $this->context = file_get_contents(__DIR__ . '/../Fixture/document/commerzbank.txt'); + } + + public function testPassAccept(): void + { + $parser = $this->reader->getStatements($this->context); + + self::assertIsArray($parser); + } +}