diff --git a/modules/bforbank/browser.py b/modules/bforbank/browser.py index 54bec9e1b2cd58d66f9c54b4996c455ad8685cf7..536b17681de6265d8ef92582c3ea3441f3d6cf5b 100644 --- a/modules/bforbank/browser.py +++ b/modules/bforbank/browser.py @@ -30,7 +30,7 @@ LoginPage, ErrorPage, AccountsPage, HistoryPage, LoanHistoryPage, RibPage, LifeInsuranceList, LifeInsuranceIframe, LifeInsuranceRedir, BoursePage, CardHistoryPage, CardPage, UserValidationPage, BourseActionNeeded, - BourseDisconnectPage, + BourseDisconnectPage, ProfilePage, ) from .spirica_browser import SpiricaBrowser @@ -68,6 +68,7 @@ class BforbankBrowser(LoginBrowser): bourse_titre = URL(r'https://bourse.bforbank.com/netfinca-titres/servlet/com.netfinca.frontcr.navigation.Titre', BoursePage) # to get logout link bourse_disco = URL(r'https://bourse.bforbank.com/netfinca-titres/servlet/com.netfinca.frontcr.login.ContextTransferDisconnect', BourseDisconnectPage) + profile = URL(r'/espace-client/profil/informations', ProfilePage) def __init__(self, birthdate, username, password, *args, **kwargs): super(BforbankBrowser, self).__init__(username, password, *args, **kwargs) @@ -295,3 +296,8 @@ def leave_espace_bourse(self): self.location(self.bourse_titre.build()) self.location(self.page.get_logout_link()) self.location(self.page.get_relocation()) + + @need_login + def get_profile(self): + self.profile.go() + return self.page.get_profile() diff --git a/modules/bforbank/module.py b/modules/bforbank/module.py index a679eeb3638b6c16c0d05fb3dac07f1700dc756b..92260aff4b13519a10f7ea05fac920f97eafcd96 100644 --- a/modules/bforbank/module.py +++ b/modules/bforbank/module.py @@ -21,6 +21,7 @@ from weboob.tools.backend import Module, BackendConfig from weboob.capabilities.bank import CapBankWealth, AccountNotFound from weboob.capabilities.base import find_object +from weboob.capabilities.profile import CapProfile from weboob.tools.value import ValueBackendPassword, ValueDate from .browser import BforbankBrowser @@ -28,7 +29,7 @@ __all__ = ['BforbankModule'] -class BforbankModule(Module, CapBankWealth): +class BforbankModule(Module, CapBankWealth, CapProfile): NAME = 'bforbank' DESCRIPTION = u'BforBank' MAINTAINER = u'Baptiste Delpey' @@ -62,3 +63,6 @@ def iter_history(self, account): def iter_investment(self, account): return self.browser.iter_investment(account) + + def get_profile(self): + return self.browser.get_profile() diff --git a/modules/bforbank/pages.py b/modules/bforbank/pages.py index 3b2504a5b158bfa09a67c4bc595d1310664176e8..1a2da3558f8936a3a69e83a1cb0dfe5126fd6008 100644 --- a/modules/bforbank/pages.py +++ b/modules/bforbank/pages.py @@ -30,6 +30,7 @@ from weboob.browser.pages import LoggedPage, HTMLPage, pagination, AbstractPage from weboob.browser.elements import method, ListElement, ItemElement, TableElement from weboob.capabilities.bank import Account +from weboob.capabilities.profile import Person from weboob.browser.filters.html import Link, Attr, TableCell from weboob.browser.filters.standard import ( CleanText, Regexp, Field, Map, CleanDecimal, Date, Format, @@ -386,3 +387,24 @@ def get_relocation(self): if link: m = link.group(1) return m + + +class ProfilePage(LoggedPage, HTMLPage): + @method + class get_profile(ItemElement): + klass = Person + + obj_birth_date = Date(CleanText('//td[text()="Date de naissance"]/following::td[1]')) + obj_name = CleanText('//div[contains(@class,"tab-pane")]/table/thead/tr/th') + obj_nationality = CleanText('//td[text()="Nationalité(s)"]/following::td[1]') + obj_family_situation = CleanText('//td[text()="Situation Familiale"]/following::td[1]') + obj_email = CleanText('//td[text()="Adresse e-mail"]/following::td[1]') + obj_phone = CleanText('//td[text()="Téléphone portable"]/following::td[1]//td[1]') + obj_country = CleanText('//td[text()="Pays"]/following::td[1]') + obj_socioprofessional_category = CleanText('//td[text()="Situation professionnelle"]/following::td[1]') + obj_address = Format( + '%s %s %s', + CleanText('//td[text()="Adresse"]/following::td[1]'), + CleanText('//td[text()="Code postal"]/following::td[1]'), + CleanText('//td[text()="Ville"]/following::td[1]') + )