From 03f68b4207046dcb482fa3dda6e92a02ed187225 Mon Sep 17 00:00:00 2001 From: Florent Date: Wed, 11 Apr 2012 17:26:09 +0200 Subject: [PATCH] Fix livret A history (site changed) The url is still valid, but the html code look like the normal account. --- modules/ing/browser.py | 6 ++--- modules/ing/pages/__init__.py | 4 +-- modules/ing/pages/account_history.py | 40 ++++------------------------ 3 files changed, 10 insertions(+), 40 deletions(-) diff --git a/modules/ing/browser.py b/modules/ing/browser.py index 0195156f..02e68249 100644 --- a/modules/ing/browser.py +++ b/modules/ing/browser.py @@ -20,7 +20,7 @@ from weboob.tools.browser import BaseBrowser from .pages import AccountsList, LoginPage, LoginPage2, \ - AccountHistoryCC, AccountHistoryLA + AccountHistory __all__ = ['Ing'] @@ -33,8 +33,8 @@ class Ing(BaseBrowser): PAGES = {'.*displayTRAccountSummary.*': AccountsList, '.*displayLogin.jsf': LoginPage, '.*displayLogin.jsf.*': LoginPage2, - '.*accountDetail.jsf.*': AccountHistoryCC, - '.*displayTRHistoriqueLA.*': AccountHistoryLA + '.*accountDetail.jsf.*': AccountHistory, + '.*displayTRHistoriqueLA.*': AccountHistory } def __init__(self, *args, **kwargs): diff --git a/modules/ing/pages/__init__.py b/modules/ing/pages/__init__.py index a1b7737b..161fbd1b 100644 --- a/modules/ing/pages/__init__.py +++ b/modules/ing/pages/__init__.py @@ -19,12 +19,12 @@ from .accounts_list import AccountsList -from .account_history import AccountHistoryCC, AccountHistoryLA +from .account_history import AccountHistory from .login import LoginPage, LoginPage2, ConfirmPage, MessagePage class AccountPrelevement(AccountsList): pass -__all__ = ['AccountsList', 'AccountHistoryCC', 'AccountHistoryLA', 'LoginPage', +__all__ = ['AccountsList', 'AccountHistory', 'LoginPage', 'LoginPage2', 'ConfirmPage', 'MessagePage', 'AccountPrelevement'] diff --git a/modules/ing/pages/account_history.py b/modules/ing/pages/account_history.py index 79cfe873..c6861619 100644 --- a/modules/ing/pages/account_history.py +++ b/modules/ing/pages/account_history.py @@ -27,23 +27,18 @@ from weboob.capabilities.bank import Transaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction -__all__ = ['AccountHistoryCC', 'AccountHistoryLA'] +__all__ = ['AccountHistory'] -class TransactionCC(FrenchTransaction): +class Transaction(FrenchTransaction): PATTERNS = [(re.compile(u'^retrait dab (?P
\d{2})/(?P\d{2})/(?P\d{4}) (?P.*)'), FrenchTransaction.TYPE_WITHDRAWAL), (re.compile(u'^carte (?P
\d{2})/(?P\d{2})/(?P\d{4}) (?P.*)'), Transaction.TYPE_CARD), - (re.compile(u'^virement ((sepa emis vers|recu)?) (?P.*)'), Transaction.TYPE_TRANSFER), + (re.compile(u'^virement ((sepa emis vers|recu|emis)?) (?P.*)'), Transaction.TYPE_TRANSFER), (re.compile(u'^prelevement (?P.*)'), Transaction.TYPE_ORDER), ] -class TransactionAA(FrenchTransaction): - PATTERNS = [(re.compile(u'^(?PVIREMENT (RECU|EMIS VERS)?) (?P.*)'), FrenchTransaction.TYPE_TRANSFER), - ] - - -class AccountHistoryCC(BasePage): +class AccountHistory(BasePage): def on_loaded(self): self.transactions = [] table = self.document.findall('//tbody')[0] @@ -51,7 +46,7 @@ class AccountHistoryCC(BasePage): for tr in table.xpath('tr'): id = i texte = tr.text_content().split('\n') - op = TransactionCC(id) + op = Transaction(id) op.parse(date = date(*reversed([int(x) for x in texte[0].split('/')])), raw = texte[2]) # force the use of website category @@ -64,28 +59,3 @@ class AccountHistoryCC(BasePage): def get_transactions(self): return self.transactions - - -class AccountHistoryLA(BasePage): - - def on_loaded(self): - self.transactions = [] - i = 1 - history = self.document.xpath('//tr[@align="center"]') - history.pop(0) - for tr in history: - id = i - texte = tr.text_content().strip().split('\n') - op = TransactionAA(id) - # The size is not the same if there are two dates or only one - length = len(texte) - op.parse(date = date(*reversed([int(x) for x in texte[0].split('/')])), - raw = unicode(texte[length - 2].strip())) - - op.amount = Decimal(op.clean_amount(texte[length - 1])) - - self.transactions.append(op) - i += 1 - - def get_transactions(self): - return self.transactions