From 6d11eb5df683159211273fc979cb655a74b82e2c Mon Sep 17 00:00:00 2001 From: Sylvie Ye Date: Fri, 5 Jun 2020 16:19:11 +0200 Subject: [PATCH] [hellobank] PSD2 account id are different from scraped account id * Avoid account_id check on transfer * Search the account by iban in iter_transfer_recipient to get the right account_id --- modules/hellobank/module.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/hellobank/module.py b/modules/hellobank/module.py index 4b9df18c08..afe9db5017 100644 --- a/modules/hellobank/module.py +++ b/modules/hellobank/module.py @@ -96,7 +96,13 @@ def iter_investment(self, account): def iter_transfer_recipients(self, origin_account): if isinstance(origin_account, Account): - origin_account = origin_account.id + emitter_account = find_object(self.iter_accounts(), id=origin_account.id) + if not emitter_account: + # account_id is different in PSD2 case + # search for the account with iban first to get the account_id + assert origin_account.iban, 'Cannot do iter_transfer_recipient, the origin account was not found' + emitter_account = find_object(self.iter_accounts(), iban=origin_account.iban, error=AccountNotFound) + origin_account = emitter_account.id return self.browser.iter_recipients(origin_account) def new_recipient(self, recipient, **params): @@ -138,6 +144,10 @@ def transfer_check_recipient_id(self, old, new): # iternal recipients id return old == new + def transfer_check_account_id(self, old, new): + # don't check account id because in PSD2 case, account_id is different + return True + def iter_transfers(self, account=None): return self.browser.iter_transfers(account) -- GitLab