Get recipient list (only work with one account)

This commit is contained in:
Florent 2012-09-24 14:44:47 +02:00 committed by Romain Bignon
commit 06392b4a6f
3 changed files with 21 additions and 5 deletions

View file

@ -21,7 +21,7 @@
# python2.5 compatibility # python2.5 compatibility
from __future__ import with_statement from __future__ import with_statement
from weboob.capabilities.bank import ICapBank, AccountNotFound from weboob.capabilities.bank import ICapBank, AccountNotFound, Account
from weboob.tools.backend import BaseBackend, BackendConfig from weboob.tools.backend import BaseBackend, BackendConfig
from weboob.tools.value import ValueBackendPassword from weboob.tools.value import ValueBackendPassword
@ -72,3 +72,10 @@ class INGBackend(BaseBackend, ICapBank):
with self.browser: with self.browser:
for history in self.browser.get_history(account.id): for history in self.browser.get_history(account.id):
yield history yield history
def iter_transfer_recipients(self, account):
with self.browser:
if not isinstance(account, Account):
account = self.get_account(account)
for recipient in self.browser.get_recipients(account):
yield recipient

View file

@ -20,7 +20,7 @@ import hashlib
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
from .pages import AccountsList, LoginPage, LoginPage2, \ from .pages import AccountsList, LoginPage, LoginPage2, \
AccountHistory AccountHistory, TransferPage
__all__ = ['Ing'] __all__ = ['Ing']
@ -34,7 +34,9 @@ class Ing(BaseBrowser):
'.*displayLogin.jsf': LoginPage, '.*displayLogin.jsf': LoginPage,
'.*displayLogin.jsf.*': LoginPage2, '.*displayLogin.jsf.*': LoginPage2,
'.*accountDetail.jsf.*': AccountHistory, '.*accountDetail.jsf.*': AccountHistory,
'.*displayTRHistoriqueLA.*': AccountHistory '.*displayTRHistoriqueLA.*': AccountHistory,
'.*transferManagement.jsf': TransferPage,
'.*DisplayDoTransferCommand.*': TransferPage
} }
CERTHASH = "fba557b387cccc3d71ba038f9ef1de4d71541d7954744c79f6a7ff5f3cd4dc12" CERTHASH = "fba557b387cccc3d71ba038f9ef1de4d71541d7954744c79f6a7ff5f3cd4dc12"
@ -112,3 +114,8 @@ class Ing(BaseBrowser):
# XXX server sends an unknown mimetype, we overload viewing_html() above to # XXX server sends an unknown mimetype, we overload viewing_html() above to
# prevent this issue. # prevent this issue.
self.page.next_page() self.page.next_page()
def get_recipients(self, account):
if not self.is_on_page(TransferPage):
self.location('https://secure.ingdirect.fr/protected/pages/cc/transfer/transferManagement.jsf')
return self.page.get_recipients()

View file

@ -21,10 +21,12 @@
from .accounts_list import AccountsList from .accounts_list import AccountsList
from .account_history import AccountHistory from .account_history import AccountHistory
from .login import LoginPage, LoginPage2, ConfirmPage, MessagePage from .login import LoginPage, LoginPage2, ConfirmPage, MessagePage
from .transfer import TransferPage
class AccountPrelevement(AccountsList): class AccountPrelevement(AccountsList):
pass pass
__all__ = ['AccountsList', 'AccountHistory', 'LoginPage', __all__ = ['AccountsList', 'AccountHistory', 'LoginPage',
'LoginPage2', 'ConfirmPage', 'MessagePage', 'AccountPrelevement'] 'LoginPage2', 'ConfirmPage', 'MessagePage', 'AccountPrelevement',
'TransferPage']