fetch history of life insurances
This commit is contained in:
parent
f591dba678
commit
49da7aaf07
2 changed files with 32 additions and 11 deletions
|
|
@ -19,9 +19,6 @@
|
||||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
from datetime import date
|
|
||||||
from dateutil.relativedelta import relativedelta
|
|
||||||
|
|
||||||
from weboob.deprecated.browser import Browser, BrowserIncorrectPassword
|
from weboob.deprecated.browser import Browser, BrowserIncorrectPassword
|
||||||
|
|
||||||
from .pages.login import LoginPage
|
from .pages.login import LoginPage
|
||||||
|
|
@ -45,7 +42,7 @@ class Fortuneo(Browser):
|
||||||
|
|
||||||
'.*/prive/mes-comptes/livret/consulter-situation/consulter-solde\.jsp.*' : AccountHistoryPage,
|
'.*/prive/mes-comptes/livret/consulter-situation/consulter-solde\.jsp.*' : AccountHistoryPage,
|
||||||
'.*/prive/mes-comptes/compte-courant/consulter-situation/consulter-solde\.jsp.*' : AccountHistoryPage,
|
'.*/prive/mes-comptes/compte-courant/consulter-situation/consulter-solde\.jsp.*' : AccountHistoryPage,
|
||||||
'.*/prive/mes-comptes/compte-titres-.*': InvestmentHistoryPage,
|
'.*/prive/mes-comptes/compte-titres-.*': PeaHistoryPage,
|
||||||
'.*/prive/mes-comptes/assurance-vie.*': InvestmentHistoryPage,
|
'.*/prive/mes-comptes/assurance-vie.*': InvestmentHistoryPage,
|
||||||
'.*/prive/mes-comptes/pea.*': PeaHistoryPage,
|
'.*/prive/mes-comptes/pea.*': PeaHistoryPage,
|
||||||
'.*/prive/mes-comptes/compte-especes.*': InvestmentHistoryPage,
|
'.*/prive/mes-comptes/compte-especes.*': InvestmentHistoryPage,
|
||||||
|
|
@ -93,12 +90,7 @@ class Fortuneo(Browser):
|
||||||
def get_history(self, account):
|
def get_history(self, account):
|
||||||
self.location(account._link_id)
|
self.location(account._link_id)
|
||||||
|
|
||||||
if self.is_on_page(AccountHistoryPage):
|
self.page.select_period()
|
||||||
self.select_form(name='ConsultationHistoriqueOperationsForm')
|
|
||||||
self.set_all_readonly(False)
|
|
||||||
self['dateRechercheDebut'] = (date.today() - relativedelta(years=1)).strftime('%d/%m/%Y')
|
|
||||||
self['nbrEltsParPage'] = '100'
|
|
||||||
self.submit()
|
|
||||||
|
|
||||||
return self.page.get_operations(account)
|
return self.page.get_operations(account)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ from lxml.html import etree
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
import re
|
import re
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
from datetime import date
|
||||||
|
from dateutil.relativedelta import relativedelta
|
||||||
|
|
||||||
from weboob.capabilities.bank import Account, Investment
|
from weboob.capabilities.bank import Account, Investment
|
||||||
from weboob.deprecated.browser import Page, BrowserIncorrectPassword
|
from weboob.deprecated.browser import Page, BrowserIncorrectPassword
|
||||||
|
|
@ -88,6 +90,9 @@ class PeaHistoryPage(Page):
|
||||||
return NotAvailable
|
return NotAvailable
|
||||||
return Decimal(value)
|
return Decimal(value)
|
||||||
|
|
||||||
|
def select_period(self):
|
||||||
|
pass
|
||||||
|
|
||||||
def get_operations(self, _id):
|
def get_operations(self, _id):
|
||||||
return iter([])
|
return iter([])
|
||||||
|
|
||||||
|
|
@ -124,14 +129,38 @@ class InvestmentHistoryPage(Page):
|
||||||
return NotAvailable
|
return NotAvailable
|
||||||
return Decimal(Transaction.clean_amount(value))
|
return Decimal(Transaction.clean_amount(value))
|
||||||
|
|
||||||
|
def select_period(self):
|
||||||
|
self.browser.location(self.url.replace('portefeuille-assurance-vie.jsp', 'operations/assurance-vie-operations.jsp'))
|
||||||
|
|
||||||
|
self.browser.select_form(name='OperationsForm')
|
||||||
|
self.browser.set_all_readonly(False)
|
||||||
|
self.browser['dateDebut'] = (date.today() - relativedelta(years=1)).strftime('%d/%m/%Y')
|
||||||
|
self.browser['nbrEltsParPage'] = '100'
|
||||||
|
self.browser.submit()
|
||||||
|
|
||||||
def get_operations(self, _id):
|
def get_operations(self, _id):
|
||||||
return iter([])
|
for tr in self.document.xpath('//table[@id="tableau_histo_opes"]/tbody/tr'):
|
||||||
|
tds = tr.findall('td')
|
||||||
|
|
||||||
|
t = Transaction()
|
||||||
|
t.parse(date=self.parser.tocleanstring(tds[1]),
|
||||||
|
raw=self.parser.tocleanstring(tds[2]))
|
||||||
|
t.set_amount(self.parser.tocleanstring(tds[-1]))
|
||||||
|
yield t
|
||||||
|
|
||||||
|
|
||||||
class AccountHistoryPage(Page):
|
class AccountHistoryPage(Page):
|
||||||
def get_investments(self):
|
def get_investments(self):
|
||||||
return iter([])
|
return iter([])
|
||||||
|
|
||||||
|
def select_period(self):
|
||||||
|
self.browser.select_form(name='ConsultationHistoriqueOperationsForm')
|
||||||
|
self.browser.set_all_readonly(False)
|
||||||
|
self.browser['dateRechercheDebut'] = (date.today() - relativedelta(years=1)).strftime('%d/%m/%Y')
|
||||||
|
self.browser['nbrEltsParPage'] = '100'
|
||||||
|
self.browser.submit()
|
||||||
|
|
||||||
|
|
||||||
def get_operations(self, _id):
|
def get_operations(self, _id):
|
||||||
"""history, see http://docs.weboob.org/api/capabilities/bank.html?highlight=transaction#weboob.capabilities.bank.Transaction"""
|
"""history, see http://docs.weboob.org/api/capabilities/bank.html?highlight=transaction#weboob.capabilities.bank.Transaction"""
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue