npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@pollex/revolut

v0.2.2

Published

An interface to the revolut business API

Downloads

3

Readme

Revolut Business Module

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.

Installing

This module is available in the NPM repository, just execute the below command to install it!

    $ npm i @pollex/revolut

or

    $ yarn add @pollex/revolut

Wiki

This ReadMe contains the basics, head over to the Github Wiki for more information!

Usage

Let's get you up and running quickly. Starting with the most important part of this library, the RevolutBroker. The broker handles the main communication between the API and this library. This is also where you put your API key and optionally enable debug/sandbox mode.

Identified vs Resolved
A.K.A. why doesn't my entity have information. Ideally every entity is synchronised with the API, this however is not the case. Instead, every time you need an entity you can resolve it with .get(), which returns a promise containing the entity with it's latest information from the API.

Instead of returning a promise every time you want to reference an entity, you get an identified entity. This means the entity only contains the entity' id and not it's properties. If you need it's properties, you will need to resolve it with .get().

Examples!

The broker
Let's start with creating the broker, the most important piece:

    const { RevolutBroker } = require('@pollex/revolut');
    // Optional extra boolean parameter indicating sandbox mode.
    const broker = new RevolutBroker('YOU API KEY HERE');

Every entity needs a broker, however the broker is automagically passed to related entities. So you won't have to use it constantly!

Retrieving accounts
So I would like to know my business accounts:

    const { Account } = require('@pollex/revolut');

    // broker defined as previous example
    // GetAll returns a promise!
    Account.GetAll(broker)
        .then( accounts => {
            // accounts is an Array of Account objects :)
        });

Paying to a CounterParty
Paying requires you to have an Account to pay from and a CounterAccount, which is the account of the counterparty to pay to. However a CounterAccount can't be resolved directly. Instead you have to resolve a CounterParty and get the account from the .accounts property.

    // Assuming you have an Account and CounterAccount entity
    const payment = Account.pay(counterAccount, 12.50, 'Optional reference text');
    // A payment is not executed on creation
    payment.execute()
        .then(transaction => {
            // executing returns a promise resolving in the created transaction
            // ...
        });

For more information like transfering money and retrieving counterparties and -accounts, see the wiki on github!

License

This library is licensed under AGPL-3.0