Commit b2232b01 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 7531c00a
Pipeline #2086 passed with stages
in 16 minutes and 53 seconds
......@@ -24,6 +24,7 @@ from weboob.exceptions import BrowserIncorrectPassword, ActionNeeded
from .pages import (
LoginPage, AccountsPage, AMFHSBCPage, AMFAmundiPage, AMFSGPage, HistoryPage,
ErrorPage, LyxorfcpePage, EcofiPage, EcofiDummyPage, LandingPage, SwissLifePage, LoginErrorPage,
ProfilePage,
)
......@@ -44,6 +45,7 @@ class S2eBrowser(LoginBrowser, StatesMixin):
history = URL('/portal/salarie-(?P<slug>\w+)/operations/consulteroperations', HistoryPage)
error = URL('/maintenance/.+/', ErrorPage)
swisslife = URL('http://fr.swisslife-am.com/fr/produits/.*', SwissLifePage)
profile_page = URL('/portal/salarie-(?P<slug>\w+)/mesdonnees/coordperso', ProfilePage)
STATE_DURATION = 10
......@@ -140,6 +142,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 NoAccountsException, BrowserUnavailable, ActionNeeded, BrowserQuestion, BrowserIncorrectPassword
......@@ -592,3 +593,19 @@ class SwissLifePage(HTMLPage):
if code == "n/a":
return NotAvailable
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