From 5cf29e6d9eebe96184cb1a2901f30ccac3757ed2 Mon Sep 17 00:00:00 2001 From: Raphael Moutard Date: Tue, 28 May 2019 18:54:05 +0200 Subject: [PATCH] Add CIF number for spanish companies (#3) --- lib/sepa.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/sepa.js b/lib/sepa.js index 8f10d99..c19a222 100644 --- a/lib/sepa.js +++ b/lib/sepa.js @@ -194,6 +194,10 @@ created: '', transactionCount: 0, initiatorName: '', + /** + * Used by spanish companies it's mandatory for SEPA in spain. + */ + cifNumber: '', controlSum: 0, batchBooking: false, grouping: 'MIXD', @@ -224,7 +228,12 @@ r(grpHdr, 'Grpg', this.grouping); } - r(grpHdr, 'InitgPty', 'Nm', this.initiatorName); + var n = createXMLHelper(doc, true, false); + var initgPty = n(grpHdr, 'InitgPty'); + r(initgPty, 'Nm', this.initiatorName); + if (this.cifNumber) { + r(initgPty, 'Id', 'OrgId', 'Othr', 'Id', this.cifNumber); + } return grpHdr; },