1.0.5 • Published 2 years ago

finerio-connect-lite v1.0.5

Weekly downloads
121
License
ISC
Repository
github
Last release
2 years ago

Finerio Connect Lite API JavaScript SDK

This SDK lets you connect to Finerio Connect Lite API in an easier way.

Table of contents

Installation

NPM:

npm install finerio-connect-lite

Setup

let fcLite = require( 'finerio-connect-lite' );
let FinerioConnectLite = fcLite.FinerioConnectLite;
const util = require('util');

let serverUrl = 'https://lite.finerioconnect.com';
let username = 'yourUsername';
let password = 'yourPassword';

let finerioConnectLite = new FinerioConnectLite(
  serverUrl, username, password
);

Usage

Finerio Connect Lite SDK uses Promises to fetch responses from the API.

Get available banks

finerioConnectLite.getBanks()
  .then( data => console.log( data ) ) 
  .catch( error => console.log( error ) );

Output:

[
  Bank { id: 1, name: 'BBVA Bancomer', status: 'ACTIVE' },
  Bank { id: 2, name: 'Citibanamex', status: 'ACTIVE' },
...
]

Get bank fields

finerioConnectLite.getBankFields( bankId )
  .then( data => console.log( util.inspect(data, {showHidden: false, depth: null})) ) 
  .catch( error => console.log( error ) );

Output:

[
  BankField {
    name: 'username',
    friendlyName: 'Usuario',
    position: 1,
    type: '1',
    required: true,
    extraData: [
      BankFieldExtraData { name: 'nameField1', value: 'customValue' },
      BankFieldExtraData { name: 'nameField2', value: 'customValue' }
    ]
  },
...
]

Get credential error messages

finerioConnectLite.getErrorMessages()
  .then( data => console.log( data ) ) 
  .catch( error => console.log( error ) );

Output:

[
  ErrorMessage {
    code: 203,
    key: 'account_blocked',
    description: 'Online banking account blocked',
    text: 'Tu banca en línea está bloqueada. Sigue el procedimiento de tu banco para desbloquearla e intenta nuevamente sincronizar tu cuenta.'
  },
  ErrorMessage {
    code: 504,
    key: 'gateway_timeout',
    description: 'Gateway timeout',
    text: 'Hubo un problema de conexión con tu banco. Sincroniza tu cuenta nuevamente en 5 minutos.'
  },
...
]

Get callbacks

finerioConnectLite.getCallbacks()
  .then( data => console.log( data ) )
  .catch( error => console.log( error ) );

Output:

[
  Callback {
    id: 1,
    url: 'https://yourccompany.com/success/callback',
    nature: 'SUCCESS'
  },
  Callback {
    id: 1,
    url: 'https://yourcompany.com/failure/callback',
    nature: 'FAILURE'
  },
...
]

Get a callback

let callbackId = 1;
finerioConnectLite.getCallback( callbackId )
  .then( data => console.log( data ) )
  .catch( error => console.log( error ) );

Output:

Callback {
  id: 1,
  url: 'https://yourccompany.com/success/callback',
  nature: 'SUCCESS'
}

Register a callback

let CreateCallback = fcLite.CreateCallback;

...

let dto = new CreateCallback(
  'https://yourccompany.com/success/callback',
  'SUCCESS'
);
finerioConnectLite.createCallback( dto )
  .then( data => console.log( data ) )
  .catch( error => console.log( error ) );

Output:

Callback {
  id: 1,
  url: 'https://yourccompany.com/success/callback',
  nature: 'SUCCESS'
}

Update a callback

let callbackId = 1;
let newUrl = 'https://google.com';
finerioConnectLite.updateCallback( callbackId, newUrl )
  .then( data => console.log( data ) )
  .catch( error => console.log( error ) );

Output:

Callback {
  id: 1,
  url: 'https://google.com',
  nature: 'SUCCESS'
}

Delete a callback

let callbackId = 1;
finerioConnectLite.deleteCallback( 1 )
  .then( () => console.log( 'Item deleted' ) )
  .catch( error => console.log( error ) );

There is no output from the API for this action.

Register a credential

let CreateCredential = fcLite.CreateCredential;

...

let customId = 'customId';
let bankId = 1;
let username = 'username';
let password = 'password';
let securityCode = 'securityCode';
let documenType = 'documentType';
let createCredentialDto = new CreateCredential( customId, bankId, username, password, securityCode, documentType );
finerioConnectLite.createCredential( createCredentialDto )
  .then( data => console.log( data ) )
  .catch( error => console.log( error ) );

Output:

Credential {
  id: '5422fb7e-0adb-4db2-a8e7-a892d04d2c95',
  username: 'username',
  dateCreated: 1614189618474
}
1.0.5

2 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago