← Back to team overview

banking-addons-team team mailing list archive

[Merge] lp:~therp-nl/banking-addons/girotel_structured_description into lp:banking-addons

 

Holger Brunn (Therp) has proposed merging lp:~therp-nl/banking-addons/girotel_structured_description into lp:banking-addons.

Requested reviews:
  Banking Addons Core Editors (banking-addons-team)

For more details, see:
https://code.launchpad.net/~therp-nl/banking-addons/girotel_structured_description/+merge/168453
-- 
https://code.launchpad.net/~therp-nl/banking-addons/girotel_structured_description/+merge/168453
Your team Banking Addons Core Editors is requested to review the proposed merge of lp:~therp-nl/banking-addons/girotel_structured_description into lp:banking-addons.
=== modified file 'account_banking_nl_girotel/girotel.py'
--- account_banking_nl_girotel/girotel.py	2012-07-09 17:04:14 +0000
+++ account_banking_nl_girotel/girotel.py	2013-06-10 13:58:27 +0000
@@ -46,6 +46,7 @@
 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 @@
         'VZ': bt.PAYMENT_BATCH,
     }
 
+    structured_description_regex = re.compile(
+            '^IBAN: (?P<iban>\w+) BIC: (?P<bic>\w+) Naam: (?P<name>.+) '
+            'Omschrijving: (?P<desc>.+)$')
+
     def __init__(self, line, *args, **kwargs):
         '''
         Initialize own dict with read values.
@@ -274,6 +279,11 @@
             # 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:


Follow ups