a-fas / mt940js

Swift MT940 bank statement javascript parser
Apache License 2.0
32 stars 17 forks source link

Structured field 86 #1

Closed a-fas closed 7 years ago

a-fas commented 7 years ago

Support for field 86 structure

Currently the library supports '<sep>DD' structure tag format. E.g. '>20some details >30more data'. <sep> can be '>' or '?'. The parser attempts to detect if field 86 contains tags like this and, if yes, adds structuredDetails attribute to a statement line. Tag digits are not interpreted as they are not standartized among different banks.

// let incoming file contain one line with 86 field:
// '>20some details>30more data'

const statements = ... // parsing here

for (let s of statements) {
 for (let t of s.transactions) {
   console.log(t.structuredDetails);
   // { '20': 'some details',
   //   '30': 'more data' }
 }
}