From 11b3669ab8dd3e0d6961bb61f6872322a21bb3dd Mon Sep 17 00:00:00 2001 From: Guillaume Risbourg Date: Wed, 4 Mar 2020 10:58:19 +0100 Subject: [PATCH] [boobank] Support DecoupledValidation for recipients and transfers The existing code had support for DecoupledValidation only for recipients. This allows to suppport DecoupledValidation for transfers as well. --- weboob/applications/boobank/boobank.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/weboob/applications/boobank/boobank.py b/weboob/applications/boobank/boobank.py index a16f7b424b..3f1881d400 100644 --- a/weboob/applications/boobank/boobank.py +++ b/weboob/applications/boobank/boobank.py @@ -484,14 +484,21 @@ def bcall_error_handler(self, backend, error, backtrace): except CallErrors as e: self.bcall_errors_handler(e) elif isinstance(error, DecoupledValidation): - # XXX for now, assume we are in a add_recipient process. - print(error.message) - params = {'backends': backend, - 'resume': True - } + if isinstance(error.resource, Recipient): + func_name = 'add_recipient' + elif isinstance(error.resource, Transfer): + func_name = 'transfer' + else: + print(u'Error(%s): The resource should be of type Recipient or Transfer, not "%s"' % (backend.name, type(error.resource)), file=self.stderr) + return False + print(error.message) + params = { + 'backends': backend, + 'resume': True, + } try: - next(iter(self.do('add_recipient', error.resource, **params))) + next(iter(self.do(func_name, error.resource, **params))) except CallErrors as e: self.bcall_errors_handler(e) elif isinstance(error, TransferInvalidAmount): -- GitLab