diff --git a/src/Parser/Banking/Mt940/Engine/Rabo.php b/src/Parser/Banking/Mt940/Engine/Rabo.php index 696854b..9fc2ea7 100644 --- a/src/Parser/Banking/Mt940/Engine/Rabo.php +++ b/src/Parser/Banking/Mt940/Engine/Rabo.php @@ -140,6 +140,12 @@ protected function sanitizeDescription($string) return $results[1]; } + if (strpos($description, '/PREF/') !== false + && preg_match('#/PREF/(.*)/?#s', $description, $results) && !empty($results[1]) + ) { + return $results[1]; + } + return $description; } diff --git a/test/Parser/Banking/Mt940/Engine/Rabo/ParseTest.php b/test/Parser/Banking/Mt940/Engine/Rabo/ParseTest.php index f128f9c..56b217c 100644 --- a/test/Parser/Banking/Mt940/Engine/Rabo/ParseTest.php +++ b/test/Parser/Banking/Mt940/Engine/Rabo/ParseTest.php @@ -96,4 +96,16 @@ public function testHandlingOfDescriptions() { $statements = $this->engine->parse(); $this->assertSame('some descripton here thatends with', $statements[1]->getTransactions()[0]->getDescription()); } + + public function testHandlingOfEREF() { + $this->engine->loadString(file_get_contents(__DIR__.'/sample4')); + $statements = $this->engine->parse(); + $this->assertSame('20151208123123987 0030001100999991 Rabobank.nl - Order 347347', $statements[0]->getTransactions()[0]->getDescription()); + } + + public function testHandlingOfPREF() { + $this->engine->loadString(file_get_contents(__DIR__.'/sample4')); + $statements = $this->engine->parse(); + $this->assertSame('PmtInfId-20151208-987', $statements[0]->getTransactions()[1]->getDescription()); + } } diff --git a/test/Parser/Banking/Mt940/Engine/Rabo/sample4 b/test/Parser/Banking/Mt940/Engine/Rabo/sample4 new file mode 100644 index 0000000..f0ca219 --- /dev/null +++ b/test/Parser/Banking/Mt940/Engine/Rabo/sample4 @@ -0,0 +1,20 @@ +:940: +:20:940S130403 +:25:NL50RABO0123456789 +:28C:0 +:60F:C130402EUR000000001147,95 + +:61:151208D000000000098,99N102EREF +NL44RABO0123456789 +:86:/EREF/08-12-2015 10:22 0030001100999991/BENM//NAME/Rabobank RCKV/ +REMI/20151208123123987 0030001100999991 Rabobank.nl - Order 347347 + +:61:151208D000000000840,20N586PREF +0000000000 +:86:/PREF/PmtInfId-20151208-987 + +:61:151208D000000000840,20N586PREF +0000000000 +:86:/PREF/PmtInfId-20151208-987/SOMETHING ELSE + +:62F:C130404EUR000000018846,34 \ No newline at end of file