Commit fc98da7f authored by Maxime Gasselin's avatar Maxime Gasselin Committed by Romain Bignon

[hsbc] Add History for Scpi market account

The navigation to the history has been inspired by the invest scpi navigation.

Closes: 16236@sibi
parent 3e89e43c
......@@ -36,7 +36,7 @@ from weboob.capabilities.base import find_object
from .pages.account_pages import (
AccountsPage, OwnersListPage, CBOperationPage, CPTOperationPage, LoginPage,
AppGonePage, RibPage, UnavailablePage, OtherPage, FrameContainer, ProfilePage,
AppGonePage, RibPage, UnavailablePage, OtherPage, FrameContainer, ProfilePage, ScpiHisPage
from .pages.life_insurances import (
LifeInsurancesPage, LifeInsurancePortal, LifeInsuranceMain, LifeInsuranceUseless,
......@@ -58,6 +58,7 @@ class HSBC(LoginBrowser):
app_gone = False
scpi_investment_page = URL(r'[0-9]/.*', ScpiInvestmentPage)
scpi_his_page = URL(r'[0-9]/.*', ScpiHisPage)
connection = URL(r'', LoginPage)
login = URL(r'*', LoginPage)
cptPage = URL(r'/cgi-bin/emcgi.*\&Cpt=.*',
......@@ -325,6 +326,21 @@ class HSBC(LoginBrowser):
if account.url.startswith('javascript') or '&Crd=' in account.url or account.type == Account.TYPE_LOAN:
raise NotImplementedError()
if account.type == Account.TYPE_MARKET and not 'BOURSE_INV' in account.url:
# Clean account url
m ="'(.*)'", account.url)
if m:
account_url =
account_url = account.url
# Need to be on accounts page to go on scpi page
# Go on scpi page
if account.type in (Account.TYPE_LIFE_INSURANCE, Account.TYPE_CAPITALISATION):
if coming is True:
return []
......@@ -26,10 +26,10 @@ from import Account
from import FrenchTransaction
from import urljoin
from weboob.exceptions import BrowserIncorrectPassword, BrowserUnavailable, ActionNeeded
from weboob.browser.elements import ListElement, ItemElement, method
from weboob.browser.pages import HTMLPage, pagination
from weboob.browser.elements import ListElement, ItemElement, method, TableElement
from weboob.browser.pages import HTMLPage, pagination, LoggedPage
from weboob.browser.filters.standard import (
Filter, Env, CleanText, CleanDecimal, Field, DateGuesser, Regexp, Currency,
Filter, Env, CleanText, CleanDecimal, Field, DateGuesser, Regexp, Currency, Format, Date
from weboob.browser.filters.html import AbsoluteLink, TableCell
from weboob.browser.filters.javascript import JSVar
......@@ -431,3 +431,25 @@ class ProfilePage(OtherPage):
obj_name = CleanText('//div[@id="div_adr_P1"]//p/label[contains(text(), "Nom")]/parent::p/strong')
obj_address = CleanText('//div[@id="div_adr_P1"]//p/label[contains(text(), "Adresse")]/parent::p/strong')
class ScpiHisPage(LoggedPage, HTMLPage):
def is_here(self):
return self.doc.xpath('//h3[contains(text(), "HISTORIQUE DES MOUVEMENTS")]')
class iter_history(TableElement):
item_xpath = '//table[@class="csTable"]//tbody//tr'
head_xpath = '//table[@class="csTable"]//thead//th/a'
col_date = 'Date'
col_amount = 'Montant brut (en €)'
col_operation = 'Opération'
col_nature = 'Nature'
class item(ItemElement):
klass = Transaction
obj_label = Format('%s - %s', CleanText(TableCell('operation')), CleanText(TableCell('nature')))
obj_rdate = Date(CleanText(TableCell('date')), dayfirst=True)
obj_amount = CleanDecimal(TableCell('amount'), sign=lambda x: -1, replace_dots=True)
......@@ -16,7 +16,7 @@ from weboob.browser.pages import HTMLPage, JsonPage, LoggedPage
from weboob.browser.filters.standard import (
CleanText, CleanDecimal, Regexp, Currency, Field, Env,
from weboob.browser.filters.html import TableCell
from weboob.browser.filters.html import TableCell, Link
from weboob.browser.filters.json import Dict
from weboob.browser.filters.javascript import JSVar
from weboob.exceptions import BrowserUnavailable
......@@ -524,6 +524,9 @@ class ScpiInvestmentPage(LoggedPage, HTMLPage):
assert len(detail_page) == 1
self.browser.location('' + CleanText('./@href')(detail_page[0]))
def go_scpi_his_detail_page(self):
return Link('//div/a[contains(text(), "Historique de vos mouvements de parts")]')(self.doc)
class iter_scpi_investment(TableElement):
item_xpath = '//table[@class="csTable"]//tbody//tr'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment