diff --git a/account_banking_nl_girotel/girotel.py b/account_banking_nl_girotel/girotel.py index 0c81f7ddc..26cabe29f 100644 --- a/account_banking_nl_girotel/girotel.py +++ b/account_banking_nl_girotel/girotel.py @@ -46,6 +46,7 @@ from account_banking.parsers import models from account_banking.parsers.convert import str2date, to_swift from tools.translate import _ import csv +import re bt = models.mem_bank_transaction @@ -143,6 +144,10 @@ class transaction(models.mem_bank_transaction): 'VZ': bt.PAYMENT_BATCH, } + structured_description_regex = re.compile( + '^IBAN: (?P\w+) BIC: (?P\w+) Naam: (?P.+) ' + 'Omschrijving: (?P.+)$') + def __init__(self, line, *args, **kwargs): ''' Initialize own dict with read values. @@ -274,6 +279,11 @@ class transaction(models.mem_bank_transaction): # Normal transaction, but remote_owner can contain city, depending # on length of total. As there is no clear pattern, leave it as # is. + structured_description = self.structured_description_regex.match( + ''.join(self.message.split('\n'))) + if structured_description: + values = structured_description.groupdict() + self.reference = values['desc'] self.message = self.refold_message(self.message) else: