A simple connector using NestJS framework to connect your service to Tink.
Nest framework TypeScript starter repository for Algoan connectors.
- Algoan helps companies to build the best open banking experience for credits. To see our products, please refer to our official website
- Tink is a swedish banking data aggregator for financial services.
A connector is a web software able to connect a provider to Algoan's API. It subscribes to REST Hooks which lets Algoan notifying the connector when a specific event happens.
The nestjs-tink-connector
focuses on a user bank accounts and transactions. The main goal of this connector is to be able to retrieve a user bank data when Algoan wishes to.
This section describes the process required for each subscription for an aggregator connector.
The Tink user needs to be redirected to an external page.
- The client should have this configuration data in the service account:
{
"clientId": string;
"clientSecret": string;
"pricing": "STANDARD" | "PREMIUM";
"market": string; // Example: "FR"
"locale": string; // Example: "fr_FR"
}
- And the event should contains the customerId:
{
customerId: string;
}
The diagram below describes interactions:
Refers to the aggregator_link_required
event.
When the user has finished the aggregation process, the connector has to retrieve user's banks accounts and transactions.
- The event should contains those informations:
{
customerId: string;
analysisId: string; // The ananlysis id to update with account and transaction data
temporaryCode: string; // The authorization code returned by Tink, in the callback url param named `code`
}
The diagram below describes interactions:
Refers to the bank_details_required
event.
config/
: stores all configurations for the application. It uses node-config-ts to generate a type definition of thedefault.json
file.src/config/
: Simple NestJs module to inject configuration in servicessrc/algoan/
: Algoan module getting your service accounts. It uses the @algoan/rest library.src/tink/
: Tink module to manage Tink API.src/hooks/
: Entry point for your RestHook called by Algoan. It handles events you've subscribed to.test/
: contains e2e tests.
We would love to have your contribution, thank you for that! 🎉
If you want to add missing APIs, or correct an issue, you will have to follow this list of instructions.
- Set up your local environment by forking the repository.
- When you are about to commit, commitlint is running to check if your commit message respects conventional commit.
- Write tests, there is a high coverage on the repository. Simply run
npm run test:cov
to generate acoverage/
directory. - Respect coding style. Run
npm run lint
to check if there are errors. - Open a Pull Request where you describe the feature/issue you are about to publish.
This project uses ESLint to analyze the TypeScript code. Commit are linted too thanks to commitlint and the conventional commit format.
How to use locally the connector
This connector is a Node.js application. Before reading further, you need to download and install Node.js.
Clone the repository:
$ git clone https://github.com/algoan/nestjs-tink-connector.git --depth=1
Install all dependencies running:
$ npm install
To test locally the Tink Link process, a simple index.html
file is rendered. To use it:
Before testing
- The client config:
locale
,market
,pricing
should be updated inservice-accounts.config
in `./json-server/db.json'. - You can enable http log
config/default.json
withenableHttpRequestLog
,enableHttpResponseLog
,enableHttpErrorLog
Run Test
- Run
npm run start:dev
. It will render an index.html file. Algoan APIs are exposed and mocked by a json-server. - Go to your favorite browser and navigate to http://localhost:4000. It should display a web page:
- With the two provided buttons, you are able to test the two available Tink processes:
- Redirect: Click on the button "Redirect to Tink Link". It will call a
GET /redirect
API which simulates a webhook call to your connector and tries to fetch a redirect URL. At the end of the Tink Link process, aGET /callback?code=...
will be called. It will simulated thebank_reader_details
webhook event to the connector. - Embedded: Click on the button "Open embedded Tink Link". It will call a
GET /iframe
API which simulates a webhook call to your connector, tries to fetch an iframe URL and display an iframe with this URL. At the end of the Tink Link process, aGET /callback?code=...
will be called. It will simulated thebank_reader_details
webhook event to the connector. Moreover, the iframe is remove from the interface.
- Redirect: Click on the button "Redirect to Tink Link". It will call a
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
If you need credentials for your service, please contact support@algoan.com.