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

[boursorama] Match account iban for transfer to solve issues when openapi account id are provided

parent 6f8e573c
......@@ -42,7 +42,7 @@ from weboob.capabilities.bank import (
AddRecipientTimeout, TransferDateType, Emitter, TransactionType,
AddRecipientBankError,
)
from weboob.capabilities.base import NotLoaded, empty, find_object
from weboob.capabilities.base import NotLoaded, empty, find_object, strict_find_object
from weboob.capabilities.contact import Advisor
from weboob.tools.value import Value
from weboob.tools.compat import basestring, urlsplit
......@@ -436,13 +436,12 @@ class BoursoramaBrowser(RetryLoginBrowser, TwoFactorBrowser):
self.ownership_guesser()
return self.accounts_list
def get_account(self, id):
assert isinstance(id, basestring)
for a in self.get_accounts_list():
if a.id == id:
return a
return None
def get_account(self, account_id=None, account_iban=None):
acc_list = self.get_accounts_list()
account = strict_find_object(acc_list, id=account_id)
if not account:
account = strict_find_object(acc_list, iban=account_iban)
return account
def get_opening_date(self, account_url):
self.location(account_url)
......@@ -695,7 +694,7 @@ class BoursoramaBrowser(RetryLoginBrowser, TwoFactorBrowser):
self.check_basic_transfer(transfer)
account = self.get_account(transfer.account_id)
account = self.get_account(transfer.account_id, transfer.account_iban)
if not account:
raise AccountNotFound()
......
......@@ -123,6 +123,14 @@ class BoursoramaModule(Module, CapBankWealth, CapBankTransferAddRecipient, CapPr
old = old.replace('\ufffd', '?')
return super(BoursoramaModule, self).transfer_check_label(old, new)
def transfer_check_account_id(self, old, new):
# We can't verify here automatically that the account_id has not changed
# as it might have changed early if a stet account id was provided
# instead of the account id that we use here coming from the website.
# And in addition, we don't get the account id from the confirmation page
# to perform such a check anyway.
return True
def iter_currencies(self):
return self.browser.iter_currencies()
......
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