Commit 11b3669a authored by Guillaume Risbourg's avatar Guillaume Risbourg Committed by Vincent A

[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.
parent 8be4a4ab
...@@ -484,14 +484,21 @@ class Boobank(CaptchaMixin, ReplApplication): ...@@ -484,14 +484,21 @@ class Boobank(CaptchaMixin, ReplApplication):
except CallErrors as e: except CallErrors as e:
self.bcall_errors_handler(e) self.bcall_errors_handler(e)
elif isinstance(error, DecoupledValidation): elif isinstance(error, DecoupledValidation):
# XXX for now, assume we are in a add_recipient process. if isinstance(error.resource, Recipient):
print(error.message) func_name = 'add_recipient'
params = {'backends': backend, elif isinstance(error.resource, Transfer):
'resume': True 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: try:
next(iter(self.do('add_recipient', error.resource, **params))) next(iter(self.do(func_name, error.resource, **params)))
except CallErrors as e: except CallErrors as e:
self.bcall_errors_handler(e) self.bcall_errors_handler(e)
elif isinstance(error, TransferInvalidAmount): elif isinstance(error, TransferInvalidAmount):
......
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