Commit 095d2a2b authored by Martin Sicot's avatar Martin Sicot Committed by Romain Bignon

[societegenerale] ActionNeeded added for first time

When accessing sogecash for the first time, a form must be filled. Hence
the action needed.
parent d907d5d9
......@@ -25,7 +25,7 @@ from datetime import date
from weboob.browser.browsers import LoginBrowser, need_login, StatesMixin
from weboob.browser.url import URL
from weboob.browser.exceptions import ClientError
from weboob.exceptions import BrowserIncorrectPassword
from weboob.exceptions import BrowserIncorrectPassword, ActionNeeded
from weboob.capabilities.base import find_object
from weboob.capabilities.bank import (
AccountNotFound, RecipientNotFound, AddRecipientStep, AddRecipientBankError,
......@@ -35,7 +35,7 @@ from weboob.tools.value import Value
from .pages import (
LoginPage, CardsPage, CardHistoryPage, IncorrectLoginPage,
ProfileProPage, ProfileEntPage, ChangePassPage, SubscriptionPage,
ProfileProPage, ProfileEntPage, ChangePassPage, SubscriptionPage, InscriptionPage,
ErrorPage,
)
from .json_pages import AccountsJsonPage, BalancesJsonPage, HistoryJsonPage, BankStatementPage
......@@ -59,6 +59,7 @@ class SGPEBrowser(LoginBrowser):
'/gae/afficherInscriptionUtilisateur.html',
'/gae/afficherChangementCodeSecretExpire.html',
ChangePassPage)
inscription_page = URL('/icd-web/gax/gax-inscription.html', InscriptionPage)
def check_logged_status(self):
if not self.page or self.login.is_here():
......@@ -82,6 +83,9 @@ class SGPEBrowser(LoginBrowser):
except ClientError:
raise BrowserIncorrectPassword()
if self.inscription_page.is_here():
raise ActionNeeded(self.page.get_error())
# force page change
if not self.accounts.is_here():
self.go_accounts()
......
......@@ -259,3 +259,9 @@ class ErrorPage(SGPEPage):
if self.doc.xpath('//div[@class="ngo_mu_message" and contains(text(), "momentanément indisponible")]'):
# Warning: it could occurs because of wrongpass, user have to change password
raise BrowserUnavailable(CleanText('//div[@class="ngo_mu_message"]')(self.doc))
class InscriptionPage(SGPEPage):
def get_error(self):
message = CleanText('//head/title')(self.doc)
return message
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