Commit 41892a11 authored by Maxime Gasselin's avatar Maxime Gasselin Committed by Romain Bignon

[cragr] Skip recipients without label

Closes: 16623@sibi
parent 6661ec3b
...@@ -1211,15 +1211,19 @@ class TransferInit(MyLoggedPage, BasePage): ...@@ -1211,15 +1211,19 @@ class TransferInit(MyLoggedPage, BasePage):
yield rcpt yield rcpt
break break
elif opt.attrib['value'].startswith('E'): elif opt.attrib['value'].startswith('E'):
rcpt = Recipient() if len(lines) > 1:
rcpt._index = opt.attrib['value'] # In some cases we observed beneficiaries without label, we skip them
rcpt._raw_label = ' '.join(lines) rcpt = Recipient()
rcpt.category = 'Externe' rcpt._index = opt.attrib['value']
rcpt.label = lines[0] rcpt._raw_label = ' '.join(lines)
rcpt.iban = lines[1].upper() rcpt.category = 'Externe'
rcpt.id = rcpt.iban rcpt.label = lines[0]
rcpt.enabled_at = datetime.now().replace(microsecond=0) rcpt.iban = lines[1].upper()
yield rcpt rcpt.id = rcpt.iban
rcpt.enabled_at = datetime.now().replace(microsecond=0)
yield rcpt
else:
self.logger.warning('The recipient associated with the iban %s has got no label' % lines[0])
def submit_accounts(self, account_id, recipient_id, amount, currency): def submit_accounts(self, account_id, recipient_id, amount, currency):
emitters = [rcpt for rcpt in self.iter_emitters() if rcpt.id == account_id and not rcpt.iban] emitters = [rcpt for rcpt in self.iter_emitters() if rcpt.id == account_id and not rcpt.iban]
......
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