Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

belvo

Package Overview
Dependencies
Maintainers
6
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

belvo - npm Package Compare versions

Comparing version 0.16.1 to 0.17.0

10

lib/incomes.js

@@ -80,3 +80,3 @@ "use strict";

* @param {string} link - UUID4 representation of a link Id.
* @param {object} options - Optional parameters (saveData)
* @param {object} options - Optional parameters (saveData, dateFrom, dateTo)
* @returns {object} Response

@@ -89,2 +89,4 @@ * @throws {RequestError}

saveData,
dateFrom,
dateTo,
result,

@@ -97,7 +99,9 @@ _args = arguments;

options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
saveData = options.saveData;
saveData = options.saveData, dateFrom = options.dateFrom, dateTo = options.dateTo;
_context.next = 4;
return this.session.post(_classPrivateFieldLooseBase(this, _endpoint)[_endpoint], {
link: link,
save_data: saveData
save_data: saveData,
date_from: dateFrom,
date_to: dateTo
});

@@ -104,0 +108,0 @@

{
"name": "belvo",
"version": "0.16.1",
"version": "0.17.0",
"description": "The node.js module for the Belvo API",

@@ -5,0 +5,0 @@ "main": "lib/belvo.js",

@@ -26,3 +26,7 @@ <h1 align="center">Belvo Js</h1>

## Usage
## Usage (create link via widget)
When your user successfully links their account using the [Connect Widget](https://developers.belvo.com/docs/connect-widget), your implemented callback funciton will return the `link_id` required to make further API to retrieve information.
```javascript

@@ -37,13 +41,20 @@ var belvo = require("belvo").default;

client.connect()
.then(function () {
client.links.list()
.then(function (res) {
console.log(res);
})
.catch(function (error) {
console.log(error);
});
});
// Get the link_id from the result of your widget callback function
const linkId = resultFromCallbackFunction.id
function retrieveAccounts (linkId) {
return client.connect().then(function () {
return client.accounts.retrieve(linkId)
.then(function (response) {
return(response);
})
.catch(function (error) {
console.error(error)
});
})
}
```
Or if you prefer to use ES6 and async/await

@@ -60,8 +71,11 @@

async function getLinks() {
// Get the link_id from the result of your widget callback function
const linkId = result_from_callback_function.id
async function retrieveAccounts(linkId) {
try {
const links = await client.links.list();
console.log(links);
await client.connect()
return await client.accounts.retrieve(linkId);
} catch (error) {
console.log(error);
console.log(error);
}

@@ -71,2 +85,55 @@ }

## Usage (create link via SDK)
You can also manually create the link using the SDK. However, for security purposes, we highly recommend, that you use the [Connect Widget](https://developers.belvo.com/docs/connect-widget) to create the link and follow the **Usage (create link via widget)** example.
```javascript
var belvo = require("belvo").default;
var client = new belvo(
'YOUR-KEY-ID',
'YOUR-SECRET',
'sandbox'
);
function registerLinkAndRetrieveAccounts () {
return client.connect().then(function () {
return client.links.register('erebor_mx_retail', 'bnk1002', 'full')
.then(function (response) {
return client.accounts.retrieve(response.id);
})
.then(function (response) {
return response;
})
.catch(function (error) {
console.error(error)
});
})
}
```
Or if you prefer to use ES6 and async/await
```javascript
import Client from 'belvo';
const client = new Client(
'YOUR-KEY-ID',
'YOUR-SECRET',
'sandbox'
);
async function registerLinkAndRetrieveAccounts () {
try {
await client.connect()
const link = await client.links.register('erebor_mx_retail', 'bnk1006', 'supersecret');
console.log(link)
return await client.accounts.retrieve(link.id);
} catch (error) {
console.log(error);
}
}
```
## Development

@@ -73,0 +140,0 @@ After checking out the repo, run `npm install` to install dependencies. Then, run `npm test` to run the tests.

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