Commit 600873bf authored by Jerome Berthier's avatar Jerome Berthier Committed by Romain Bignon

[cmes] Handle some ActionNeeded

The website may ask for email and phone confirmation.
Email confirmation can be skipped, unfortunately not the phone confirmation.
parent 66e3b9dc
......@@ -18,19 +18,20 @@
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
from weboob.exceptions import BrowserIncorrectPassword
from weboob.exceptions import BrowserIncorrectPassword
from weboob.browser import LoginBrowser, URL, need_login
from .pages import (
LoginPage, NewWebsitePage, AccountsPage, FCPEInvestmentPage,
CCBInvestmentPage, HistoryPage, CustomPage,
)
CCBInvestmentPage, HistoryPage, CustomPage, ActionNeededPage,
)
class CmesBrowser(LoginBrowser):
BASEURL = 'https://www.cic-epargnesalariale.fr'
login = URL('/espace-client/fr/identification/authentification.html', LoginPage)
action_needed = URL('/espace-client/fr/epargnants/premiers-pas/saisir-vos-coordonnees/saisir-adresse-e-mail.html', ActionNeededPage)
accounts = URL('(?P<subsite>.*)fr/espace/devbavoirs.aspx\?mode=net&menu=cpte$', AccountsPage)
new_website = URL('(?P<subsite>.*)espace-client/fr/epargnants/tableau-de-bord/index.html', NewWebsitePage)
fcpe_investment = URL(r'/fr/.*GoPositionsParFond.*',
......
......@@ -21,7 +21,7 @@
from weboob.browser import URL, need_login
from ..browser import CmesBrowser
from .pages import (
NewAccountsPage, OperationsListPage, OperationPage
NewAccountsPage, OperationsListPage, OperationPage,
)
......
......@@ -24,7 +24,7 @@ import re
from weboob.browser.pages import HTMLPage, LoggedPage
from weboob.browser.elements import ListElement, ItemElement, method
from weboob.browser.filters.standard import (
CleanText, Date, Regexp, Field, Currency, Upper, MapIn, Eval
CleanText, Date, Regexp, Field, Currency, Upper, MapIn, Eval,
)
from weboob.capabilities.bank import Account, Investment, Pocket
......
......@@ -26,7 +26,7 @@ from weboob.browser.elements import ListElement, ItemElement, method, TableEleme
from weboob.browser.filters.standard import (
CleanText, Upper, Date, Regexp, Field,
CleanDecimal, Env, Async, AsyncLoad, Currency,
)
)
from weboob.browser.filters.html import Link, TableCell, Attr
from weboob.browser.switch import SiteSwitch
from weboob.capabilities.bank import Account, Investment, Pocket
......@@ -53,6 +53,23 @@ class NewWebsitePage(HTMLPage, LoggedPage):
raise SiteSwitch('cmes_new')
class ActionNeededPage(HTMLPage, LoggedPage):
def on_load(self):
# Need to update mail. Try to skip
msg = "Merci de renseigner votre adresse e-mail"
if CleanText('//p[@role="heading" and contains(text(), "%s")]' % msg)(self.doc):
url = Link('//a[contains(., "PASSER CETTE ETAPE")]')(self.doc)
if url:
self.browser.location(url)
else:
raise ActionNeeded(msg)
# Mobile phone update can not be skipped
msg = "Merci de renseigner votre numéro de téléphone mobile"
if CleanText('//p[@role="heading" and contains(text(), "%s")]' % msg)(self.doc):
raise ActionNeeded(msg)
class AccountsPage(LoggedPage, HTMLPage):
def on_load(self):
if self.doc.xpath('//label[contains(@for, "AcceptCGU")]'):
......
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