Giter Club home page Giter Club logo

sepa-xml's Introduction

SEPA-XML

This module gives you a wrapper around generating a SEPA XML file. It works by using Handlebars to generate the file instead of using the conventional XML tree approach used by other plugins.

It does, however, run the final result through a validator and will throw an error if there's an issue with it!

This fork can take an ibanValidator as a parameter.

Formats

These can be found in the formats folders, and are simple Handlebars files representing the XML schema.

Usage

var SepaXML = require('sepa-xml');
var XMLFile = new SepaXML(); // takes a single argument which is the format, default is 'pain.001.001.03'

// This sets the header data in the file
XMLFile.setHeaderInfo({
  messageId: '123/1',
  initiator: 'XML Corp.'
});

XMLFile.setPaymentInfo({
  id: '123/1',
  method: 'TRF',
  senderName: 'Acme Co.',
  senderIBAN: 'NL39 RABO 0300 0652 64',
  batchBooking: false, // optional (default: false)
  bic: 'RABONL2U'
});

// Add one of these for every transaction
XMLFile.addTransaction({
  id: 'endToEndID',
  amount: 10.00,
  name: 'My Name',
  iban: 'NL39 RABO 0300 0652 64',
  bic: 'RABONL2U',  // optional can be auto-found it
  description: 'My great payment'
});

XMLFile.compile(function (err, out) {
  // your XML data gets output here
});

Example pain.008.001.02

var SepaXML = require('sepa-xml');
var XMLFile = new SepaXML({ format: 'pain.008.001.02' });
// You could use new
// SepaXML({ format: 'pain.008.001.02', ibanValidator: { isValid: iban => true } })
// ibanValidator must implement isValid

// This sets the header data in the file
XMLFile.setHeaderInfo({
  messageId: '123/1',
  initiator: 'XML Corp.'
});

XMLFile.setPaymentInfo({
  when: new Date('2020-02-01'),
  id: 'RCUR 123/1',
  method: 'DD',
  creditorName: 'XML Corp',
  creditorIBAN: 'NL39RABO0300065264',
  creditorIdentifier : 'NL63ZZZ400123790000',
  batchBooking: false, // optional (default: false)
  bic: 'RABONL2U'
});

// Add one of these for every transaction
XMLFile.addTransaction({
  id: '123/1.01',
  amount: '86.00',
  mandateId : 'Mndt-135-1-11-2009',
  mandateSignatureDate : '2009-11-01', 
  name: 'Debitor Name',
  iban: 'NL39RABO0300098765',
  bic: 'RABONL2U',  // optional can be auto-found it
  description: 'Annual Fee 2020'
});

XMLFile.compile(function (err, out) {
  // your XML data gets output here
});

Contributing

  • Would be nice if someone wrote more templates for some of the other formats used for SEPA.
  • The BICS lookup list is probably not complete - it would be great if someone could add that data into the map
  • Anything else you can think of

sepa-xml's People

Contributors

bramkoot avatar chrissvo avatar juaruipi avatar mathewmeconry avatar mtimofiiv avatar pierrickp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.