Commit b20d2d81 authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Romain Bignon

[binck] Corrected module to work for all users

During login, some connections end up on a 404 error when reaching the
accounts page, so we must hceck what URLs are available on the HomePage
before going anywhere.

Once we know that it is a unique account connection and that we handle
the right accounts URL, the rest of the website is the same.

Closes: 10843@zendesk, 10844@zendesk, 11067@zendesk, 11068@zendesk,
11190@zendesk, 11176@zendesk, 11207@zendesk
parent 958e8f78
......@@ -36,13 +36,14 @@ from .pages import (
class BinckBrowser(LoginBrowser):
''' Delete this attribute when old website is obsolete '''
old_website_connection = False
unique_account = False
login = URL(r'/Logon', LoginPage)
view = URL('/PersonIntroduction/Index', ViewPage)
logon_flow = URL(r'/AmlQuestionnairesOverview/LogonFlow$', LogonFlowPage)
account = URL(r'/PortfolioOverview/Index', AccountsPage)
accounts = URL(r'/PersonAccountOverview/Index', AccountsPage)
old_accounts = URL(r'/AccountsOverview/Index', OldAccountsPage)
......@@ -63,7 +64,7 @@ class BinckBrowser(LoginBrowser):
def deinit(self):
if and
super(BinckBrowser, self).deinit()
def do_login(self):
......@@ -93,10 +94,13 @@ class BinckBrowser(LoginBrowser):
def iter_accounts(self):
if self.unique_account:
for a in
''' Delete these attributes when old website is obsolete '''
a._invpage = None
a._histpages = None
......@@ -116,7 +120,6 @@ class BinckBrowser(LoginBrowser):
# Some Binck connections don't have any accounts on the new AccountsPage,
# so we need to fetch them on the OldAccountsPage for now:
''' Delete this part when old website is obsolete '''
self.old_website_connection = True
for a in
......@@ -162,7 +165,6 @@ class BinckBrowser(LoginBrowser):
if account._liquidity:
yield create_french_liquidity(account._liquidity)
''' Delete this part when old website is obsolete '''
if self.old_website_connection:
if account._invpage:
......@@ -189,7 +191,6 @@ class BinckBrowser(LoginBrowser):
def iter_history(self, account):
''' Delete this part when old website is obsolete '''
if self.old_website_connection:
if account._histpages:
for page in account._histpages:
......@@ -58,11 +58,15 @@ class ViewPage(LoggedPage, HTMLPage):
class HomePage(LoggedPage, HTMLPage):
# We directly go from the home page to the accounts page
def on_load(self):
''' Remove the old_website_connection part when old website is obsolete '''
if self.browser.old_website_connection:
accounts_url = ''
elif self.doc.xpath('//a[text()="Mes comptes Binck"]'):
accounts_url = ''
elif self.doc.xpath('//a[span[text()="Portefeuille"]][@role="button"]'):
self.browser.unique_account = True
accounts_url = ''
assert accounts_url, 'The accounts URL of this connection is not handled yet!'
class ChangePassPage(LoggedPage, HTMLPage):
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