Mock Bank API Specification
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.
Authentication
To authenticate with the Mock Bank API, follow these steps:
Call the POST /api/v3/wealth_api/bank_connections/authenticate endpoint with the username and password.
If the authentication is successful, a challenge will be required.
Call the POST /api/v3/wealth_api/bank_connections/confirm_challenge_response endpoint with the bank authentication process ID and challenge response value.
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".
Bank Connection
To create a bank connection using the Mock Bank API, follow these steps:
Authenticate with the POST /api/v3/wealth_api/bank_connections/authenticate endpoint.
Confirm the challenge response with the POST /api/v3/wealth_api/bank_connections/confirm_challenge_response endpoint.
Call the POST /api/v3/wealth_api/bank_connections endpoint with the required parameters.
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 in the Banks API and has the flag is_mock_bank: boolean. The banks controller endpoint has a filter
Add Comment