Commit ba59c4d2 authored by Vincent Ardisson's avatar Vincent Ardisson Committed by Romain Bignon

[barclays] return credit card history

They were completely skipped. There's a link to access previous month
history.
However, the debit dates all seem wrong, same for coming.
parent 3f2ccc8a
......@@ -150,8 +150,7 @@ class Barclays(LoginBrowser):
@need_login
def iter_history(self, account):
if account.type == Account.TYPE_CARD or (account._multiple_type and not self._multiple_account_choice(account)):
# warning: this shit code is not idempotent ^
if account._multiple_type and not self._multiple_account_choice(account):
return []
elif account.type == Account.TYPE_LOAN:
return []
......@@ -163,6 +162,11 @@ class Barclays(LoginBrowser):
self.logger.warning('cannot go to history page for %r', account)
return []
if account.type == Account.TYPE_CARD:
if not self._go_to_account_space('Échéance précédente', account):
self.logger.warning('Could not go to history page for %r', account)
return []
history_page = self.page
if account.type != Account.TYPE_LIFE_INSURANCE:
......
......@@ -427,6 +427,17 @@ class CardPage(AbstractAccountPage):
def obj_amount(self):
return MyDecimal('./td[5]//div/span')(self)
def get_space_attrs(self, space):
a = self.doc.xpath('//a[contains(span, $space)]', space=space)
if not a:
self.logger.debug('there is no %r link on this page', space)
return None
a = Regexp(Attr('.', 'onclick'), r'\((.*?)\)')(a[0]).replace('\'', '').split(', ')
form = self.get_form(id='form1')
return (a[1], 'C4__WORKING[1].LISTCONTRATS', form['C4__WORKING[1].LISTCONTRATS'], a[2])
class IbanPDFPage(LoggedPage, PDFPage):
def get_iban(self):
......
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