From 0bdacd66fe15881636faf2031e33da52d1abed3a Mon Sep 17 00:00:00 2001 From: Baptiste Delpey Date: Tue, 4 Aug 2015 18:26:29 +0200 Subject: [PATCH] caissedepargne add balance on NUANCE ... --- modules/caissedepargne/pages.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/caissedepargne/pages.py b/modules/caissedepargne/pages.py index da88fb0e..921500bc 100644 --- a/modules/caissedepargne/pages.py +++ b/modules/caissedepargne/pages.py @@ -161,7 +161,7 @@ class IndexPage(Page): account._info = info account.label = label account.type = info['acc_type'] if 'acc_type' in info else account_type - account.balance = Decimal(FrenchTransaction.clean_amount(balance)) if balance else NotAvailable + account.balance = Decimal(FrenchTransaction.clean_amount(balance)) if balance else self.get_balance(account) account.currency = account.get_currency(balance) account._card_links = [] @@ -175,6 +175,14 @@ class IndexPage(Page): accounts[account.id] = account + def get_balance(self, account): + if not account.type == Account.TYPE_LIFE_INSURANCE: + return NotAvailable + self.go_history(account._info) + balance = self.browser.page.document.xpath('.//tr[td[contains(text(), ' + account.id + ')]]/td[contains(@class, "somme")]')[0] + balance = Decimal(FrenchTransaction.clean_amount(self.parser.tocleanstring(balance))) + return balance + def get_list(self): accounts = OrderedDict()