Commit 82e593eb authored by Maxime Gasselin's avatar Maxime Gasselin Committed by Romain Bignon

[bp] prevent the history from being reached for checking account with balance = 0

In this case when we reached these pages, the navigation is broken. We
avoid to reach it in the iter account and return no transactions for
history and coming.

Closes: 36493@sibi
parent 126dbca0
......@@ -312,6 +312,10 @@ class BPBrowser(LoginBrowser, StatesMixin):
@need_login
def get_history(self, account):
if account.type == Account.TYPE_CHECKING and account.balance == 0:
# When the balance is 0, we get a website unavailable on the history page
# and the following navigation is broken
return []
# TODO scrap pdf to get history of mandate accounts
if 'gestion-sous-mandat' in account.url:
return []
......@@ -366,8 +370,9 @@ class BPBrowser(LoginBrowser, StatesMixin):
def get_coming(self, account):
if 'gestion-sous-mandat' in account.url:
return []
if account.type == Account.TYPE_CHECKING:
# When the balance is 0, we get a website unavailable on the history page
# and the following navigation is broken
if account.type == Account.TYPE_CHECKING and account.balance != 0:
return self._get_coming_transactions(account)
elif account.type == Account.TYPE_CARD:
transactions = []
......
......@@ -74,7 +74,9 @@ class item_account_generic(ItemElement):
return CleanDecimal('.//span[@class="number"]', replace_dots=True, default=NotAvailable)(self)
def obj_coming(self):
if Field('type')(self) == Account.TYPE_CHECKING:
if Field('type')(self) == Account.TYPE_CHECKING and Field('balance')(self) != 0:
# When the balance is 0, we get a website unavailable on the history page
# and the following navigation is broken
has_coming = False
coming = 0
......
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