support LCR

This commit is contained in:
Romain Bignon 2014-03-07 10:41:24 +01:00
commit 35cdd3b69a
2 changed files with 21 additions and 2 deletions

View file

@ -20,7 +20,7 @@
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
from .pages import LoginPage, DashboardPage, OperationsPage from .pages import LoginPage, DashboardPage, OperationsPage, LCRPage
__all__ = ['DelubacBrowser'] __all__ = ['DelubacBrowser']
@ -39,6 +39,7 @@ class DelubacBrowser(BaseBrowser):
'%s://%s/(simpleIndex|index).do(\;.*)?' % (PROTOCOL, DOMAIN): LoginPage, '%s://%s/(simpleIndex|index).do(\;.*)?' % (PROTOCOL, DOMAIN): LoginPage,
'%s://%s/tbord.do(\?.*)?' % (PROTOCOL, DOMAIN): DashboardPage, '%s://%s/tbord.do(\?.*)?' % (PROTOCOL, DOMAIN): DashboardPage,
'%s://%s/releve.do(\?.*)?' % (PROTOCOL, DOMAIN): OperationsPage, '%s://%s/releve.do(\?.*)?' % (PROTOCOL, DOMAIN): OperationsPage,
'%s://%s/encoursList.do(\?.*)?' % (PROTOCOL, DOMAIN): LCRPage,
} }
PAGES_REV = { PAGES_REV = {

View file

@ -26,7 +26,7 @@ from weboob.tools.browser import BasePage
from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction
__all__ = ['LoginPage', 'DashboardPage', 'OperationsPage'] __all__ = ['LoginPage', 'DashboardPage', 'OperationsPage', 'LCRPage']
class LoginPage(BasePage): class LoginPage(BasePage):
@ -97,6 +97,24 @@ class OperationsPage(BasePage):
if next_button: if next_button:
return next_button[0] return next_button[0]
class LCRPage(OperationsPage):
def iter_history(self):
date = None
for line in self.document.xpath('//table[@id="encoursTable"]/tbody/tr'):
if line.attrib.get('class', '').startswith('PL_LIGLST_'):
ref = self.parser.tocleanstring(line.xpath('./td[2]')[0])
tr = Transaction(ref)
raw = self.parser.tocleanstring(line.xpath('./td[1]')[0])
amount = self.parser.tocleanstring(line.xpath('./td')[-1])
tr.parse(date=date, raw=raw)
tr.set_amount(amount)
yield tr
elif line.find('td').attrib.get('class', '').startswith('PL_TOT'):
m = re.search('(\d+/\d+/\d+)', line.xpath('./td')[0].text)
if m:
date = m.group(1)
class Transaction(FrenchTransaction): class Transaction(FrenchTransaction):
PATTERNS = [(re.compile('^(?:Vir(?:ement)?|VRT) (?P<text>.*)', re.I), PATTERNS = [(re.compile('^(?:Vir(?:ement)?|VRT) (?P<text>.*)', re.I),