support deferred debit cards

This commit is contained in:
Romain Bignon 2012-10-10 14:44:34 +02:00
commit 85c9554733
3 changed files with 86 additions and 46 deletions

View file

@ -99,12 +99,27 @@ class SocieteGenerale(BaseBrowser):
return None
def iter_history(self, url):
self.location(url)
def iter_history(self, account):
self.location(account._link_id)
if not self.is_on_page(AccountHistory):
# TODO: support other kind of accounts
self.logger.warning('This account is not supported')
raise NotImplementedError('This account is not supported')
return self.page.iter_transactions()
transactions = list(self.page.iter_transactions(coming=False))
for card_link in account._card_links:
self.location(card_link)
transactions += list(self.page.iter_transactions(coming=True))
def key(tr):
# Can't compare datetime and date, so cast them.
try:
return tr.rdate.date()
except AttributeError:
return tr.rdate
transactions.sort(key=key, reverse=True)
return iter(transactions)