diff --git a/modules/ing/browser.py b/modules/ing/browser.py index f65ce902..9a2be9b0 100644 --- a/modules/ing/browser.py +++ b/modules/ing/browser.py @@ -22,7 +22,8 @@ import time from weboob.browser import LoginBrowser, URL, need_login from weboob.exceptions import BrowserIncorrectPassword, ParseError -from weboob.capabilities.bank import Account, TransferError +from weboob.capabilities.bank import Account, TransferError, AccountNotFound +from weboob.capabilities.base import find_object from .pages import AccountsList, LoginPage, TitrePage, TitreHistory,\ TransferPage, TransferConfirmPage, BillsPage, StopPage, TitreDetails @@ -93,6 +94,9 @@ class IngBrowser(LoginBrowser): self.where = "start" return self.page.get_list() + def get_account(self, _id): + return find_object(self.get_accounts_list(), id=_id, error=AccountNotFound) + @need_login @check_bourse def get_coming(self, account): @@ -100,7 +104,7 @@ class IngBrowser(LoginBrowser): account.type != Account.TYPE_SAVINGS: raise NotImplementedError() if self.where != "start": - self.accountspage.go() + account = self.get_account(account.id) data = {"AJAX:EVENTS_COUNT": 1, "AJAXREQUEST": "_viewRoot", "ajaxSingle": "index:setAccount", @@ -131,7 +135,7 @@ class IngBrowser(LoginBrowser): raise NotImplementedError() if self.where != "start": - self.accountspage.go() + account = self.get_account(account.id) data = {"AJAX:EVENTS_COUNT": 1, "AJAXREQUEST": "_viewRoot", "ajaxSingle": "index:setAccount", @@ -220,8 +224,7 @@ class IngBrowser(LoginBrowser): def go_investments(self, account): - if self.where != "start": - self.accountspage.go() + account = self.get_account(account.id) data = {"AJAX:EVENTS_COUNT": 1, "AJAXREQUEST": "_viewRoot", "ajaxSingle": "index:setAccount", @@ -241,7 +244,9 @@ class IngBrowser(LoginBrowser): if i > 1: self.do_logout() self.do_login() - self.accountspage.go() + account = self.get_account(account.id) + data['cptnbr'] = account._id + data['javax.faces.ViewState'] = account._jid self.accountspage.go(data=data) diff --git a/modules/ing/module.py b/modules/ing/module.py index 4d30efb3..fec897c0 100644 --- a/modules/ing/module.py +++ b/modules/ing/module.py @@ -18,8 +18,7 @@ # along with weboob. If not, see . -from weboob.capabilities.bank import CapBank, AccountNotFound,\ - Account, Recipient +from weboob.capabilities.bank import CapBank, Account, Recipient from weboob.capabilities.bill import CapBill, Bill, Subscription,\ SubscriptionNotFound, BillNotFound from weboob.capabilities.base import UserError, find_object @@ -68,7 +67,7 @@ class INGModule(Module, CapBank, CapBill): return self.browser.get_accounts_list() def get_account(self, _id): - return find_object(self.browser.get_accounts_list(), id=_id, error=AccountNotFound) + return self.browser.get_account(_id) def iter_history(self, account): if not isinstance(account, Account):