# safe-sepa-xml

> A simple XML generator for SEPA transactions using money-math for safe summations.

Latest version **0.2.2** (published 2016-11-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install safe-sepa-xml
pnpm add safe-sepa-xml
yarn add safe-sepa-xml
bun add safe-sepa-xml
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2016-11-11 |
| First published | 2016-11-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+20 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Bram Koot |
| Maintainers | bramkoot |
| Keywords | sepa, swift, iban, payment, xml |

## Links

- npm: https://www.npmjs.com/package/safe-sepa-xml
- Repository: https://github.com/bramkoot/sepa-xml
- Homepage: https://github.com/bramkoot/sepa-xml#readme
- Issues: https://github.com/bramkoot/sepa-xml/issues
- npm.io page: https://npm.io/package/safe-sepa-xml

## Dependencies (2)

- [handlebars](https://npm.io/package/handlebars.md) 4.0.5
- [money-math](https://npm.io/package/money-math.md) 2.4.3

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.2.2 (latest) — 2016-11-11
- 0.2.1 — 2016-11-11

## README

# SEPA-XML

*This is a fork from the perfect mgmco/sepa-xml library. The only change is that for the summation of money, money-math is used instead of floating point calculations.*

This module gives you a wrapper around generating a SEPA XML file. It works by using [Handlebars](http://handlebarsjs.com/) 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!

## Formats

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

 * `pain.001.001.03`
 * `pain.001.001.02` (thanks [@PierrickP](https://github.com/PierrickP))
 * Want to add one? [Send us a pull request](https://github.com/mgmco/sepa-xml/compare/)!

## Usage

```javascript
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
});
```

## 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](https://github.com/mgmco/sepa-xml/blob/master/bics/list.js)
 * Anything else you can think of

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