# finerio-connect-lite

> JavaScript SDK for Finerio Connect Lite API

Latest version **1.0.5** (published 2022-01-27) · ISC license · 0 weekly downloads

## Install

```sh
npm install finerio-connect-lite
pnpm add finerio-connect-lite
yarn add finerio-connect-lite
bun add finerio-connect-lite
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2022-01-27 |
| First published | 2021-02-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 29.6 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | Finerio Connect |
| Maintainers | finerio-connect |
| Keywords | open-banking |

## Links

- npm: https://www.npmjs.com/package/finerio-connect-lite
- Repository: https://github.com/Finerio-Connect/lite-javascript
- Homepage: https://github.com/Finerio-Connect/lite-javascript#readme
- Issues: https://github.com/Finerio-Connect/lite-javascript/issues
- npm.io page: https://npm.io/package/finerio-connect-lite

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^0.21.1
- [querystring](https://npm.io/package/querystring.md) ^0.2.1

## Recent versions

- 1.0.5 (latest) — 2022-01-27
- 1.0.4 — 2021-10-06
- 1.0.3 — 2021-06-22
- 1.0.2 — 2021-02-25
- 1.0.1 — 2021-02-24
- 1.0.0 — 2021-02-24

## README

# Finerio Connect Lite API JavaScript SDK #

This SDK lets you connect to [Finerio Connect Lite API](https://lite-api-docs.finerioconnect.com/) in an easier way.

## Table of contents ##

* [Installation](#installation)
* [Setup](#setup)
* [Usage](#usage)
    * [Get available banks](#get-available-banks)
    * [Get bank fields](#get-bank-fields)
    * [Get credential error messages](#get-credential-error-messages)
    * [Get callbacks](#get-callbacks)
    * [Get a callback](#get-a-callback)
    * [Register a callback](#register-a-callback)
    * [Update a callback](#update-a-callback)
    * [Delete a callback](#delete-a-callback)
    * [Register a credential](#register-a-credential)

## Installation ##

NPM:

```
npm install finerio-connect-lite
```

## Setup ##

```javascript
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 ###

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

Output:

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

### Get bank fields ###

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

Output:

```console
[
  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 ###

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

Output:

```console
[
  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 ###

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

Output:

```console
[
  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 ###

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

Output:

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

### Register a callback ###

```javascript
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:

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

### Update a callback ###

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

Output:

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

### Delete a callback ###

```javascript
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 ###

```javascript
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:

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

---
_Source: https://npm.io/package/finerio-connect-lite · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
