Commit 1df6056d authored by Jerome Berthier's avatar Jerome Berthier Committed by Romain Bignon

[cmes] backport ActionNeeded handling from the old browser to the new CMES browser

parent 548e7c58
......@@ -21,7 +21,7 @@
from weboob.browser import LoginBrowser, URL, need_login
from weboob.exceptions import BrowserIncorrectPassword
from .pages import (
LoginPage, NewAccountsPage, OperationsListPage, OperationPage,
LoginPage, NewAccountsPage, OperationsListPage, OperationPage, ActionNeededPage,
)
......@@ -30,6 +30,10 @@ class CmesBrowserNew(LoginBrowser):
login = URL('r(?P<client_space>.*)fr/identification/authentification.html', LoginPage)
action_needed = URL('(?P<subsite>.*)(?P<client_space>.*)fr/epargnants/premiers-pas/saisir-vos-coordonnees.*',
'(?P<subsite>.*)(?P<client_space>.*)fr/epargnants/conditions-generales-d-utilisation/index.html',
ActionNeededPage)
accounts = URL(r'(?P<subsite>.*)(?P<client_space>.*)fr/epargnants/mon-epargne/situation-financiere-detaillee/index.html',
r'(?P<subsite>.*)(?P<client_space>.*)fr/epargnants/tableau-de-bord/index.html',
NewAccountsPage)
......
......@@ -25,8 +25,10 @@ from weboob.browser.elements import ListElement, ItemElement, method
from weboob.browser.filters.standard import (
CleanText, CleanDecimal, Date, Regexp, Field, Currency, Upper, MapIn, Eval
)
from weboob.browser.filters.html import Link
from weboob.capabilities.bank import Account, Investment, Pocket, NotAvailable
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from weboob.exceptions import ActionNeeded
class Transaction(FrenchTransaction):
......@@ -50,6 +52,28 @@ class LoginPage(HTMLPage):
form.submit()
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)
# CGU, can not bypass
msg = "Veuillez accepter les conditions générales d'utilisation"
if CleanText('//p[@role="heading" and contains(text(), "%s")]' % msg)(self.doc):
raise ActionNeeded(msg)
ACCOUNTS_TYPES = {
"pargne entreprise": Account.TYPE_PEE,
"pargne retraite": Account.TYPE_PERCO
......
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