From ac1cce7929ebd678de99d32da2d05710776ab99d Mon Sep 17 00:00:00 2001 From: Sylvie Ye Date: Thu, 12 Jul 2018 15:58:47 +0200 Subject: [PATCH] [axabanque] get pea history on netfinca bourse page on axabanque page, pea history leads to an error page (in HTTP ...) get history on netfinca bourse page for pea liquidity and pea market Closes: 12819@sibi 12814@sibi 11620@sibi 11492@sibi 13455@sibi 11618@sibi 12821@sibi 11643@sibi 9251@sibi 11496@sibi 12813@sibi 9192@sibi 9203@sibi 9750@sibi 11123@sibi 11495@sibi 12818@sibi --- modules/axabanque/browser.py | 18 +++++++++++++++++- modules/axabanque/pages/bank.py | 14 ++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/modules/axabanque/browser.py b/modules/axabanque/browser.py index 3a58a43162..dba151dd27 100644 --- a/modules/axabanque/browser.py +++ b/modules/axabanque/browser.py @@ -120,9 +120,11 @@ class AXABanque(AXABrowser, StatesMixin): lifeinsurance_iframe = URL('https://assurance-vie.axabanque.fr/Consultation/SituationContrat.aspx', 'https://assurance-vie.axabanque.fr/Consultation/HistoriqueOperations.aspx', LifeInsuranceIframe) + # netfinca bourse bourse = URL(r'/transactionnel/client/homepage_bourseCAT.html', r'https://bourse.axabanque.fr/netfinca-titres/servlet/com.netfinca.*', BoursePage) + bourse_history = URL(r'https://bourse.axabanque.fr/netfinca-titres/servlet/com.netfinca.frontcr.account.AccountHistory', BoursePage) # Transfer recipients = URL('/transactionnel/client/enregistrer-nouveau-beneficiaire.html', RecipientsPage) @@ -280,7 +282,21 @@ def iter_investment(self, account): def iter_history(self, account): if account.type == Account.TYPE_LOAN: return - elif account.type == Account.TYPE_PEA and 'Liquidités' in account.label: + elif account.type == Account.TYPE_PEA: + self.go_account_pages(account, "history") + + # go on netfinca page to get pea history + acc = self.get_netfinca_account(account) + self.location(acc._market_link) + self.bourse_history.go() + + if not 'Liquidités' in account.label: + self.page.go_history_filter(cash_filter="market") + else: + self.page.go_history_filter(cash_filter="liquidity") + + for tr in self.page.iter_history(): + yield tr return if account.type == Account.TYPE_LIFE_INSURANCE and account._acctype == "bank": diff --git a/modules/axabanque/pages/bank.py b/modules/axabanque/pages/bank.py index 78062e9e6e..59cc7c20fc 100644 --- a/modules/axabanque/pages/bank.py +++ b/modules/axabanque/pages/bank.py @@ -20,6 +20,7 @@ from collections import OrderedDict import re from decimal import Decimal, InvalidOperation +from datetime import datetime, timedelta from weboob.exceptions import BrowserUnavailable from weboob.browser.pages import HTMLPage, PDFPage, LoggedPage, AbstractPage @@ -554,3 +555,16 @@ def open_market_next(self): # only for netfinca PEA # can't do it in separate page/on_load because there might be history on this page... self.get_form(id='formToSubmit').submit() + + def go_history_filter(self, cash_filter='all'): + cash_filter_value = { + 'market': 0, + 'liquidity': 1, + 'all': 'ALL', + } + + form = self.get_form(id="historyFilter") + form['cashFilter'] = cash_filter_value[cash_filter] + # We can't go above 2 years + form['beginDayfilter'] = (datetime.strptime(form['endDayfilter'], '%d/%m/%Y') - timedelta(days=730)).strftime('%d/%m/%Y') + form.submit() -- GitLab