From de6e967ae62c7785c12f27e51f831d2acc4378d0 Mon Sep 17 00:00:00 2001 From: Guillaume Risbourg Date: Fri, 2 Oct 2020 15:43:00 +0200 Subject: [PATCH] [lcl] Add transfer_check_account_iban Some accounts' ibans cannot be found anymore on the website. But since we kept the iban stored on our side, the 'old' transfer.account_iban is not empty when making a transfer. When we do not find the account based on its iban, we search it based on its id. So the account is valid, the iban is just different. This check allows to not have an assertion error when making a transfer from an account in this situation. --- modules/lcl/module.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/lcl/module.py b/modules/lcl/module.py index 4fbad1da98..a3cd2400c0 100644 --- a/modules/lcl/module.py +++ b/modules/lcl/module.py @@ -37,7 +37,9 @@ from weboob.tools.backend import Module, BackendConfig from weboob.tools.capabilities.bank.transactions import sorted_transactions from weboob.tools.value import ValueBackendPassword, Value -from weboob.capabilities.base import find_object, strict_find_object, NotAvailable +from weboob.capabilities.base import ( + find_object, strict_find_object, NotAvailable, empty, +) from .browser import LCLBrowser, LCLProBrowser from .enterprise.browser import LCLEnterpriseBrowser, LCLEspaceProBrowser @@ -173,6 +175,17 @@ def transfer_check_label(self, old, new): return True return super(LCLModule, self).transfer_check_label(old, new) + def transfer_check_account_iban(self, old, new): + # Some accounts' ibans cannot be found anymore on the website. But since we + # kept the iban stored on our side, the 'old' transfer.account_iban is not + # empty when making a transfer. When we do not find the account based on its iban, + # we search it based on its id. So the account is valid, the iban is just empty. + # This check allows to not have an assertion error when making a transfer from + # an account in this situation. + if empty(new): + return True + return old == new + @only_for_websites('par', 'elcl', 'pro') def iter_contacts(self): return self.browser.get_advisor() -- GitLab