sandermarechal / jejik-mt940

An MT940 bank statement parser for PHP
MIT License
82 stars 33 forks source link

Line :28C: issue #31

Closed ruben-with-b closed 4 years ago

ruben-with-b commented 4 years ago

Hi, thanks for this great parser.

I have an issue on the statementNumber-method in AbstractParser.php

protected function statementNumber(string $text): ?string
    {
        if ($number = $this->getLine('28|28C', $text)) {
            return $number;
        }

        return null;
    }

My mta file has the following line: :28C:0

and I get this Error message: Argument 2 passed to Jejik\MT940\Reader::createStatement() must be of the type string, null given

Any idea, why '0' is not passed? I attached the SWIFT file, causing this problem.

Umsaetze_92835_11.03.2020.txt

twitnic commented 4 years ago

Could you check your file? Is the Lineending LF or CRLF?

ruben-with-b commented 4 years ago

thanks for replying @twitnic

All files I am using are with CRLF lineendings.

I have another file where :28C: is followed by e.g 0000/01 and there the problem doesn't occur

twitnic commented 4 years ago

Hey @ruben-with-b from which bank is this statement?`So, I check it at the afternoon.

ruben-with-b commented 4 years ago

the bank is the german »Volksbanken Raiffaisenbanken«

ruben-with-b commented 4 years ago

I noticed that when I change the character from :28:0 to e.g. :28:3 the problem doesn't occur anymore. Also :28:00 works.

So the parser seems to have a problem with a single 0.

twitnic commented 4 years ago

@ruben-with-b I will write a fix respectively a own parser for volksbanken.

twitnic commented 4 years ago

@ruben-with-b I have added a fix, that would be fix the issue. Its tagged with version 0.5.2. It is not a own parser, but a short fix.

BTW: @ruben-with-b is it possible to add you txt file to the repo as a example for Volksbanken Raiffeisenbanken?

ruben-with-b commented 4 years ago

@twitnic now with version 0.5.2 it's running super fine 🥇 Thank you very much, this was fast! Of course, feel free to use my attached file, the data has been replaced by invented data.

twitnic commented 4 years ago

@ruben-with-b Thanks :)

Notice for me: Check the Parser for Sparkasse. because the volksbanken raufeisenbanken is parsed against the sparkasse parser.