About
This article explains how the app handles accounts which are connected to multiple interfaces. It's important in this case to not update the account twice in a row using multiple interfaces.
General implementation note
Both import and update flows contain two steps: 1 - downloading accounts and 2 - downloading balances&transactions for accounts. All the logic about capabilities is done after the first step, BUT before the second step. So, after the first step the app initializes/fixes capabilities of accounts. And then the second step is only applied to accounts which have DATA_DOWNLOAD
capability connected to the currently used interface.
Import a bank connection
Nothing special: once an account is created, the app always adds a DATA_DOWNLOAD
capability to the interface used for the import.
Update a bank connection
When the account is stored/updated in the database, the app checks for each account if it has any other interfaces. And then the logic depends on which interface is used for the update.
Update a bank connection using XS2A
The app adds a DATA_DOWNLOAD
capability to all accounts taken from the XS2A interface. If any account has any other interface - the app delete DATA_DOWNLOAD
for those interfaces. XS2A has the highest priority.
Update a bank connection using FINTS_SERVER
The app checks for every account taken from the interface if it has any other interface:
if it has XS2A with
DATA_DOWNLOAD
capability - the app doesn't addDATA_DOWNLOAD
capability, otherwise the capability is added (FINTS_SERVER has middle priority).if it has WEB_SCRAPER - the app removes
DATA_DOWNLOAD
capability for WEB_SCRAPER interface.
Update a bank connection using WEB_SCRAPER
The app checks for every account taken from the interface if it has any other interface:
if it has XS2A or FINTS_SERVER with
DATA_DOWNLOAD
the app doesn't add
DATA_DOWNLOAD
capability, otherwise the capability is added (WEB_SCRAPER has the lowest priority).
Connect a new interface
Connect a new XS2A interface
The app downloads all accounts from XS2A interface and matches them to the existing ones. All downloaded accounts have DATA_DOWNLOAD
capability. Also, the app checks if any of matched accounts (means there were already imported through another interface) have any other interface connected and removes DATA_DOWNLOAD
capability from those interfaces.
Connect a new FINTS_SERVER interface
The app downloads all accounts from FINTS_SERVER interface and matches them to the existing ones. And then the app applies the following logic:
if an account is a new one (there is no other connected interfaces so far) - the app adds
DATA_DOWNLOAD
capability to this account.if an account is an existing one (there are already other interfaces connected) - the app checks:
if the account has XS2A interface with
DATA_DOWNLOAD
capability - if yes, FINTS_SERVER interface doesn't getDATA_DOWNLOAD
capability, otherwise it does get it.if the account has WEB_SCRAPER interface with
DATA_DOWNLOAD
capability - if yes, the app remove this capability from the WEB_SCRAPER interface
Connect a new WEB_SCRAPER interface
The app downloads all accounts from WEB_SCRAPER interface and matches them to the existing ones. And then the app applies the following logic:
if an account is a new one (there is no other connected interfaces so far) - the app adds
DATA_DOWNLOAD
capability to this account.if an account is an existing one (there are already other interfaces connected) - the app checks: if the account has XS2A OR FINTS_SERVER interface with
DATA_DOWNLOAD
capability - if yes, WEB_SCRAPER interface doesn't getDATA_DOWNLOAD
capability, otherwise it does get it.