wealthAPI Mock Bank

Mock Bank API Specification

Background: The mock bank let’s you test the import workflow by using bank slug MockBank. It does however not create any data.

Introduction

The Mock Bank API provides simulations of some bank-communications issues for development and testing purposes. This specification document outlines the API endpoints, authentication process, bank connection process, error handling, and other important information that developers need to interact with the Mock Bank API.

Endpoints

The following endpoints are provided by the Mock Bank API:

POST /api/v3/wealth_api/bank_connections/authenticate

Endpoint for bank authentication process. This endpoint returns different statuses based on the provided password.

POST /api/v3/wealth_api/bank_connections/confirm_challenge_response

Endpoint for confirming the challenge response during bank authentication. This endpoint takes a bank authentication process ID as input and returns different statuses based on the challenge response value.

POST /api/v3/wealth_api/bank_connections

Endpoint for creating a bank connection. This endpoint creates a bank connection record in the DB and returns its ID. It also creates a Sidekiq task to update the bank connections import progress.

GET /api/v3/wealth_api/bank_connections/{id}

Endpoint for getting the import status of a bank connection. This endpoint takes a bank connection ID as input and returns information about the connection status and import progress.

Authentication

To authenticate with the Mock Bank API, follow these steps:

  1. Call the POST /api/v3/wealth_api/bank_connections/authenticate endpoint with the username and password.

  2. If the authentication is successful, a challenge will be required.

  3. Call the POST /api/v3/wealth_api/bank_connections/confirm_challenge_response endpoint with the bank authentication process ID and challenge response value.

  4. If the challenge response is successful, the bank connection can be imported using the POST /api/v3/wealth_api/bank_connections endpoint.

The following are the different statuses that can be returned during authentication:

  • AUTHENTICATED: Successful authentication with the username "tester" and password "success".

  • AUTHENTICATION_FAILED: Failed authentication with the username "tester" and any password not defined in the other use cases.

  • CHALLENGE_RESPONSE_REQUIRED: Successful authentication with challenge required for username "tester" and password "challengeRequired".

  • DECOUPLED_AUTH_REQUIRED: Successful authentication with decoupled auth required for username "tester" and password "decoupledAuthRequired".

  • REDIRECT_REQUIRED: Successful authentication with decoupled auth required for username "tester" and password "redirectRequired".

  • AUTHENTICATED: Successful authentication that will trigger a bank connection import error for "tester" and password "bankConnectionError".

 

Resolving DECOUPLED_AUTH_REQUIRED status

You can provide additional password for resolving DECOUPLED_AUTH_REQUIRED status

  • decoupledAuthRequiredSuccess will resolve in AUTHENTICATED status in 2 seconds

  • decoupledAuthRequiredError will resolve in AUTHENTICATION_FAILED status in 2 seconds

Bank Connection

To create a bank connection using the Mock Bank API, follow these steps:

  1. Authenticate with the POST /api/v3/wealth_api/bank_connections/authenticate endpoint.

  2. Confirm the challenge response with the POST /api/v3/wealth_api/bank_connections/confirm_challenge_response endpoint.

  3. Call the POST /api/v3/wealth_api/bank_connections endpoint with the required parameters.

  4. The endpoint will create a bank connection record in the DB and return its ID. It will also create a Sidekiq task to update the bank connections import progress.

The following are the different statuses that can be returned during the bank connection process:

  • IN_PROGRESS: The bank connection is being processed.

  • SUCCESS: The bank connection process was successful.

  • FAILED_WITH_ERROR: The bank connection process failed due to an error.

Error Handling

The following are the error cases that can occur when using the Mock Bank API:

  • Login failed: Failed authentication with the username "tester" and any password not defined in the other use cases.

  • Challenge response failed: The challenge response value is not valid.

  • Import failed: The bank connection process failed due to an error.

Mock Bank Entity

The Mock Bank entity is part of the Banks API and has the flag is_mock_bank: boolean. The banks controller endpoint has a filter on mock banks, with the default setting being to filter them out. This allows developers to easily distinguish between real and mock banks when interacting with the API.

Conclusion

This specification document outlines the various endpoints, authentication process, bank connection process, error handling, and other important information for developers to interact with the Mock Bank API. By following these guidelines, developers can easily integrate the Mock Bank API into their applications for development and testing purposes.

Â