Add the history for Livret A account (ing)

Signed-off-by: Florent <weboob@flo.fourcot.fr>
Signed-off-by: Romain Bignon <romain@peerfuse.org>
This commit is contained in:
Florent 2012-01-09 16:23:24 +01:00 committed by Romain Bignon
commit 91cfedb247
3 changed files with 45 additions and 8 deletions

View file

@ -22,12 +22,12 @@ from datetime import date
from weboob.tools.browser import BasePage
from weboob.capabilities.bank import Operation
from weboob.capabilities.base import NotAvailable
__all__ = ['AccountHistoryCC', 'AccountHistoryLA']
__all__ = ['AccountHistory']
class AccountHistory(BasePage):
class AccountHistoryCC(BasePage):
def on_loaded(self):
self.operations = []
@ -49,3 +49,32 @@ class AccountHistory(BasePage):
def get_operations(self):
return self.operations
class AccountHistoryLA(BasePage):
def on_loaded(self):
self.operations = []
i = 1
history = self.document.xpath('//tr[@align="center"]')
history.pop(0)
for tr in history:
id = i
texte = tr.text_content().strip().split('\n')
op = Operation(id)
# The size is not the same if there are two dates or only one
length = len(texte)
op.label = unicode(texte[length - 2].strip())
op.date = date(*reversed([int(x) for x in texte[0].split('/')]))
op.category = NotAvailable
amount = texte[length - 1].replace('\t','').strip().replace('.', '').replace(u'', '').replace(',', '.').replace(u'\xa0', u'')
op.amount = float(amount)
self.operations.append(op)
i += 1
def get_operations(self):
return self.operations