Commit 699526d7 authored by Ludovic LANGE's avatar Ludovic LANGE

[s2e] adding CapProfile

Fetch information and build profile for all investment banks
using s2e module.
This will add get_profile() to all inherited modules:
bnppere, capeasi, erehsbc, esalia.
parent 953f9ace
Pipeline #2585 passed with stages
......@@ -25,6 +25,7 @@ from .pages import (
LoginPage, AccountsPage, AMFHSBCPage, AMFAmundiPage, AMFSGPage, HistoryPage,
ErrorPage, LyxorfcpePage, EcofiPage, EcofiDummyPage, LandingPage, SwissLifePage, LoginErrorPage,
EtoileGestionPage, EtoileGestionCharacteristicsPage,
ProfilePage,
)
......@@ -47,6 +48,7 @@ class S2eBrowser(LoginBrowser, StatesMixin):
swisslife = URL('http://fr.swisslife-am.com/fr/produits/.*', SwissLifePage)
etoile_gestion = URL('http://www.etoile-gestion.com/index.php/etg_fr_fr/productsheet/view/.*', EtoileGestionPage)
etoile_gestion_characteristics = URL('http://www.etoile-gestion.com/etg_fr_fr/ezjscore/.*', EtoileGestionCharacteristicsPage)
profile_page = URL('/portal/salarie-(?P<slug>\w+)/mesdonnees/coordperso', ProfilePage)
STATE_DURATION = 10
......@@ -152,6 +154,12 @@ class S2eBrowser(LoginBrowser, StatesMixin):
# Go back to first page
self.page.go_start()
@need_login
def get_profile(self):
self.profile_page.stay_or_go(slug=self.SLUG)
profile = self.page.get_profile()
return profile
class EsaliaBrowser(S2eBrowser):
BASEURL = 'https://salaries.esalia.com'
......
......@@ -21,9 +21,10 @@
from weboob.tools.backend import Module
from weboob.capabilities.bank import CapBankPockets, AccountNotFound
from weboob.capabilities.base import find_object
from weboob.capabilities.profile import CapProfile
class S2eModule(Module, CapBankPockets):
class S2eModule(Module, CapBankPockets, CapProfile):
NAME = 's2e'
DESCRIPTION = u'Épargne Salariale'
MAINTAINER = u'Edouard Lambert'
......@@ -45,3 +46,6 @@ class S2eModule(Module, CapBankPockets):
def iter_pocket(self, account):
return self.browser.iter_pocket(account)
def get_profile(self):
return self.browser.get_profile()
\ No newline at end of file
......@@ -29,6 +29,7 @@ from weboob.browser.elements import ItemElement, TableElement, SkipItem, method
from weboob.browser.filters.standard import CleanText, Date, Regexp, Eval, CleanDecimal, Env, Field
from weboob.browser.filters.html import Attr, TableCell
from weboob.capabilities.bank import Account, Investment, Pocket, Transaction
from weboob.capabilities.profile import Person
from weboob.capabilities.base import NotAvailable
from weboob.tools.captcha.virtkeyboard import MappedVirtKeyboard
from weboob.exceptions import BrowserUnavailable, ActionNeeded, BrowserQuestion, BrowserIncorrectPassword
......@@ -640,3 +641,18 @@ class EtoileGestionCharacteristicsPage(PartialHTMLPage):
def get_code_amf(self):
code = CleanText('//td[contains(text(), "Code AMF")]/following-sibling::td', default=None)(self.doc)
return code
class ProfilePage(LoggedPage, HTMLPage):
def get_profile(self):
profile = Person()
civilite = CleanText('//div/span[contains(text(), "Civilité")]/following-sibling::div/span')(self.doc)
familly_name = CleanText('//div/span[contains(text(), "Nom")]/following-sibling::div/span')(self.doc)
given_name = CleanText('//div/span[contains(text(), "Prénom")]/following-sibling::div/span')(self.doc)
profile.name = u'%s %s %s' % (civilite, given_name, familly_name)
profile.address = CleanText('//div/span[contains(text(), "Adresse postale")]/following-sibling::div/div[2]')(self.doc)
profile.phone = CleanText('//div/span[contains(text(), "Tél. portable")]/following-sibling::div/span')(self.doc)
profile.email = CleanText('//div/span[contains(text(), "E-mail")]/following-sibling::div/span')(self.doc)
profile.company_name = CleanText('//div/span[contains(text(), "Entreprise")]/following-sibling::span[1]')(self.doc)
return profile
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