svb-onboarding
v1.3.2
Published
Onboarding helper for SVB API
Downloads
6
Readme
svb-onboarding
Helper library for NodeJS and Silicon Valley Bank's API, which uses svb-client module to make HMAC-signed GET, PATCH, POST, and DELETE requests.
Contains helper functions for all of these resources in the API:
- address
- company
- document
- file
- gov ident
- login
- parent company
- person
Dependencies
Usage
const SVBOnboarding = require('svb-onboarding');
const SVBClient = require('svb-client');
let client = new SVBClient({
API_KEY: '',
HMAC_SECRET: ''
});
let Onboarding = new SVBOnboarding(client);
// registering person with link to a new address resource
Onboarding.address.create({
street_line1: '221B Baker St',
city: 'London',
country: 'GB'
}, (err, address) => {
Onboarding.person.create({
// Onboarding module will fill in the address_id property
address: address,
date_of_birth: '1881-01-01',
first_name: 'Sherlock',
last_name: 'Holmes',
title: 'Detective'
}, (err, person) => {
});
});
// retrieving one or all Person resources
Onboarding.person.get(101, (err, person) => {
...
});
Onboarding.person.all((err, people) => {
...
});
Updating and Deleting Resources
// (update is not available on some resources)
Onboarding.person.update(person_id, person_json, callbackFn);
// deleting a Person resource
Onboarding.person.delete(person_id, callbackFn);
File Uploads
// uploading a local file
Onboarding.file(__dirname + '/y18.png', (err, data) => {
assert.equal(err, null);
assert.equal(typeof data, 'object');
assert.equal(typeof data.id, 'number');
done();
});
// to upload from a different source, use svb-client directly
client.upload('/v1/files', fs.createReadStream(...), (err, data) => {
...
});
Install
npm install svb-onboarding --save