Commit d5fb50c4 authored by Vincent Ardisson's avatar Vincent Ardisson Committed by Vincent A

[ing] implement fillobj for "coming"

No need to fetch them in iter_accounts.
parent a76c742e
......@@ -207,7 +207,7 @@ class ComingPage(LoggedPage, JsonPage):
)
@method
class get_account_coming(ItemElement):
class fill_account_coming(ItemElement):
klass = Account
obj_coming = CleanDecimal(Dict('totalAmount', default=NotAvailable), default=NotAvailable)
......
......@@ -303,9 +303,6 @@ class IngAPIBrowser(LoginBrowser, StatesMixin):
"""iter accounts on new website"""
self.accounts.stay_or_go()
for account in self.page.iter_accounts():
self.coming.go(account_uid=account.id)
account = self.page.get_account_coming(obj=account)
# We get life insurance details from the API, not the old website
# If the balance is 0, the details page throws an error 500
if account.type == Account.TYPE_LIFE_INSURANCE:
......@@ -317,9 +314,6 @@ class IngAPIBrowser(LoginBrowser, StatesMixin):
}
)
self.page.fill_account(obj=account)
elif account.type in self.types_with_iban:
self.account_info.go(account_uid=account.id)
account.iban = self.page.get_iban()
yield account
......@@ -432,6 +426,19 @@ class IngAPIBrowser(LoginBrowser, StatesMixin):
else:
return self.get_api_coming(account)
@need_to_be_on_website('api')
@need_login
def fill_account_coming(self, account):
self.coming.go(account_uid=account._uid)
self.page.fill_account_coming(obj=account)
@need_to_be_on_website('api')
@need_login
def fill_account_iban(self, account):
if account.type in self.types_with_iban:
self.account_info.go(account_uid=account._uid)
account.iban = self.page.get_iban()
############# CapWealth #############
@need_login
def get_investments(self, account):
......
......@@ -89,6 +89,11 @@ class INGModule(Module, CapBankWealth, CapBankTransferAddRecipient, CapDocument,
account = self.get_account(account)
return self.browser.iter_coming(account)
def fill_account(self, account, fields):
# TODO iban
if 'coming' in fields:
self.browser.fill_account_coming(account)
############# CapWealth #############
def iter_investment(self, account):
if not isinstance(account, Account):
......@@ -179,3 +184,8 @@ class INGModule(Module, CapBankWealth, CapBankTransferAddRecipient, CapDocument,
############# CapProfile #############
def get_profile(self):
return self.browser.get_profile()
# fillobj
OBJECTS = {
Account: fill_account,
}
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