Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated rabo handling for PREF fields... #64

Merged
merged 1 commit into from
Mar 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Parser/Banking/Mt940/Engine/Rabo.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
12 changes: 12 additions & 0 deletions test/Parser/Banking/Mt940/Engine/Rabo/ParseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
20 changes: 20 additions & 0 deletions test/Parser/Banking/Mt940/Engine/Rabo/sample4
Original file line number Diff line number Diff line change
@@ -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