Commit 1b766668 authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Romain Bignon

[milleis] Ignore history for twin accounts that are not in Euros

Milleis offers the possibility to have twin accounts, which are actually
one same account with two different currencies (Euros and another currency).
The iter_accounts works
well but on the website, twin accounts transactions are completely
mixed up, and for now we scrape the exact same history for both accounts so
all twin account transactions are duplicated.
Since the currency of each transaciton is not precised, we cannot
pair transactions to one of the twin accounts.
This patch skips iter_history for twin accounts that are not in euros in
order to avoid transaction duplicates, the transactions will now only be
associated with the Euro twin account.

Closes: 9425@zendesk
parent e04bc24f
......@@ -158,10 +158,23 @@ class Barclays(LoginBrowser):
self.cache['accounts'] = traccounts
# Twin accounts are double accounts with different currencies.
# Transactions for twin accounts are all mixed and the currency
# is not specified, therefore to avoid transaction duplicates,
# we only return transactions from the 'EUR' twin account.
for account in self.cache['accounts']:
if (account.id.replace(account.currency, '') in
[acc.id.replace(acc.currency, '') for acc in self.cache['accounts'] if acc.id != account.id]):
account._twin = True
else:
account._twin = False
return self.cache['accounts']
@need_login
def iter_history(self, account):
if account._twin and account.currency != 'EUR':
return []
if account._multiple_type and not self._multiple_account_choice(account):
return []
elif account.type in (Account.TYPE_LOAN, Account.TYPE_REVOLVING_CREDIT):
......
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