From 9d3d8eb1a15171ec1b50acd5e7c3c2aa4d8df81f Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Thu, 7 Jun 2012 15:30:19 +0200 Subject: [PATCH] support history of coming transactions --- modules/hsbc/backend.py | 11 +++++++++-- modules/hsbc/pages/accounts.py | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/hsbc/backend.py b/modules/hsbc/backend.py index 44adb97d..e7263f7d 100644 --- a/modules/hsbc/backend.py +++ b/modules/hsbc/backend.py @@ -58,5 +58,12 @@ class HSBCBackend(BaseBackend, ICapBank): def iter_history(self, account): with self.browser: - for history in self.browser.get_history(account._link_id): - yield history + for tr in self.browser.get_history(account._link_id): + if not tr._coming: + yield tr + + def iter_coming(self, account): + with self.browser: + for tr in self.browser.get_history(account._link_id): + if tr._coming: + yield tr diff --git a/modules/hsbc/pages/accounts.py b/modules/hsbc/pages/accounts.py index 1ccac993..69894a2d 100644 --- a/modules/hsbc/pages/accounts.py +++ b/modules/hsbc/pages/accounts.py @@ -80,4 +80,5 @@ class HistoryPage(BasePage): op = Transaction(m.group(1)) op.parse(date=m.group(3), raw=re.sub(u'[ ]+', u' ', m.group(4).replace(u'\n', u' '))) op.set_amount(m.group(5)) + op._coming = (re.match('\d+/\d+/\d+', m.group(2)) is None) yield op