banquepopulaire life insurance investment
This commit is contained in:
parent
a531d94571
commit
886b4bf204
2 changed files with 59 additions and 9 deletions
|
|
@ -23,7 +23,8 @@ import urllib
|
||||||
from weboob.deprecated.browser import Browser, BrowserIncorrectPassword, BrokenPageError
|
from weboob.deprecated.browser import Browser, BrowserIncorrectPassword, BrokenPageError
|
||||||
|
|
||||||
from .pages import LoginPage, IndexPage, AccountsPage, AccountsFullPage, CardsPage, TransactionsPage, \
|
from .pages import LoginPage, IndexPage, AccountsPage, AccountsFullPage, CardsPage, TransactionsPage, \
|
||||||
UnavailablePage, RedirectPage, HomePage, Login2Page, InvestmentPage
|
UnavailablePage, RedirectPage, HomePage, Login2Page, \
|
||||||
|
LineboursePage, NatixisPage, InvestmentNatixisPage, InvestmentLineboursePage
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['BanquePopulaire']
|
__all__ = ['BanquePopulaire']
|
||||||
|
|
@ -43,6 +44,7 @@ class BanquePopulaire(Browser):
|
||||||
'https://[^/]+/cyber/internet/ContinueTask.do\?.*dialogActionPerformed=ENCOURS_COMPTE.*': CardsPage,
|
'https://[^/]+/cyber/internet/ContinueTask.do\?.*dialogActionPerformed=ENCOURS_COMPTE.*': CardsPage,
|
||||||
'https://[^/]+/cyber/internet/ContinueTask.do\?.*dialogActionPerformed=SELECTION_ENCOURS_CARTE.*': TransactionsPage,
|
'https://[^/]+/cyber/internet/ContinueTask.do\?.*dialogActionPerformed=SELECTION_ENCOURS_CARTE.*': TransactionsPage,
|
||||||
'https://[^/]+/cyber/internet/ContinueTask.do\?.*dialogActionPerformed=SOLDE.*': TransactionsPage,
|
'https://[^/]+/cyber/internet/ContinueTask.do\?.*dialogActionPerformed=SOLDE.*': TransactionsPage,
|
||||||
|
'https://[^/]+/cyber/internet/ContinueTask.do\?.*dialogActionPerformed=CONTRAT.*': TransactionsPage,
|
||||||
'https://[^/]+/cyber/internet/Page.do\?.*': TransactionsPage,
|
'https://[^/]+/cyber/internet/Page.do\?.*': TransactionsPage,
|
||||||
'https://[^/]+/cyber/internet/Sort.do\?.*': TransactionsPage,
|
'https://[^/]+/cyber/internet/Sort.do\?.*': TransactionsPage,
|
||||||
'https://[^/]+/s3f-web/.*': UnavailablePage,
|
'https://[^/]+/s3f-web/.*': UnavailablePage,
|
||||||
|
|
@ -52,7 +54,10 @@ class BanquePopulaire(Browser):
|
||||||
'https://[^/]+/portailinternet/Pages/default.aspx': HomePage,
|
'https://[^/]+/portailinternet/Pages/default.aspx': HomePage,
|
||||||
'https://[^/]+/portailinternet/Transactionnel/Pages/CyberIntegrationPage.aspx': HomePage,
|
'https://[^/]+/portailinternet/Transactionnel/Pages/CyberIntegrationPage.aspx': HomePage,
|
||||||
'https://[^/]+/WebSSO_BP/_(?P<bankid>\d+)/index.html\?transactionID=(?P<transactionID>.*)': Login2Page,
|
'https://[^/]+/WebSSO_BP/_(?P<bankid>\d+)/index.html\?transactionID=(?P<transactionID>.*)': Login2Page,
|
||||||
'https://www.linebourse.fr/Portefeuille': InvestmentPage,
|
'https://www.linebourse.fr/ReroutageSJR': LineboursePage,
|
||||||
|
'https://www.linebourse.fr/Portefeuille': InvestmentLineboursePage,
|
||||||
|
'https://www.assurances.natixis.fr/espaceinternet-bp/views/common.*': NatixisPage,
|
||||||
|
'https://www.assurances.natixis.fr/espaceinternet-bp/views/contrat.*': InvestmentNatixisPage,
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, website, *args, **kwargs):
|
def __init__(self, website, *args, **kwargs):
|
||||||
|
|
@ -181,14 +186,15 @@ class BanquePopulaire(Browser):
|
||||||
def get_investment(self, account):
|
def get_investment(self, account):
|
||||||
account = self.get_account(account.id)
|
account = self.get_account(account.id)
|
||||||
params = account._params
|
params = account._params
|
||||||
if params is None:
|
|
||||||
return iter([])
|
|
||||||
params['token'] = self.page.build_token(params['token'])
|
params['token'] = self.page.build_token(params['token'])
|
||||||
self.location('/cyber/internet/ContinueTask.do', urllib.urlencode(params))
|
self.location('/cyber/internet/ContinueTask.do', urllib.urlencode(params))
|
||||||
params = self.page.get_investment_page_params()
|
url, params = self.page.get_investment_page_params()
|
||||||
if params:
|
if params:
|
||||||
self.open('https://www.linebourse.fr/ReroutageSJR', urllib.urlencode(params))
|
self.location(url, urllib.urlencode(params))
|
||||||
self.location('https://www.linebourse.fr/Portefeuille')
|
if self.is_on_page(LineboursePage):
|
||||||
|
self.location('https://www.linebourse.fr/Portefeuille')
|
||||||
|
elif self.is_on_page(NatixisPage):
|
||||||
|
self.page.submit_form()
|
||||||
return self.page.get_investments()
|
return self.page.get_investments()
|
||||||
|
|
||||||
return iter([])
|
return iter([])
|
||||||
|
|
|
||||||
|
|
@ -413,6 +413,12 @@ class AccountsPage(BasePage):
|
||||||
if m and m.group(1) != 'EQUIPEMENT_COMPLET':
|
if m and m.group(1) != 'EQUIPEMENT_COMPLET':
|
||||||
_params['prevAction'] = m.group(1)
|
_params['prevAction'] = m.group(1)
|
||||||
next_pages.append(_params)
|
next_pages.append(_params)
|
||||||
|
|
||||||
|
if not account._params:
|
||||||
|
account._params = params.copy()
|
||||||
|
account._params['dialogActionPerformed'] = 'CONTRAT'
|
||||||
|
account._params['attribute($SEL_$%s)' % tr.attrib['id'].split('_')[0]] = tr.attrib['id'].split('_', 1)[1]
|
||||||
|
|
||||||
yield account
|
yield account
|
||||||
|
|
||||||
# Needed to preserve navigation.
|
# Needed to preserve navigation.
|
||||||
|
|
@ -631,13 +637,21 @@ class TransactionsPage(BasePage):
|
||||||
|
|
||||||
def get_investment_page_params(self):
|
def get_investment_page_params(self):
|
||||||
script = self.document.xpath('//body')[0].attrib['onload']
|
script = self.document.xpath('//body')[0].attrib['onload']
|
||||||
|
url = None
|
||||||
|
m = re.search(r"','(.+?)',\[", script, re.MULTILINE)
|
||||||
|
if m:
|
||||||
|
url = m.group(1)
|
||||||
params = {}
|
params = {}
|
||||||
for key, value in re.findall(r"key:'(?P<key>SJRToken)'\,value:'(?P<value>.*?)'}", script, re.MULTILINE):
|
for key, value in re.findall(r"key:'(?P<key>SJRToken)'\,value:'(?P<value>.*?)'}", script, re.MULTILINE):
|
||||||
params[key] = value
|
params[key] = value
|
||||||
return params
|
return url, params if url and params else None
|
||||||
|
|
||||||
|
|
||||||
class InvestmentPage(_BasePage):
|
class LineboursePage(_BasePage):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class InvestmentLineboursePage(_BasePage):
|
||||||
COL_LABEL = 0
|
COL_LABEL = 0
|
||||||
COL_QUANTITY = 1
|
COL_QUANTITY = 1
|
||||||
COL_UNITVALUE = 2
|
COL_UNITVALUE = 2
|
||||||
|
|
@ -666,3 +680,33 @@ class InvestmentPage(_BasePage):
|
||||||
if value == '':
|
if value == '':
|
||||||
return NotAvailable
|
return NotAvailable
|
||||||
return Decimal(Transaction.clean_amount(value))
|
return Decimal(Transaction.clean_amount(value))
|
||||||
|
|
||||||
|
|
||||||
|
class NatixisPage(_BasePage):
|
||||||
|
def submit_form(self):
|
||||||
|
self.browser.select_form(name="formRoutage")
|
||||||
|
self.browser.submit(nologin=True)
|
||||||
|
|
||||||
|
|
||||||
|
class InvestmentNatixisPage(_BasePage):
|
||||||
|
COL_LABEL = 0
|
||||||
|
COL_QUANTITY = 2
|
||||||
|
COL_UNITVALUE = 3
|
||||||
|
COL_VALUATION = 4
|
||||||
|
def get_investments(self):
|
||||||
|
for line in self.document.xpath('//div[@class="row-fluid table-contrat-supports"]/table/tbody[(@class)]/tr'):
|
||||||
|
cols = line.findall('td')
|
||||||
|
|
||||||
|
inv = Investment()
|
||||||
|
inv.label = self.parser.tocleanstring(cols[self.COL_LABEL]).replace('Cas sans risque ', '')
|
||||||
|
inv.quantity = self.parse_decimal(cols[self.COL_QUANTITY])
|
||||||
|
inv.unitvalue = self.parse_decimal(cols[self.COL_UNITVALUE])
|
||||||
|
inv.valuation = self.parse_decimal(cols[self.COL_VALUATION])
|
||||||
|
|
||||||
|
yield inv
|
||||||
|
|
||||||
|
def parse_decimal(self, string):
|
||||||
|
value = self.parser.tocleanstring(string).replace('Si famille fonds generaux, on affiche un tiret', '').replace('Cas sans risque', '').replace(' ', '')
|
||||||
|
if value == '-':
|
||||||
|
return NotAvailable
|
||||||
|
return Decimal(Transaction.clean_amount(value))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue