diff --git a/modules/banqueaccord/browser.py b/modules/banqueaccord/browser.py index ee5294d7..cc1cb53b 100644 --- a/modules/banqueaccord/browser.py +++ b/modules/banqueaccord/browser.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright(C) 2013 Romain Bignon +# Copyright(C) 2013-2014 Romain Bignon # # This file is part of weboob. # @@ -75,12 +75,16 @@ class BanqueAccordBrowser(BaseBrowser): for a in self.page.get_list(): post = {'numeroCompte': a.id,} self.location('/site/s/detailcompte/detailcompte.html', urllib.urlencode(post)) - self.location('/site/s/detailcompte/ongletdetailcompte.html') - a.balance = self.page.get_balance() + + a.balance = self.page.get_loan_balance() + if a.balance is not None: + a.type = a.TYPE_LOAN + else: + self.location('/site/s/detailcompte/ongletdetailcompte.html') + a.balance = self.page.get_balance() + a.type = a.TYPE_CARD yield a - - def get_account(self, id): assert isinstance(id, basestring) if not self.is_on_page(IndexPage): @@ -92,7 +96,10 @@ class BanqueAccordBrowser(BaseBrowser): return None def iter_history(self, account): - post = {'numeroCompte': account.id,} + if account.type != account.TYPE_CARD: + return iter([]) + + post = {'numeroCompte': account.id} self.location('/site/s/detailcompte/detailcompte.html', urllib.urlencode(post)) self.location('/site/s/detailcompte/ongletdernieresoperations.html') diff --git a/modules/banqueaccord/pages.py b/modules/banqueaccord/pages.py index eafcbef1..1487061b 100644 --- a/modules/banqueaccord/pages.py +++ b/modules/banqueaccord/pages.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright(C) 2013 Romain Bignon +# Copyright(C) 2013-2014 Romain Bignon # # This file is part of weboob. # @@ -98,6 +98,13 @@ class IndexPage(BasePage): account.label = self.parser.tocleanstring(line) yield account + def get_loan_balance(self): + xpath = '//table//td/strong[contains(text(), "Montant emprunt")]/../../td[2]' + try: + return - Decimal(FrenchTransaction.clean_amount(self.parser.tocleanstring(self.document.xpath(xpath)[0]))) + except IndexError: + return None + def get_card_name(self): return self.parser.tocleanstring(self.document.xpath('//h1')[0])