Bug 14

Title: Missing IBAN from ABN Amro
Type: rfe Severity: normal
Components: Versions:
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.

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( exist inside the description in a random position from another line) 

example working and the party filled out correctly on origins(the iban number "" exist on the first line of description[:86]

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'] ='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):

4ZZZ09999999999?23SVWZ+Versicherungsbeitrag 2
?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.
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