fix switches between market and bank websites
This commit is contained in:
parent
0868c5e9fc
commit
2706f9bf71
2 changed files with 13 additions and 9 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue