From b400544e90c132ee8b31014fa7d6608c67ee24ec Mon Sep 17 00:00:00 2001 From: Florent Date: Mon, 25 Feb 2013 12:09:59 +0100 Subject: [PATCH] Remove old code --- modules/ing/browser.py | 4 +- modules/ing/pages/__init__.py | 3 +- modules/ing/pages/account_history.py | 90 ---------------------------- modules/ing/pages/accounts_list.py | 2 +- 4 files changed, 3 insertions(+), 96 deletions(-) delete mode 100644 modules/ing/pages/account_history.py diff --git a/modules/ing/browser.py b/modules/ing/browser.py index d4e29975..bdc91594 100644 --- a/modules/ing/browser.py +++ b/modules/ing/browser.py @@ -22,7 +22,7 @@ import hashlib from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword from weboob.capabilities.bank import Account, TransferError from .pages import AccountsList, LoginPage, \ - AccountHistory, TransferPage, TransferConfirmPage, \ + TransferPage, TransferConfirmPage, \ BillsPage, StopPage @@ -37,8 +37,6 @@ class Ing(BaseBrowser): ENCODING = "utf-8" PAGES = {'.*pages/index.jsf.*': AccountsList, '.*displayLogin.jsf.*': LoginPage, - '.*accountDetail.jsf.*': AccountHistory, - '.*displayTRHistorique.*': AccountHistory, '.*transferManagement.jsf': TransferPage, '.*onHoldTransferManagement.jsf': TransferPage, '.*DisplayDoTransferCommand.*': TransferPage, diff --git a/modules/ing/pages/__init__.py b/modules/ing/pages/__init__.py index 64d9bd9d..54d63831 100644 --- a/modules/ing/pages/__init__.py +++ b/modules/ing/pages/__init__.py @@ -19,7 +19,6 @@ from .accounts_list import AccountsList -from .account_history import AccountHistory from .login import LoginPage, StopPage from .transfer import TransferPage, TransferConfirmPage from .bills import BillsPage @@ -28,6 +27,6 @@ from .bills import BillsPage class AccountPrelevement(AccountsList): pass -__all__ = ['AccountsList', 'AccountHistory', 'LoginPage', +__all__ = ['AccountsList', 'LoginPage', 'AccountPrelevement', 'TransferPage', 'TransferConfirmPage', 'BillsPage', 'StopPage'] diff --git a/modules/ing/pages/account_history.py b/modules/ing/pages/account_history.py deleted file mode 100644 index 897a4cb5..00000000 --- a/modules/ing/pages/account_history.py +++ /dev/null @@ -1,90 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright(C) 2009-2011 Romain Bignon, Florent Fourcot -# -# This file is part of weboob. -# -# weboob is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# weboob is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with weboob. If not, see . - -import re -import hashlib - -from decimal import Decimal -from datetime import date - -from weboob.tools.browser import BasePage -from weboob.tools.mech import ClientForm -from weboob.capabilities.bank import Transaction -from weboob.tools.capabilities.bank.transactions import FrenchTransaction - - -__all__ = ['AccountHistory'] - - -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|emis vers|recu|emis)?) (?P.*)'), Transaction.TYPE_TRANSFER), - (re.compile(u'^prelevement (?P.*)'), Transaction.TYPE_ORDER), - ] - - -class AccountHistory(BasePage): - def on_loaded(self): - pass - - def get_transactions(self): - try: - table = self.document.findall('//tbody')[0] - except IndexError: - return - - for tr in table.xpath('tr'): - textdate = tr.find('td[@class="op_date"]').text_content() - textraw = tr.find('td[@class="op_label"]').text_content().strip() - textraw = re.sub(' +', ' ', textraw) - # The id will be rewrite - op = Transaction(1) - amount = op.clean_amount(tr.find('td[@class="op_amount"]').text_content()) - id = hashlib.md5(textdate + textraw.encode('utf-8') + amount.encode('utf-8')).hexdigest() - op.id = id - op.parse(date = date(*reversed([int(x) for x in textdate.split('/')])), - raw = textraw) - # force the use of website category - op.category = unicode(tr.find('td[@class="op_type"]').text) - - op.amount = Decimal(amount) - - yield op - - def islast(self): - form = self.document.find('//form[@id="navigation_form"]') - if form is None: - return True - - alinks = form.xpath('div/a') - for a in alinks: - if u'Page Suivante' in a.text: - self.next = a.attrib['id'] - return False - return True - - def next_page(self): - self.browser.select_form('navigation_form') - self.browser.set_all_readonly(False) - self.browser.controls.append(ClientForm.TextControl('text', 'AJAXREQUEST', {'value': ''})) - self.browser['AJAXREQUEST'] = '_viewRoot' - self.browser.controls.append(ClientForm.TextControl('text', self.next, {'value': ''})) - self.browser[self.next] = self.next - self.browser.submit() diff --git a/modules/ing/pages/accounts_list.py b/modules/ing/pages/accounts_list.py index 5ea089a7..a8302e38 100644 --- a/modules/ing/pages/accounts_list.py +++ b/modules/ing/pages/accounts_list.py @@ -25,7 +25,7 @@ import hashlib from weboob.capabilities.bank import Account, Currency, Transaction from weboob.capabilities.base import NotAvailable -from weboob.tools.browser import BasePage, BrowserUnavailable +from weboob.tools.browser import BasePage from weboob.tools.capabilities.bank.transactions import FrenchTransaction