You have just found the Node-flavored client of Fintoc. It mainly consists of a port (more of a carbon copy, really) of fintoc-python.
You can think of Fintoc API as a piscola.
And the key ingredient to a properly made piscola are the ice cubes.
Sure, you can still have a piscola without ice cubes.
But hey… that’s not enjoyable -- why would you do that?
Do yourself a favor: go grab some ice cubes by installing this refreshing library.
Install it with your favorite dependency manager.
# Using npm
npm add fintoc
# Using yarn
yarn add fintoc
- Get your API key and link your bank account using the Fintoc dashboard.
- Open your command-line interface.
- Write a few lines of JavaScript to see your bank movements.
const Fintoc = require('fintoc');
const client = new Fintoc('api_key');
client.getLink('link_token')
.then((link) => link.find({ type_: 'checking_account' }))
.then((account) => account.getMovements({ since: '2020-01-01' }))
.then(console.log)
.catch(console.log);
And that’s it!
This client supports all Fintoc API endpoints. For complete information about the API, head to the docs.
const Fintoc = require('fintoc');
const client = new Fintoc('api_key');
client.getLink('link_token')
.then((link) => {
link.accounts.forEach((account) => {
console.log(account);
});
})
.catch(console.log);
// Or... you can pretty print all the accounts in a Link
client.getLink('link_token')
.then((link) => link.showAccounts())
.catch(console.log);
If you want to find a specific account in a link, you can use find. You can search by any account field:
const Fintoc = require('fintoc');
const client = new Fintoc('api_key');
client.getLink('link_token')
.then((link) => link.find({ type_: 'checking_account' }))
.then(console.log)
.catch(console.log);
client.getLink('link_token')
.then((link) => link.find({ number: '1111111' }))
.then(console.log)
.catch(console.log);
client.getLink('link_token')
.then((link) => link.find({ id_: 'sdfsdf234' }))
.then(console.log)
.catch(console.log);
You can also search for multiple accounts matching a specific criteria with findAll:
const Fintoc = require('fintoc');
const client = new Fintoc('api_key');
client.getLink('link_token')
.then((link) => link.findAll({ currency: 'CLP' }))
.then(console.log)
.catch(console.log);
To update the account balance you can use updateBalance:
const Fintoc = require('fintoc');
const client = new Fintoc('api_key');
client.getLink('link_token')
.then((link) => link.find({ type_: 'checking_account' }))
.then((account) => account.updateBalance())
.catch(console.log);
const Fintoc = require('fintoc');
const client = new Fintoc('api_key');
// You can get the account movements since a specific Date
client.getLink('link_token')
.then((link) => link.find({ type_: 'checking_account' }))
.then((account) => {
const yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
return account.getMovements({ since: yesterday });
})
.then(console.log)
.catch(console.log);
// Or... you can use an ISO 8601 formatted string representation of the Date
client.getLink('link_token')
.then((link) => link.find({ type_: 'checking_account' }))
.then((account) => account.getMovements({ since: '2020-01-01' }))
.then(console.log)
.catch(console.log);
Calling getMovements without arguments gets the last 30 movements of the account.
This project relies on the following packages:
You can run all the tests just by running:
# Using npm
npm run test
# Using yarn
yarn test
- Document the library more thoroughly
- Add way more unit tests
This library was initially written by @daleal as a port (carbon copy) of @nebil’s fintoc-python, so compliments for design choices should somehow get to the designer of the original library.