sandermarechal / jejik-mt940

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

Empty transaction data for ABNAMRO #54

Open martijnderidder opened 10 months ago

martijnderidder commented 10 months ago

We are using your package to read the MT940 file a client is uploading. The client uses ABNAMRO. The account statements, opening, closing balances can be read.

But when we read the transactions we get the correct amount of transactions, but the transaction data is quite empty. The sample response would be something like this:

0 => Jejik\MT940\Statement {#1645 ▼
    -number: "2201/1"
    -account: Jejik\MT940\Account {#1728 ▶}
    -openingBalance: Jejik\MT940\Balance {#1643 ▶}
    -closingBalance: Jejik\MT940\Balance {#1646 ▶}
    -transactions: array:10 [▼
      0 => Jejik\MT940\Transaction {#1709 ▼
        -contraAccount: null
        -amount: 426.27
        -description: """
          /TRTP/SEPA OVERBOEKING/IBAN/NL70TRIO0123456789/BIC/TRIONL2U/NAME/
          TEST MT940 NAME CLIENT/REMI/FACTUURNUMMER 12345678/EREF/2024011
          9225235TRIONL2UXXXE000030076
          """
        -valueDate: DateTime @1705618800 {#1639 …1}
        -bookDate: DateTime @1705618800 {#1636 …1}
        -code: null
        -ref: null
        -bankRef: null
        -supplementaryDetails: null
        -gvc: null
        -txText: null
        -primanota: null
        -extCode: null
        -eref: null
        -bic: null
        -iban: null
        -accountHolder: null
        -kref: null
        -mref: null
        -cred: null
        -svwz: null
        -purp: null
        -debt: null
        -coam: null
        -oamt: null
        -abwa: null
        -abwe: null
      }
      1 => Jejik\MT940\Transaction {#1697 ▶}
      2 => Jejik\MT940\Transaction {#1714 ▶}
      3 => Jejik\MT940\Transaction {#1708 ▶}
      4 => Jejik\MT940\Transaction {#1703 ▶}
      5 => Jejik\MT940\Transaction {#1695 ▶}
      6 => Jejik\MT940\Transaction {#1729 ▶}
      7 => Jejik\MT940\Transaction {#1738 ▶}
      8 => Jejik\MT940\Transaction {#1741 ▶}
      9 => Jejik\MT940\Transaction {#1744 ▶}
    ]
  }

Why is all the transaction data empty? When we use getIBAN for example it response with an empty string.

If you want to try it with a demo ABNAMRO file, you can use this string below. Its different than we use, but it also gives back a empty transaction data.

ABNANL2A
940
ABNANL2A
:20:ABN AMRO BANK NV
:25:123456789
:28:13501/1
:60F:C120511EUR5138,61
:61:1205120514C500,01N654NONREF
:86:/TRTP/SEPA OVERBOEKING/IBAN/FR12345678901234/BIC/GEFRADAM
/NAME/QASD JGRED/REMI/Dit zijn de omschrijvingsregels/EREF/NOTPRO
VIDED
:62F:C120514EUR5638,62
martijnderidder commented 10 months ago

I already tried this with the example ABN file i found online, but this also doenst work;

ABNANL2A
:20:ABN AMRO BANK NV
:25:517852257
:28:19321/1
:60F:C110522EUR3236,28
:61:1105240524D9,N192NONREF
:86:GIRO   428428 KPN - DIGITENNE    BETALINGSKENM.  000000042188659
5314606715                       BETREFT FACTUUR D.D. 20-05-2011
INCL. 1,44 BTW
:61:1105210523D11,59N426NONREF
:86:BEA   NR:XXX1234   21.05.11/12.54 DIRCKIII FIL2500 KATWIJK,PAS999
:61:1105230523D11,63N426NONREF
:86:BEA   NR:XXX1234   23.05.11/09.08 DIGROS FIL1015 KATWIJK Z,PAS999
:61:1105220523D11,8N426NONREF
:86:BEA   NR:XXX1234   22.05.11/14.25 MC DONALDS A44 LEIDEN,PAS999
:61:1105210523D13,45N426NONREF
:86:BEA   NR:XXX1234   21.05.11/12.09 PRINCE FIL. 55 KATWIJK Z,PAS999
:61:1105210523D15,49N426NONREF
:86:BEA   NR:XXX1234   21.05.11/12.55 DIRX FIL6017 KATWIJK ZH ,PAS999

:61:1105210523D107,N426NONREF
:86:BEA   NR:XXX1234   21.05.11/12.04 HANS ANDERS OPT./056 KAT,PAS999
:61:1105220523D141,48N426NONREF
:86:BEA   NR:XXX1234   22.05.11/13.45 MYCOM DEN HAAG  S-GRAVEN,PAS999
:62F:C110523EUR876,84
-
ABNANL2A
940
ABNANL2A
:20:ABN AMRO BANK NV
:25:517852257
:28C:19322/1
:60M:C110523EUR2876,84
:61:1105240524D9,49N426NONREF
:86:BEA   NR:XXX1234   24.05.11/09.18 PETS PLACE KATWIJK KATWI,PAS999
:61:1105240524D15,N426NONREF
:86:52.89.39.882                    MYCOM DEN HAAG
:62M:C110524EUR1849,75
-
twitnic commented 10 months ago

Ahhh.

I see the Error. https://www.abnamro.nl/en/media/AOL_Reporting_Download_Format_Book_tcm18-117090.pdf

Bildschirmfoto 2024-01-23 um 12 09 12

There are different Formats for sepa and non-sepa transactions ...

martijnderidder commented 10 months ago

Can you make this package work that the parser can parse the versions with the slashes? I guess this is the new format that is used nowadays.

twitnic commented 10 months ago

Joar. I will try to fix this this night.

twitnic commented 10 months ago

I already tried this with the example ABN file i found online, but this also doenst work;

...

Nope, The demo file is tested this should work. This file is the file in our tests: https://github.com/sandermarechal/jejik-mt940/blob/master/tests/Jejik/Tests/MT940/Fixture/document/abnamro.txt

And the test: https://github.com/sandermarechal/jejik-mt940/blob/master/tests/Jejik/Tests/MT940/Parser/AbnAmroTest.php