New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

investec-openapi

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

investec-openapi

A JavaScript/TypeScript wrapper to get up and running fast with Investec's Open API for programmable banking.

  • 3.5.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-83.33%
Maintainers
1
Weekly downloads
 
Created
Source

Investec Programmable Banking Open API Wrapper

A JavaScript/TypeScript wrapper to get up and running fast with Investec's Open API for programmable banking.

Nodei.co badge
NPM version NPM downloads Dependency Status TS Deno ECMAScript GitHub PRs Welcome

Installation

Using npm:

npm install investec-openapi

Using yarn:

yarn add investec-openapi

Usage

Setup:

import api from 'investec-openapi'

api.configure({
  proxyUrl: 'ProxyUrl_see_docs_below',
  clientId: 'YourClientId_do_not_share'
  secret: 'YourSecret_do_not_share'
})

Get Data:

const fetchData = async () => {
    const accounts = await api.getAccounts()
    console.log(accounts) // prints accounts linked to account

    const accountBalance = await api.getAccountBalance('accountId')
    console.log(accountBalance) // prints account balance

    const accountTransactions = await api.getAccountTransactions('accountId')
    console.log(accountTransactions) // prints account transactions
}

OR:

const fetchData = async () => {
    api.getAccounts().then(accounts => console.log(accounts))

    api.getAccountBalance('accountId')
        .then(accountBalance => console.log(accountBalance))

    api.getAccountTransactions('accountId')
        .then(accountTransactions => console.log(accountTransactions))
}

Documentation

api is a class that once configured will generate an access_token behind the scenes and replace it with a new one once it's within a minute of expiring with no work required on your end.

This wrapper supports getAccounts, getAccountBalance and getAccountTransactions as documented in the Investec Developer Documentation with TypeScript definitions included.


api.configure(config)

Sets up api class with credentials to acquire and refresh access_token. Can be called again to change credentials and refresh access_token for new credentials. Other API calls will wait until access_token is set (by calling this function) before running.

config parameters:
proxyUrl - optional

default: 'https://young-thicket-56542.herokuapp.com/' Note: Without a proxyUrl, you'll experience CORS issues. If anyone has an ideas on how to bypass this more cleanly, let me know! For now the default value should work. Sometimes the Heroko app needs to spin up initially so the first load may take longer than usual. Default url is a clone of https://cors-anywhere.herokuapp.com/ from this SO post: https://stackoverflow.com/a/43268098/2111515

clientId - required

Get this from https://login.secure.investec.com/io/programmable-banking/cards/overview

secret - required

Get this from Get this from https://login.secure.investec.com/io/programmable-banking/cards/overview


api.getAccounts()

Returns list of accounts with details for configured credentials. Response:

{
    data: {
        accounts: {
            accountId: string
            accountNumber: string
            accountName: string
            referenceName: string
            productName: string
         }[]
    }
    links: {
        self: string
    }
    meta: {
        totalPages: number
    }
}

api.getAccountBalance(accountId)

Returns account balance details for selected account. accountId - required Response:

{
    data: {
        accountId: string
        currentBalance: number
        availableBalance: number
        currency: string
    }
    links: {
        self: string
    }
    meta: {
        totalPages: number
    }
}

api.getAccountBalance(accountId)

Returns list of transaction details for selected account. accountId - required Response:

{
    data: {
        transactions: {
            accountId: string
            type: string
            status: string
            description: string
            cardNumber: string
            postingData: string
            valueDate: string
            actionDate: string
            amount: number
        }[]
    }
    links: {
        self: string
    }
    meta: {
        totalPages: number
    }
}

Hope you find this useful! Please give a star and feel free to contribute or log issues and feature requests!

And if you want to say thanks, then please:

Buy Me A Coffee

Keywords

FAQs

Package last updated on 28 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc