diff --git a/modules/ing/backend.py b/modules/ing/backend.py index 6cf94b92..ac9b5646 100644 --- a/modules/ing/backend.py +++ b/modules/ing/backend.py @@ -96,6 +96,11 @@ class INGBackend(BaseBackend, CapBank, CapBill): account = self.get_account(account) return self.browser.get_investments(account) + def iter_coming(self, account): + if not isinstance(account, Account): + account = self.get_account(account) + return self.browser.get_coming(account) + def iter_subscription(self): return self.browser.get_subscriptions() diff --git a/modules/ing/browser.py b/modules/ing/browser.py index 733c9e86..4fd1726a 100644 --- a/modules/ing/browser.py +++ b/modules/ing/browser.py @@ -49,7 +49,6 @@ class IngBrowser(LoginBrowser): # CapBill billpage = URL('/protected/pages/common/estatement/eStatement.jsf', BillsPage) - def __init__(self, *args, **kwargs): self.birthday = kwargs.pop('birthday', None) self.where = None @@ -77,6 +76,31 @@ class IngBrowser(LoginBrowser): self.where = "start" return self.page.get_list() + @need_login + def get_coming(self, account): + if account.type != Account.TYPE_CHECKING and\ + account.type != Account.TYPE_SAVINGS: + raise NotImplementedError() + if self.where != "start": + self.accountspage.go() + data = {"AJAX:EVENTS_COUNT": 1, + "AJAXREQUEST": "_viewRoot", + "ajaxSingle": "index:setAccount", + "autoScroll": "", + "index": "index", + "index:setAccount": "index:setAccount", + "javax.faces.ViewState": account._jid, + "cptnbr": account._id + } + self.accountspage.go(data=data) + self.where = "history" + jid = self.page.get_history_jid() + if jid is None: + self.logger.info('There is no history for this account') + return + + return self.page.get_coming() + @need_login def get_history(self, account): if account.type == Account.TYPE_MARKET: diff --git a/modules/ing/pages/accounts_list.py b/modules/ing/pages/accounts_list.py index eba47ec8..acccb38e 100644 --- a/modules/ing/pages/accounts_list.py +++ b/modules/ing/pages/accounts_list.py @@ -131,10 +131,7 @@ class AccountsList(LoggedPage, HTMLPage): obj_coming = NotAvailable obj__jid = Attr('//input[@name="javax.faces.ViewState"]', 'value') - @method - class get_transactions(ListElement): - item_xpath = '//div[@class="temporaryTransactionList"]//table' - + class generic_transactions(ListElement): class item(ItemElement): klass = Transaction @@ -152,6 +149,14 @@ class AccountsList(LoggedPage, HTMLPage): return False return True + @method + class get_coming(generic_transactions): + item_xpath = '//div[@class="transactions cc future"]//table' + + @method + class get_transactions(generic_transactions): + item_xpath = '//div[@class="temporaryTransactionList"]//table' + def get_history_jid(self): span = self.doc.xpath('//span[@id="index:panelASV"]') if len(span) > 1: