sepa-xml-maker
v1.1.3
Published
Generador de archivos SEPA en XML compatible con ISO20022
Downloads
179
Maintainers
Readme
sepa-xml-maker
Overview
The SEPA XML MAKER is a Node.js module designed for creating SEPA Direct Debit files in ISO20022 XML format. This module is ideal for automating payments across Europe, providing a simple and efficient way to generate compliant XML files for bank transactions.
Key Features
- ISO20022 Compliance: Generates XML files that comply with the ISO20022 standard for direct debit transactions.
- Flexible Configuration: Easily customize transaction details, creditor information, and message headers.
- Batch Processing: Generate XML for multiple transactions in one go.
- Error Handling: Built-in mechanisms to handle errors and invalid inputs.
Installation
To install the Direct Debit XML Generator, run the following command in your terminal:
npm i sepa-xml-maker
Usage
Import the generateXML function in your Node.js project
const generateXML = require('sepa-xml-maker');
Example
Here's how to generate an XML file:
const generateXML = require('sepa-xml-maker');
const transactions = [
{
endToEndId: "1",
currency: "EUR",
amount: "250.00",
mandateId: "5678",
mandateDate: "2024-11-02",
creditorId: "ES1234567890", // Example NIF
bic: "BANCOEXAMPLEXXX",
debtorName: "Alice Example",
debtorIBAN: "ES9121000418450200051332", // Example IBAN
reference: "EXAMPLECORP - SUBSCRIPTION"
},
// Add more transactions as needed
];
const data = {
msgId: "EXAMPLE CORP 2024-11",
total: transactions.length,
totalCuotas: "250.00",
orgId: "ES1234567890", // Example NIF
iban: "ES9121000418450200051332", // Example IBAN
bic: "BANCOEXAMPLEXXX"
};
const xmlContent = generateXML(transactions, data);
Parameters
The generateXML function takes two parameters:
transactions (Array): An array of objects, each containing:
- endToEndId (string): Unique transaction ID.
- currency (string): Currency code (e.g., "EUR").
- amount (string): Transaction amount.
- mandateId (string): Mandate ID.
- mandateDate (string): Date of mandate signature in YYYY-MM-DD format.
- creditorId (string): Creditor's unique identification number.
- bic (string): Bank Identifier Code (BIC) of the debtor's bank.
- debtorName (string): Name of the debtor.
- debtorIBAN (string): IBAN of the debtor's account.
- reference (string): Payment reference or description.
data (Object): Contains general information for the SEPA file:
- msgId (string): Unique message ID.
- total (number): Total number of transactions.
- totalCuotas (string): Total sum of the transaction amounts.
- orgId (string): Organization ID (e.g., NIF or CIF for Spain).
- iban (string): Creditor's IBAN.
- bic (string): Creditor's BIC.
Output
The generateXML function returns a formatted XML string in ISO20022 format. You can save this XML string as a .xml file or process it further as needed.
Example Output
Here’s a snippet of the XML output:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02">
<CstmrDrctDbtInitn>
<GrpHdr>
<MsgId>EXAMPLE CORP 2024-11</MsgId>
<CreDtTm>2024-11-05T20:01:11</CreDtTm>
<NbOfTxs>1</NbOfTxs>
<CtrlSum>250.00</CtrlSum>
<InitgPty>
<Nm>EXAMPLE CORP 2024-11</Nm>
<Id>
<OrgId>
<Othr>
<Id>ES1234567890</Id>
</Othr>
</OrgId>
</Id>
</InitgPty>
</GrpHdr>
<PmtInf>
<PmtInfId>1</PmtInfId>
<PmtMtd>DD</PmtMtd>
<CtrlSum>250.00</CtrlSum>
<PmtTpInf>
<SvcLvl>
<Cd>SEPA</Cd>
</SvcLvl>
<LclInstrm>
<Cd>CORE</Cd>
</LclInstrm>
<SeqTp>RCUR</SeqTp>
</PmtTpInf>
<ReqdColltnDt>2024-11-05</ReqdColltnDt>
<Cdtr>
<Nm>EXAMPLE CORP 2024-11</Nm>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>ES9121000418450200051332</IBAN>
</Id>
</CdtrAcct>
<CdtrAgt>
<FinInstnId>
<BIC>BANCOEXAMPLEXXX</BIC>
</FinInstnId>
</CdtrAgt>
<ChrgBr>SLEV</ChrgBr>
<DrctDbtTxInf>
<PmtId>
<EndToEndId>1</EndToEndId>
</PmtId>
<InstdAmt Ccy="EUR">250.00</InstdAmt>
<DrctDbtTx>
<MndtRltdInf>
<MndtId>5678</MndtId>
<DtOfSgntr>2024-11-02</DtOfSgntr>
</MndtRltdInf>
<CdtrSchmeId>
<Id>
<PrvtId>
<Othr>
<Id>ES1234567890</Id>
<SchmeNm>
<Prtry>SEPA</Prtry>
</SchmeNm>
</Othr>
</PrvtId>
</Id>
</CdtrSchmeId>
</DrctDbtTx>
<DbtrAgt>
<FinInstnId>
<BIC>BANCOEXAMPLEXXX</BIC>
</FinInstnId>
</DbtrAgt>
<Dbtr>
<Nm>Alice Example</Nm>
</Dbtr>
<DbtrAcct>
<Id>
<IBAN>ES9121000418450200051332</IBAN>
</Id>
</DbtrAcct>
<Purp>
<Cd>COMC</Cd>
</Purp>
<RmtInf>
<Ustrd>EXAMPLECORP - SUBSCRIPTION</Ustrd>
</RmtInf>
</DrctDbtTxInf>
</PmtInf>
</CstmrDrctDbtInitn>
</Document>