Code Monkey home page Code Monkey logo

investec-api's Introduction

npm version

investec-api

An NPM module to interact with Investec's Open API

Usage

(This module has types, so intellisense is your friend).

Set up client

import { Client } from "investec-api";
const client = await Client.create(id, secret, apiKey);

This creates an access token that the client will use to interact with the API.

If you start to get errors about the token no longer being valid, simply call:

await client.authenticate();

Accounts

List accounts

const accounts = await client.getAccounts("private" | "business" = "private");

This returns an array of Account objects.

Account functions

On an Account object, you can:

Get Balance

const balance = await account.getBalance();

Get transactions

const transactions = await account.getTransactions({
  fromDate: string;
  toDate: string;
  transactionType: string;
});

Transfer

const transfer = await account.transfer([
  {
    account: Account;
    amount: number;
    myReference: string;
    theirReference: string;
  }
]);

Payments

const payment = await account.pay([
  {
    beneficiary: InvestecBeneficiary;
    myReference: string;
    theirReference: string;
    amount: number;
   }
]);

Beneficiaries

List beneficiaries

const beneficiaries = await client.getBeneficiaries();

List beneficiary categories

const beneficiaryCategories = await client.getBeneficiaryCategories();

Cards

List cards

const cards = await client.getCards();

Get Card countries

const countries = await Card.getCountries();

Get Card currencies

const countries = await Card.getCurrencies();

Get Card merchants

const countries = await Card.getMerchants();

Card functions

On a Card object, you can:

Get Saved code

const savedCode = await card.getSavedCode();

Get published code

const publishedCode = await card.getPublishedCode();

Update saved code

const updatedCode = await card.updateSavedCode(code: string);

Publish saved code

const publishedCode = await card.publishSavedCode(codeId: string);

Simulate functions execution

const execution = await card.simulateFunctionExecution({
  code: string;
  centsAmount: string;
  currencyCode: string;
  merchantCode: number;
  merchantCity: string;
  countryCode: string;
});

Get previous executions

const executions = await card.getExecutions();

List environment variables

const variables = await card.getEnvironmentVariables();

Update environment variables

const variables = await card.updateEnvironmentVariables({...});

Investec Programmable Banking Docs

You can read more about Investec's Programmable Banking here: https://developer.investec.com/za/api-products/documentation/U0ElMjBQQiUyMEFjY291bnQlMjBJbmZvcm1hdGlvbg%3D%3D

This library is merely an interface yo the above.

investec-api's People

Contributors

frikkiesnyman avatar barrymichaeldoyle avatar

Stargazers

Cairin Michie avatar L B avatar  avatar Devin avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

investec-api's Issues

Doc improvements

Hey, Frikkie love the connector, I was looking through the Readme and thought I would share some suggestions.

Add an NPM badge, as you aren't keeping the GitHub releases on par with the nom releases, it would be easier to see the npm release version on the readme.

Add an example of how to instantiate the Client with the api key. I see the code is there the example in the Readme doesn't explain it.

The payments example has a typo you have a - instead of a =
const payment - await account.pay

Look at putting a link to the original Investec api docs to help fill out the context of the connector.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.