Financial Data

The Application API provides information about your app and its associated users.

Authorization

Create an authorization url in order for your users to give consent on accessing their account data.

final AccountsApi accountsApi = new AccountsApi();
AccountAuthorisationRequest accountAuthorisationRequest = new AccountAuthorisationRequest();
accountAuthorisationRequest.setApplicationUserId(applicationUserId);
accountAuthorisationRequest.setInstitutionId(institutionId);
/**
* Use the defaults
*/
accountAuthorisationRequest.setAccountRequest(new AccountRequest());
ApiResponseOfAuthorisationRequestResponse authorizationResponse = accountsApi.initiateAccountRequestUsingPOST(accountAuthorisationRequest, null, null, null);
String redirectUrl = authorizationResponse.getData().getAuthorisationUrl();

Redirect

Once you've retrieved the redirectUrl for the user's institution, you should redirect the user to the banks page where they will be asked to consent to give you authorization to their account data.

Financial Data

After obtaining Authorization from your user to access their account data, you can get retrieve a list of accounts:

String consentToken = consent.getConsentToken();
ApiListResponseOfAccount accountsResponse = accountsApi.getAccountsUsingGET(consentToken);
List<Account> accounts = accountsResponse.getData();

Get a list of transactions:

String consentToken = consent.getConsentToken();
ApiListResponseOfTransaction transactionsResponse = transactionsApi.getTransactionsUsingGET(
                                        consentToken, 
                                        accountId, 
                                        Collections.emptyList(),
                                        "1980-01-01T00:00:00.000Z",
                                        "2020-01-01T00:00:00.000Z",
                                        10,
                                        null,
                                        0,
                                        null);
List<Transaction> transactions = transactionsResponse.getData();

Check the identity:

Institution institution = institutionsApi.getInstitutionUsingGET(institutionId);
Boolean supportsIdentity = institution.getFeatures().stream()
        .anyMatch(featuresEnum -> featuresEnum != null && featuresEnum.equals(Institution.FeaturesEnum.IDENTITY));

Consents

Get the most resent Consent for the configured user and institution. Make sure to check that the Consent is AUTHORIZED otherwise fail the request

Consent consent = consentsApi.getConsentsUsingGET(
        Collections.singletonList(applicationUserId),
        Collections.emptyList(),
        Collections.singletonList(institutionId),
        Collections.emptyList(),
        null,
        null,
        1,
        null).getData().stream()
        .filter(c -> c.getStatus().equals(Consent.StatusEnum.AUTHORIZED))
        .findFirst()
        .orElseThrow(() -> new RuntimeException(String.format("No valid consent token present for application user %s", applicationUserId)));