JSPM

iso2esr

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q25668F
  • License MIT

convert ISO20022 to ESR

Package Exports

  • iso2esr

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (iso2esr) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

iso2esr

Convert ISO20022 camt.054.xml to ESR files ESR Gutschriften Einzahlungsscheine

Installation

npm install iso2esr

Usage


const fs                = require('fs');         // npm  file system
const esr               = require('iso2esr');    // iso2esr module

const testFilePath      = 'test/data/';
const testFileXml1      = testFilePath + 'camt.054-ESR-Test1.xml';
const testFileTxt1_1    = testFilePath + 'camt.054-ESR-Test1-1.txt';
const testFileTxt2      = testFilePath + 'result.txt';

var iso, esr_list, txt;

// load ISO20022 as JSON
console.log('load ISO20022 as JSON');
iso = esr.loadXmlFileAsJson(testFileXml1);
console.log('iso:', iso);

// create ESR_List from iso
console.log('create ESR_List from iso');
esr_list = esr.parseFromIso(iso);
console.log('esr_list.count():', esr_list.count());
console.log('esr_list.Totalbetrag:', esr_list.Totalbetrag);
console.log('esr_list.ValutaDatum:', esr_list.ValutaDatum);

// convert to text
txt = esr_list.toString();
console.log('txt:', txt);

console.log('save to file:', testFileTxt2);
fs.writeFileSync(testFileTxt2, txt, 'latin1');

Interface

In der Datei ISO20022toESR.ini können einige Einstellungen vorgenommen werden.

function ESR_Record( Teilnehmernummer, KundenReferenz, AuftraggeberReferenz, Betrag, ValutaDatum, Reject )

Return a ESR_Record for a single transaction

var r = new ESR_Record();

function ESR_List()

Return a ESR_List object for multiple transactions

var list = new ESR_List();
Properties
  • Teilnehmernummer
  • Totalbetrag
  • ValutaDatum
  • ErstellungsDatum
  • list (array of ESR_Record)
  • count() (number of transactions)
  • toString()

function loadXmlFileAsJson( fileName )

Read a ISO20022 XML file and return an object.

function parseFromIso( iso )

Return a ESR_List with transactions from iso, where iso is a JSON loaded by function loadXmlFileAsJson().

function parseFromText( txt )

Return a ESR_List with transactions from txt, where txt is a string as camt format.

License

MIT License

GitHub

Version on GitHub