Commit 8e4e2598 authored by Baptiste Delpey's avatar Baptiste Delpey Committed by Romain Bignon

ing: this method also get balance of market accounts on bourse website

parent 3b2b7c7d
......@@ -195,7 +195,7 @@ class IngBrowser(LoginBrowser):
self.cache["investments_data"][account.id] = self.page.doc or None
@need_login
def get_iban(self, account):
def fill_account(self, account):
if account.type in [Account.TYPE_CHECKING, Account.TYPE_SAVINGS]:
self.go_account_page(account)
account.iban = self.ibanpage.go().get_iban()
......@@ -204,7 +204,7 @@ class IngBrowser(LoginBrowser):
self.get_market_balance(account)
@need_login
def get_accounts_on_space(self, space, get_iban=True):
def get_accounts_on_space(self, space, fill_account=True):
accounts_list = []
self.change_space(space)
......@@ -227,19 +227,19 @@ class IngBrowser(LoginBrowser):
@need_login
@start_with_main_site
def get_accounts_list(self, space=None, get_iban=True):
def get_accounts_list(self, space=None, fill_account=True):
self.accountspage.go()
self.where = 'start'
self.set_multispace()
if space:
for acc in self.get_accounts_on_space(space, get_iban=get_iban):
for acc in self.get_accounts_on_space(space, fill_account=fill_account):
yield acc
elif self.multispace:
for space in self.multispace:
for acc in self.get_accounts_on_space(space, get_iban=get_iban):
for acc in self.get_accounts_on_space(space, fill_account=fill_account):
yield acc
else:
for acc in self.page.get_list():
......@@ -288,7 +288,7 @@ class IngBrowser(LoginBrowser):
self.location('https://secure.ing.fr/', data={'token': self.response.text})
def get_account(self, _id, space=None):
return find_object(self.get_accounts_list(get_iban=False, space=space), id=_id, error=AccountNotFound)
return find_object(self.get_accounts_list(fill_account=False, space=space), id=_id, error=AccountNotFound)
def go_account_page(self, account):
......
......@@ -73,7 +73,7 @@ class TransferPage(LoggedPage, HTMLPage):
def parse(self, el):
_id = Attr('.', 'data-acct-number')(self)
accounts = [acc for acc in self.page.browser.get_accounts_list(get_iban=False, space=self.env['origin']._space) if _id in acc.id]
accounts = [acc for acc in self.page.browser.get_accounts_list(fill_account=False, space=self.env['origin']._space) if _id in acc.id]
assert len(accounts) == 1
account = accounts[0]
self.env['id'] = account.id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment