bnporc fall back on old website for pro accounts
This commit is contained in:
parent
4477c32e9c
commit
94cb1c4e21
3 changed files with 18 additions and 3 deletions
|
|
@ -66,8 +66,14 @@ class BNPorcModule(Module, CapBank, CapMessages):
|
||||||
def create_default_browser(self):
|
def create_default_browser(self):
|
||||||
b = {'ppold': BNPorc, 'ent': BNPEnterprise, 'ent2': BNPCompany, 'pp': BNPParibasBrowser}
|
b = {'ppold': BNPorc, 'ent': BNPEnterprise, 'ent2': BNPCompany, 'pp': BNPParibasBrowser}
|
||||||
self.BROWSER = b[self.config['website'].get()]
|
self.BROWSER = b[self.config['website'].get()]
|
||||||
return self.create_browser(self.config['login'].get(),
|
try:
|
||||||
self.config['password'].get())
|
return self.create_browser(self.config['login'].get(),
|
||||||
|
self.config['password'].get())
|
||||||
|
except BNPParibasBrowser.ProAccount:
|
||||||
|
self.logger.debug('Switching on old website because this is a pro account.')
|
||||||
|
self.BROWSER = BNPorc
|
||||||
|
return self.create_browser(self.config['login'].get(),
|
||||||
|
self.config['password'].get())
|
||||||
|
|
||||||
def iter_accounts(self):
|
def iter_accounts(self):
|
||||||
for account in self.browser.get_accounts_list():
|
for account in self.browser.get_accounts_list():
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,13 @@ class BNPParibasBrowser(CompatMixin, JsonBrowserMixin, LoginBrowser):
|
||||||
history = URL('rop-wspl/rest/releveOp', HistoryPage)
|
history = URL('rop-wspl/rest/releveOp', HistoryPage)
|
||||||
transfer_init = URL('virement-wspl/rest/initialisationVirement', TransferInitPage)
|
transfer_init = URL('virement-wspl/rest/initialisationVirement', TransferInitPage)
|
||||||
|
|
||||||
|
class ProAccount(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(BNPParibasBrowser, self).__init__(*args, **kwargs)
|
||||||
|
self.do_login()
|
||||||
|
|
||||||
def switch(self, subdomain):
|
def switch(self, subdomain):
|
||||||
self.BASEURL = self.BASEURL_TEMPLATE % subdomain
|
self.BASEURL = self.BASEURL_TEMPLATE % subdomain
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,9 @@ class LoginPage(JsonPage):
|
||||||
# XXX useless ?
|
# XXX useless ?
|
||||||
csrf = self.generate_token()
|
csrf = self.generate_token()
|
||||||
|
|
||||||
self.browser.location(target, data={'AUTH': auth, 'CSRF': csrf})
|
response = self.browser.location(target, data={'AUTH': auth, 'CSRF': csrf})
|
||||||
|
if response.url.startswith('https://pro.mabanque.bnpparibas'):
|
||||||
|
raise self.browser.ProAccount()
|
||||||
|
|
||||||
|
|
||||||
class BNPPage(LoggedPage, JsonPage):
|
class BNPPage(LoggedPage, JsonPage):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue