Commit a0f325d6 authored by Florent Viard's avatar Florent Viard Committed by Vincent A

[boursorama] Fixes new_recipient when called by the backend from a bank openapi account

parent 80b13e34
......@@ -45,7 +45,7 @@ from import (
from weboob.capabilities.base import NotLoaded, empty, find_object, strict_find_object
from import Advisor
from import Value
from import basestring, urlsplit
from import urlsplit
from import sorted_transactions
from import sorted_transfers
......@@ -703,6 +703,10 @@ class BoursoramaBrowser(RetryLoginBrowser, TwoFactorBrowser):
raise TransferInvalidEmitter('The account cannot emit transfers')
recipients = [rcpt for rcpt in recipients if == transfer.recipient_id]
if len(recipients) == 0 and not empty(transfer.recipient_iban):
# try to find recipients by iban:
recipients = [rcpt for rcpt in recipients
if not empty(rcpt.iban) and rcpt.iban == transfer.recipient_iban]
if len(recipients) == 0:
raise TransferInvalidRecipient('The recipient cannot be used with the emitter account')
assert len(recipients) == 1
......@@ -802,6 +806,10 @@ class BoursoramaBrowser(RetryLoginBrowser, TwoFactorBrowser):
elif == recipient.origin_account_id:
elif (not empty(recipient.origin_account_iban)
and not empty(account.iban)
and account.iban == recipient.origin_account_iban):
raise AddRecipientBankError(message="Compte ne permettant pas l'ajout de bénéficiaires")
......@@ -895,7 +903,11 @@ class BoursoramaBrowser(RetryLoginBrowser, TwoFactorBrowser):
# here we just want to return the right Recipient object.
# We are taking it from the recipient list page
# because there is no summary of the adding
self.go_recipients_list(account_url, recipient.origin_account_id)
account = self.get_account(recipient.origin_account_id, recipient.origin_account_iban)
if not account:
raise AccountNotFound()
return find_object(, iban=recipient.iban, error=RecipientNotFound)
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