Package Exports
- @pollex/revolut
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@pollex/revolut) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Revolut Business API
A Node.JS module by Pollex
Revolut introduced it's V1.0 API late last year for the business users. This allows users to read payments, transactions, counter-parties and perform similar actions as well.
What?
This module provides an interface to the Revolut Business API, which can be used in a Node.JS application or even a client-side browser.
Why?
Pollex' project RevIO provides a link between the free accounting software Manager.IO and your Revolut Business account. However for this project this interface was a requirement, therefore it was decided that this interface will be developed as a separate module, as I am sure that there are more amazing projects with Revolut Business waiting to be developed.
Installing
This module is available in the NPM repository, just execute the below command to install it!
$ npm i @pollex/revolutor
$ yarn add @pollex/revolutUsing
(TODO: This section needs more work)
This module works with entities. Every resource is a subclass of RevolutEntity. Then there is a RevolutBroker, this broker provides the communication from the entities to the actual Revolut API. The broker also holds your API key.
The broker
The broker provides communication from your entities to the API. To setup this broker all you need is your API key.
const { RevolutBroker } = require('@pollex/revolut');
const broker = new RevolutBroker('your-key-here');The broker constructor also support an optional boolean debug. With debug mode all your interaction will be through the Revolut API sandbox. Make sure to use this while testing!
new RevolutBroker('your-key-here', true);Entities
Every entity is extended from the RevolutEntity class. This class provides the base for all entities.
Don't worry you probably don't have to use this class directly, instead you'll be using one of the already implemented entities:
If you had a peek in the src/entities/ folder, you'll notice that there are more entities. These entities are not supposed to be interacted with directly.
Entity fetching example
Because all entities extend from the RevolutEntity, they are easy and similar in usage. Let's retrieve all our accounts.
// Import the RevolutBroker and the Account entity
const { RevolutBroker, Account } = require('@pollex/revolut');
// Instantiate the RevolutBroker with our API Key
// and we want to use the sandbox API.
const broker = new RevolutBroker(process.env.API_KEY, true);
// Retrieve all accounts
Account.GetAll(broker)
.then(accounts => {
console.log(accounts)
});note: The library uses the async and await keywords.
Entity creating example
The library does not yet support entity creation or updating, neither does it support transaction creation.
However, the library is in active development these features are soon to come.
License
This project is licensed under AGPL-V3.0.