From 0badd945a9a515d669e186688fb68437ccf87f7a Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Sun, 26 Feb 2012 19:03:49 +0100 Subject: [PATCH] fix getting transactions of secondary accounts --- modules/bnporc/backend.py | 4 ++-- modules/bnporc/pages/accounts_list.py | 1 + modules/bnporc/pages/transactions.py | 8 ++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/bnporc/backend.py b/modules/bnporc/backend.py index 22be42ca..0cc0034f 100644 --- a/modules/bnporc/backend.py +++ b/modules/bnporc/backend.py @@ -76,11 +76,11 @@ class BNPorcBackend(BaseBackend, ICapBank): def iter_history(self, account): with self.browser: - return self.browser.iter_history(account.id) + return self.browser.iter_history(account.link_id) def iter_operations(self, account): with self.browser: - return self.browser.iter_coming_operations(account.id) + return self.browser.iter_coming_operations(account.link_id) def iter_transfer_recipients(self, ignored): for account in self.browser.get_transfer_accounts().itervalues(): diff --git a/modules/bnporc/pages/accounts_list.py b/modules/bnporc/pages/accounts_list.py index b16a6567..35349e8c 100644 --- a/modules/bnporc/pages/accounts_list.py +++ b/modules/bnporc/pages/accounts_list.py @@ -38,6 +38,7 @@ class AccountsList(BasePage): if not 'class' in tr.attrib and tr.find('td') is not None and tr.find('td').attrib.get('class', '') == 'typeTitulaire': account = Account() account.id = tr.xpath('.//td[@class="libelleCompte"]/input')[0].attrib['id'][len('libelleCompte'):] + account.link_id = account.id if len(str(account.id)) == 23: account.id = str(account.id)[5:21] diff --git a/modules/bnporc/pages/transactions.py b/modules/bnporc/pages/transactions.py index 9099a884..ffc98828 100644 --- a/modules/bnporc/pages/transactions.py +++ b/modules/bnporc/pages/transactions.py @@ -34,18 +34,22 @@ class TransactionsBasePage(BasePage): Transaction.TYPE_CHECK, u'N°%(no)s'), (re.compile('^FACTURE CARTE DU (?P
\d{2})(?P\d{2})(?P\d{2}) (?P.*)'), Transaction.TYPE_CARD, u'20%(yy)s-%(mm)s-%(dd)s: %(text)s'), - (re.compile('^(PRELEVEMENT|TELEREGLEMENT) (?P.*)'), + (re.compile('^(PRELEVEMENT|TELEREGLEMENT|TIP) (?P.*)'), Transaction.TYPE_ORDER, '%(text)s'), (re.compile('^ECHEANCEPRET(?P.*)'), Transaction.TYPE_LOAN_PAYMENT, u'n°%(text)s'), (re.compile('^RETRAIT DAB (?P
\d{2})/(?P\d{2})/(?P\d{2}) (?P\d+)H(?P\d+) (?P.*)'), Transaction.TYPE_WITHDRAWAL, u'20%(yy)s-%(mm)s-%(dd)s %(HH)s:%(MM)s: %(text)s'), - (re.compile('^VIREMENT (?P.*)'), + (re.compile('^VIR(EMEN)?T (?P.*)'), Transaction.TYPE_TRANSFER, u'%(text)s'), (re.compile('^REMBOURST (?P.*)'), Transaction.TYPE_PAYBACK, '%(text)s'), (re.compile('^COMMISSIONS (?P.*)'), Transaction.TYPE_BANK, '%(text)s'), + (re.compile('^(?PREMUNERATION.*)'), + Transaction.TYPE_BANK, '%(text)s'), + (re.compile('^REMISE CHEQUES(?P.*)'), + Transaction.TYPE_DEPOSIT, '%(text)s'), ] def parse_text(self, op):