0.5.1 • Published 4 years ago

node-fints v0.5.1

Weekly downloads
7
License
MIT
Repository
github
Last release
4 years ago

node-fints

npm

A client library for communicating with FinTS servers.

Fork from fints

Fork from nodejs-fints

Example

Typescript Example

import { PinTanClient } from "node-fints";

const startDate = new Date("2018-08-10T12:00:00Z");
const endDate = new Date("2018-10-10T12:00:00Z");

const client = new PinTanClient({
    url: "https://example.com/fints",
    name: "username",
    pin: 12345,
    blz: 12345678,
});

const accounts = await client.accounts();
console.info(accounts); // List of all accounts.

const statements = await client.statements(accounts[0], startDate, endDate);
console.info(statements); // List of all statements with transactions in specified date range.

JavaScript Example

function getAccountStatements( client, accounts, statements, callback ) {
  for ( let i in accounts ) {
    let account = accounts[i]

    if ( !account.hasOwnProperty( "statementsIsSet" ) || (account.hasOwnProperty( "statementsIsSet" ) && !account.statementsIsSet) ) {
      client
        .statements( account, new Date( moment().subtract( 1, 'day' ).startOf( 'day' ) ), new Date() )
        .then( function( statementsBack ) {
          statements.push( statementsBack )
          account.statementsIsSet = true
          account.statements = ((statementsBack.length > 0) ? statementsBack[0] : {})
          let accountsFilter = accounts.filter( function( account ) {
            return (account.hasOwnProperty( "statementsIsSet" ))
          } )
          if ( accountsFilter.length === accounts.length ) {
            callback( statements, accounts )
            return
          } else {
            getAccountStatements( client, accounts, statements, callback )
          }
        } );
      break
    }
  }
}


const client = new PinTanClient( {
                                   url: "https://example.com/fints",
                                   name: "username",
                                   pin: 12345,
                                   blz: 12345678,
                                 } );
let fintsObject = {
  accounts: null,
  statements: null
}
client.accounts().then( function( accounts ) {
  fintsObject.accounts = accounts
  getAccountStatements( client, accounts, [], ( statements, accountsBack ) => {
    fintsObject.statements = statements;

    console.log( fintsObject );
  } )
} ).catch( ( error ) => {
  console.log( error );
} )

##Test Javascript Example with runKit Javascript Example

nodjs Service Example

Example Application with nodejs middleware and web application for view banking transactions.

###Nodejs application for the fints data processing

Features

  • Load list of accounts.
  • Load list of statements and transactions in specified range.
  • Parse statement MT940 format.
  • Parse transaction descriptions.
  • Extract reference tags from transactions.
  • List supported TAN methods.
  • Parse basic metadata.

Missing

  • Get current balance.
  • List holdings.
  • Initiate any kind of SEPA transfers or debits.

Resources