support loan accounts
This commit is contained in:
parent
7f159cf20d
commit
cedae69840
2 changed files with 21 additions and 7 deletions
|
|
@ -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')
|
||||
|
||||
|
|
|
|||
|
|
@ -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])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue