Commit 2721e516 authored by Fong NGO's avatar Fong NGO Committed by Vincent A

[bp] don't raise BrowserUnavailable when login is successful

The pro website has changed, and an url '.*voscomptes/identification/identification.ea.*'
that was once handled as a temporary unvailability page is now an
expected page of the login process.

I don't know if this url has to be treated the same way or differently for
the par website, so I decided to override the parent attribute in the
subclass BProBrowser.

We can also notice the following requests don't work because the pro website
has changed (a wrong request will typically lead to a deconnection, for
ex. the next_request auth_page() fails this way), but not for all
connections (strange), meaning for some connections, the current
requests work fine. So far I have noticed the current code still works
for connections from users who have already validated the SCA (but I
might have missed something else).
parent a0f325d6
......@@ -62,7 +62,7 @@ from .pages.accounthistory import (
from .pages.accountlist import (
MarketLoginPage, UselessPage, ProfilePage, MarketCheckPage, MarketHomePage,
)
from .pages.pro import RedirectPage, ProAccountsList, ProAccountHistory, DownloadRib, RibPage
from .pages.pro import RedirectPage, ProAccountsList, ProAccountHistory, DownloadRib, RibPage, RedirectAfterVKPage
from .pages.mandate import MandateAccountsList, PreMandate, PreMandateBis, MandateLife, MandateMarket
from .linebourse_browser import LinebourseAPIBrowser
......@@ -1027,6 +1027,15 @@ class BPBrowser(LoginBrowser, StatesMixin):
class BProBrowser(BPBrowser):
login_url = "https://banqueenligne.entreprises.labanquepostale.fr/wsost/OstBrokerWeb/loginform?TAM_OP=login&ERROR_CODE=0x00000000&URL=%2Fws_q47%2Fvoscomptes%2Fidentification%2Fidentification.ea%3Forigin%3Dprofessionnels"
# Landing page after virtual keyboard. The response is a redirection to
# switch_q5c only if an SCA is activated (TODO: check), and just a standard
# page for connections without SCA
redirect_after_vk = URL(
r'.*voscomptes/identification/identification.ea.*',
RedirectAfterVKPage
)
accounts_and_loans_url = None
pro_accounts_list = URL(r'.*voscomptes/synthese/synthese.ea', ProAccountsList)
......@@ -1052,6 +1061,14 @@ class BProBrowser(BPBrowser):
DownloadPage
)
# Redefined from BPBrowser.redirect_page because
# 'voscomptes/identification/identification.ea' is an expected page and
# we shouldn't raise a BrowserUnavailable, at least for pro website
redirect_page = URL(
r'.*voscomptes/synthese/3-synthese.ea',
RedirectPage
)
BASEURL = 'https://banqueenligne.entreprises.labanquepostale.fr'
def set_variables(self):
......
......@@ -157,3 +157,7 @@ class RibPage(LoggedPage, MyHTMLPage):
obj_name = CleanText('//table[@class="datalistecart"]//td[@class="nom"]')
obj_address = CleanText('//table[@class="datalistecart"]//td[@class="adr"]')
class RedirectAfterVKPage(MyHTMLPage):
pass
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