mt940

Bug 14

classification
Title: Missing IBAN from ABN Amro
Type: rfe Severity: normal
Components: Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Butterfly Nosy List: ced, diva
Priority: Keywords:

Created on 2022-12-08 08:18 by diva, last changed 2022-12-08 10:40 by ced.

Messages
msg28 (view) Author: [hidden] (diva) Date: 2022-12-08 08:18
the iban number usually doesn't exist in the first line and mostly randomly exists inside the description.
The problem briefly that if the iban number is at the beginning of the description[:86] - everything works fine and gives me a result in Tryton(party filled out correctly on the origins field during import the statement using mt940 file), but once the Iban number is randomly in the description (not exist on the first line of the description), it doesn't Give me any result and the party empty on the origins field.

problem tested during importing a mt940 file and select "ABN Amro"
msg29 (view) Author: [hidden] (ced) Date: 2022-12-08 08:29
Please provide a replicable example.
msg30 (view) Author: [hidden] (diva) Date: 2022-12-08 09:23
This is the example that doesn't working(No party  filled out on origins)
the IBAN number(52.42.85.427) exist inside the description in a random position from another line) 

{1:F01ABNANL2AXXXX0000000000}{2:O9420000000000ABNANL2AXXXX00000000000000000000N}{3:}{4
:20:0000000007870912
:25:NL62ABNA0494458011
:28C:1/1:34F:EURD0.00:34F:EURC0.00:13:1011010921
:60F:C220919EUR10516,04
:61:1011011101C0,01N400NONREF
:86:ABN AMRO GLOBAL CHANNELS
AMSTERDAM ZUIDOOST?52.42.85.427
BVGCFM MODELE
:62F:C220920EUR8206,52
:90D:0EUR0.00
:90C:1EUR0.01
:62F:C220919EUR9214,16
-}{5:}
------------------------------------------------------------
example working and the party filled out correctly on origins(the iban number "52.42.85.427" exist on the first line of description[:86]


{1:F01ABNANL2AXXXX0000000000}{2:O9420000000000ABNANL2AXXXX00000000000000000000N}{3:}{4
:20:0000000007870912
:25:NL62ABNA0494458011
:28C:1/1:34F:EURD0.00:34F:EURC0.00:13:1011010921
:60F:C220919EUR10516,04
:61:1011011101C0,01N400NONREF
:86:52.42.85.427
ABN AMRO GLOBAL CHANNELS
AMSTERDAM ZUIDOOST
BVGCFM MODELE
:62F:C220920EUR8206,52
:90D:0EUR0.00
:90C:1EUR0.01
:62F:C220919EUR9214,16
-}{5:}
msg31 (view) Author: [hidden] (ced) Date: 2022-12-08 09:42
Unfortunately the ABN-AMRO website does not seem to provide anymore the syntax of their comment. The parser code except to have the IBAN at the beginning of the comment. I suppose this was because the specification says so.
Can you provide the specification that the bank is following?
msg32 (view) Author: [hidden] (diva) Date: 2022-12-08 10:34
I don't have a good idea about the "ABN Amro" bank , as i said i work with different bancs , The story that I have applied the example on a deutch bank that put the IBAN number inside the description and not on the beginning of the description and seems to me the same happen with abn_amro_description(according to the example that i have provided) and that's why i have give an example about abn_amro to find solution about how the search will not be limited on first line from the descrption.


This is code customised for the deutch banc:
Deutsche_Bank_ACCOUNT = re.compile(r"""
    ^(31DE+[0-9]{1,20})""", re.VERBOSE)
Deutsche_Bank_TAGS = [
    ('/TRTP/', 'trtp'),
    ('/IBAN/', 'iban'),
    ('/BIC/', 'bic'),
    ('/CSID', 'csid'),
    ('/NAME/', 'name'),
    ('/REMI/', 'remi'),
    ('/EREF/', 'eref'),
    ('/ORDP//ID/', 'ordp'),
    ('/BENM//ID/', 'benm'),
    ]

def deutsche_bank_description(description):
    "Return dictionary with Deutsche Bank informations"
    description = ''.join(description.splitlines())
    values = {}
    m = Deutsche_Bank_ACCOUNT.match(description)
    if m:
        values['account'] = m.group(1).replace('31', '')
    values.update(_find_swift_tags(Deutsche_Bank_TAGS, description))
    return values
this example description picked up from a book related to the deutch bank 
 and here is an example picked up from a deutch book banc where the iban is puted exactly after (?31):

:86:105?00SEPA-BASIS-LASTSCHRIFT?109316
?20EREF+987654123497?21MREF+10023?22CRED+DE5
4ZZZ09999999999?23SVWZ+Versicherungsbeitrag 2
?24013?30WELADED1MST?31DE87240501501234567890
?32XYZ Versicherungs AG?34991
the iban number (DE87240501501234567890) is inside the description

-----> the search limited in the first line happen in abn_amro and on the deutch banc  that i have customised and added the code by me on mt940 library,I have just customised the regular expression and the file as i say  worked with me if i put the IBAN number on first line and not working if i let it as the example on the book(inside the descrption).
msg33 (view) Author: [hidden] (ced) Date: 2022-12-08 10:40
So if it is not a ABN AMRO statement, you must not use the ABN AMRO parser.
So you can propose an implementation of this bank if you provide the specification.
History
Date User Action Args
2022-12-08 10:40:27cedsetmessages: + msg33
type: behavior -> rfe
2022-12-08 10:34:58divasetmessages: + msg32
2022-12-08 09:42:57cedsetmessages: + msg31
status: pending -> open
2022-12-08 09:23:51divasetmessages: + msg30
2022-12-08 08:29:30cedsetmessages: + msg29
nosy: + ced
severity: urgent -> normal
status: pending
title: mt940 tracker -> Missing IBAN from ABN Amro
2022-12-08 08:18:49divacreate