From ee2b1720cc2ffdd6a9cb1676c01d08e35522a498 Mon Sep 17 00:00:00 2001 From: Hanno Fellmann Date: Fri, 5 Jul 2024 13:48:48 +0200 Subject: [PATCH 1/2] add support for pain.008.001.08 and pain.001.001.09 --- README.md | 187 +++--- lib/schema.test.js | 96 ++++ lib/sepa.js | 30 +- lib/sepa.test.js | 4 +- package-lock.json | 428 +++++++++++++- package.json | 3 +- schema/pain.001.001.02.xsd | 784 +++++++++++++++++++++++++ schema/pain.001.001.03.xsd | 921 +++++++++++++++++++++++++++++ schema/pain.001.001.08.xsd | 1036 +++++++++++++++++++++++++++++++++ schema/pain.001.001.09.xsd | 1114 ++++++++++++++++++++++++++++++++++++ schema/pain.008.001.02.xsd | 879 ++++++++++++++++++++++++++++ schema/pain.008.001.08.xsd | 1106 +++++++++++++++++++++++++++++++++++ 12 files changed, 6482 insertions(+), 106 deletions(-) create mode 100644 lib/schema.test.js create mode 100644 schema/pain.001.001.02.xsd create mode 100644 schema/pain.001.001.03.xsd create mode 100644 schema/pain.001.001.08.xsd create mode 100644 schema/pain.001.001.09.xsd create mode 100644 schema/pain.008.001.02.xsd create mode 100644 schema/pain.008.001.08.xsd diff --git a/README.md b/README.md index 75afae6..c0a67b7 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ omit the first line and include via script-tag or module loader instead. ```javascript var SEPA = require("sepa"); -var doc = new SEPA.Document('pain.008.001.02'); +var doc = new SEPA.Document('pain.008.001.08'); doc.grpHdr.id = "XMPL.20140201.TR0"; doc.grpHdr.created = new Date(); doc.grpHdr.initiatorName = "Example LLC"; @@ -89,7 +89,7 @@ Creating an XML Transfer Document ```javascript var SEPA = require("sepa"); -var doc = new SEPA.Document('pain.001.001.03'); +var doc = new SEPA.Document('pain.001.001.09'); doc.grpHdr.id = "XMPL.20140201.TR0"; doc.grpHdr.created = new Date(); doc.grpHdr.initiatorName = "Example LLC"; @@ -99,15 +99,12 @@ info.requestedExecutionDate = new Date(); info.debtorIBAN = "DE87123456781234567890"; info.debtorBIC = "XMPLDEM0XXX"; info.debtorName = "Example LLC"; -info.debtorId = "DE98ZZZ09999999999"; doc.addPaymentInfo(info); var tx = info.createTransaction(); tx.creditorName = "Example Customer"; tx.creditorIBAN = "DE40987654329876543210"; tx.creditorBIC = "CUSTDEM0XXX"; -tx.mandateId = "XMPL.CUST487.2014"; -tx.mandateSignatureDate = new Date("2014-02-01"); tx.amount = 50.23; tx.remittanceInfo = "INVOICE 54"; tx.end2endId = "XMPL.CUST487.INVOICE.54"; @@ -118,90 +115,100 @@ console.log(doc.toString()); ### XML Result ```xml - - - - - XMPL.20140201.TR0 - 2014-01-23T19:16:10.285Z - 1 - 50.23 - - Example LLC - - - - XMPL.20140201.TR0.0 - DD - true - 1 - 50.23 - - - SEPA - - - CORE - - FRST - - 2014-01-23 - - Example LLC - - - - DE87123456781234567890 - - - - - XMPLDEM0XXX - - - SLEV - - - - - DE98ZZZ09999999999 - - SEPA - - - - - - - - XMPL.CUST487.INVOICE.54 - - 50.23 - - - XMPL.CUST487.2014 - 2014-02-01 - false - - - - - CUSTDEM0XXX - - - - Example Customer - - - - DE40987654329876543210 - - - - INVOICE 54 - - - - + + + + + XMPL.20140201.TR0 + 2024-07-05T11:44:23 + 1 + 50.23 + + Example LLC + + + + XMPL.20140201.TR0.0 + DD + true + 1 + 50.23 + + + SEPA + + + CORE + + FRST + + 2024-07-05 + + Example LLC + + + + DE98ZZZ09999999999 + + + + + + + DE87123456781234567890 + + + + + XMPLDEM0XXX + + + SLEV + + + + + DE98ZZZ09999999999 + + SEPA + + + + + + + + XMPL.20140201.TR0.0.0 + XMPL.CUST487.INVOICE.54 + + 50.23 + + + XMPL.CUST487.2014 + 2014-02-01 + false + + + + + CUSTDEM0XXX + + + + Example Customer + + + + DE40987654329876543210 + + + + INVOICE 54 + + + + ``` diff --git a/lib/schema.test.js b/lib/schema.test.js new file mode 100644 index 0000000..0fdf061 --- /dev/null +++ b/lib/schema.test.js @@ -0,0 +1,96 @@ +var fs = require('fs'); +var SEPA = require('./sepa.js'); +var validateSchema = require('xsd-validator').default; + +expect.extend({ + toMatchSchema(xml, format) { + const schema = fs.readFileSync('schema/' + format + '.xsd'); + + const res = validateSchema(xml, schema); + + if (res === true) { + return { + message: () => + 'expected to match schema for ' + format, + pass: true, + }; + } else { + return { + message: () => + 'expected to match schema for ' + format + ': \n' + res.join('\n'), + pass: false, + }; + } + }, +}); + +describe('transfer schema validation tests', + () => { + test.each([ + 'pain.001.001.02', + 'pain.001.001.03', + 'pain.001.001.08', + 'pain.001.001.09', + ])('%p schema matches', (format) => { + var doc = new SEPA.Document(format); + doc.grpHdr.id = 'XMPL.20140201.TR0'; + doc.grpHdr.created = new Date(); + doc.grpHdr.initiatorName = 'Example LLC'; + + var info = doc.createPaymentInfo(); + info.requestedExecutionDate = new Date(); + info.debtorIBAN = 'DE87123456781234567890'; + info.debtorBIC = 'CUSTDEM0XXX'; + info.debtorName = 'Example LLC'; + doc.addPaymentInfo(info); + + var tx = info.createTransaction(); + tx.creditorName = 'Example Customer'; + tx.creditorIBAN = 'DE40987654329876543210'; + tx.creditorBIC = 'CUSTDEM0XXX'; + tx.amount = 50.23; + tx.remittanceInfo = 'INVOICE 54'; + tx.end2endId = 'XMPL.CUST487.INVOICE.54'; + info.addTransaction(tx); + + const validation = validateSchema(doc.toString(), fs.readFileSync('schema/' + format + '.xsd')); + expect(validation).toBe(true); + }); + }); + +describe('direct debit validation tests', + () => { + test.each([ + 'pain.008.001.02', + 'pain.008.001.08', + ])('%p schema matches', (format) => { + var doc = new SEPA.Document(format); + doc.grpHdr.id = 'XMPL.20140201.TR0'; + doc.grpHdr.created = new Date(); + doc.grpHdr.initiatorName = 'Example LLC'; + + var info = doc.createPaymentInfo(); + info.collectionDate = new Date(); + info.creditorIBAN = 'DE87123456781234567890'; + info.creditorBIC = 'XMPLDEM0XXX'; + info.creditorName = 'Example LLC'; + info.creditorId = 'DE98ZZZ09999999999'; + info.batchBooking = true; //optional + doc.addPaymentInfo(info); + + var tx = info.createTransaction(); + tx.debtorName = 'Example Customer'; + tx.debtorIBAN = 'DE40987654329876543210'; + tx.debtorBIC = 'CUSTDEM0XXX'; + tx.mandateId = 'XMPL.CUST487.2014'; + tx.mandateSignatureDate = new Date('2014-02-01'); + tx.amount = 50.23; + tx.currency = 'EUR'; //optional + tx.remittanceInfo = 'INVOICE 54'; + tx.end2endId = 'XMPL.CUST487.INVOICE.54'; + info.addTransaction(tx); + + const validation = validateSchema(doc.toString(), fs.readFileSync('schema/' + format + '.xsd')); + expect(validation).toBe(true); + }); + }); diff --git a/lib/sepa.js b/lib/sepa.js index 72d5d1d..d197da3 100644 --- a/lib/sepa.js +++ b/lib/sepa.js @@ -46,13 +46,11 @@ var SEPATypes = { 'pain.001.001.02': 'pain.001.001.02', - 'pain.001.003.02': 'pain.001.003.02', 'pain.001.001.03': 'CstmrCdtTrfInitn', - 'pain.001.003.03': 'CstmrCdtTrfInitn', - 'pain.008.001.01': 'pain.008.001.01', - 'pain.008.003.01': 'pain.008.003.01', + 'pain.001.001.08': 'CstmrCdtTrfInitn', + 'pain.001.001.09': 'CstmrCdtTrfInitn', 'pain.008.001.02': 'CstmrDrctDbtInitn', - 'pain.008.003.02': 'CstmrDrctDbtInitn' + 'pain.008.001.08': 'CstmrDrctDbtInitn', }; function getPainXMLVersion(painFormat) { @@ -399,7 +397,7 @@ r(pmtInf, 'PmtInfId', this.id); r(pmtInf, 'PmtMtd', this.method); // XML v3 formats, add grouping + batch booking nodes - if (getPainXMLVersion(this._painFormat) === 3) { + if (getPainXMLVersion(this._painFormat) >= 3) { r(pmtInf, 'BtchBookg', this.batchBooking.toString()); r(pmtInf, 'NbOfTxs', this.transactionCount); r(pmtInf, 'CtrlSum', this.controlSum.toFixed(2)); @@ -414,7 +412,12 @@ r(pmtInf, 'ReqdColltnDt', this.collectionDate.toISOString().substr(0, 10)); } else { - r(pmtInf, 'ReqdExctnDt', this.requestedExecutionDate.toISOString().substr(0, 10)); + if (getPainXMLVersion(this._painFormat) >= 8) { + var reqdExctnDt = n(pmtInf, 'ReqdExctnDt'); + r(reqdExctnDt, 'Dt', this.requestedExecutionDate.toISOString().substr(0, 10)); + } else { + r(pmtInf, 'ReqdExctnDt', this.requestedExecutionDate.toISOString().substr(0, 10)); + } } var pullFrom = this.method === PaymentInfoTypes.DirectDebit ? 'creditor' : 'debtor'; @@ -423,7 +426,8 @@ r(emitter, 'Nm', this[pullFrom + 'Name']); if (this[pullFrom + 'Id']) { - r(emitter, 'Id', this[pullFrom + 'Id']); + var id = n(emitter, 'Id', 'PrvtId', 'Othr', 'Id'); + r(id, this[pullFrom + 'Id']); } if (this[pullFrom + 'Street'] && this[pullFrom + 'City'] && this[pullFrom + 'Country']) { @@ -435,7 +439,7 @@ r(pmtInf, emitterNodeName + 'Acct', 'Id', 'IBAN', this[pullFrom + 'IBAN']); if (this[pullFrom + 'BIC']) { - r(pmtInf, emitterNodeName + 'Agt', 'FinInstnId', 'BIC', this[pullFrom + 'BIC']); + r(pmtInf, emitterNodeName + 'Agt', 'FinInstnId', getPainXMLVersion(this._painFormat) >= 8 ? 'BICFI' : 'BIC', this[pullFrom + 'BIC']); } else { r(pmtInf, emitterNodeName + 'Agt', 'FinInstnId', 'Othr', 'Id', 'NOTPROVIDED'); } @@ -538,9 +542,11 @@ assert_range(this.amount, 0.01, 999999999.99, 'amount'); assert(this.amount == this.amount.toFixed(2), 'amount has too many fractional digits'); assert_length(this.purposeCode, 1, 4, 'purposeCode'); - assert_valid_sepa_id(this.mandateId, 35, 'mandateId', CHARSET_VALIDATION_ENABLED); - assert_date(this.mandateSignatureDate, 'mandateSignatureDate'); + if(this._type === TransactionTypes.DirectDebit) { + assert_valid_sepa_id(this.mandateId, 35, 'mandateId', CHARSET_VALIDATION_ENABLED); + assert_date(this.mandateSignatureDate, 'mandateSignatureDate'); + } assert_length(this[pullFrom + 'Name'], null, 70, pullFrom + 'Name'); assert_length(this[pullFrom + 'Street'], null, 70, pullFrom + 'Street'); @@ -599,7 +605,7 @@ } if (this[pullFrom + 'BIC']) { - r(txInf, recieverNodeName + 'Agt', 'FinInstnId', 'BIC', this[pullFrom + 'BIC']); + r(txInf, recieverNodeName + 'Agt', 'FinInstnId', getPainXMLVersion(this._painFormat) >= 8 ? 'BICFI' : 'BIC', this[pullFrom + 'BIC']); } else { r(txInf, recieverNodeName + 'Agt', 'FinInstnId', 'Othr', 'Id', 'NOTPROVIDED'); } diff --git a/lib/sepa.test.js b/lib/sepa.test.js index a632852..853765c 100644 --- a/lib/sepa.test.js +++ b/lib/sepa.test.js @@ -38,7 +38,7 @@ describe('IBAN tests', }); describe('xml generation for transfer documents', () => { - const PAIN_FOR_TRANSFERS = 'pain.001.003.03'; + const PAIN_FOR_TRANSFERS = 'pain.001.001.09'; function validTransferDocument({ debtorId=A_VALID_CREDITOR_ID, @@ -267,7 +267,7 @@ describe('xml generation for transfer documents', () => { }); describe('xml generation for direct debit documents', () => { - const PAIN_FOR_DIRECT_DEBIT = 'pain.008.001.02'; + const PAIN_FOR_DIRECT_DEBIT = 'pain.008.001.08'; function validDirectDebitDocument({creditorId=A_VALID_CREDITOR_ID}) { var doc = new SEPA.Document(PAIN_FOR_DIRECT_DEBIT); doc.grpHdr.created = new Date(); diff --git a/package-lock.json b/package-lock.json index d4d8ebc..f5c4784 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,8 @@ "jest": "^29.7.0", "pre-commit": "*", "uglify-js": "^3.3.20", - "xpath": "^0.0.33" + "xpath": "^0.0.33", + "xsd-validator": "^1.1.1" }, "engines": { "node": "*" @@ -1214,6 +1215,62 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@mapbox/node-pre-gyp": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz", + "integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==", + "dev": true, + "dependencies": { + "detect-libc": "^2.0.0", + "https-proxy-agent": "^5.0.0", + "make-dir": "^3.1.0", + "node-fetch": "^2.6.7", + "nopt": "^5.0.0", + "npmlog": "^5.0.1", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "tar": "^6.1.11" + }, + "bin": { + "node-pre-gyp": "bin/node-pre-gyp" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/make-dir/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/semver": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -1591,6 +1648,12 @@ "node": ">=10.0.0" } }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, "node_modules/acorn": { "version": "8.11.2", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", @@ -1612,6 +1675,18 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -1692,6 +1767,40 @@ "node": ">= 8" } }, + "node_modules/aproba": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", + "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", + "dev": true + }, + "node_modules/are-we-there-yet": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz", + "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==", + "deprecated": "This package is no longer supported.", + "dev": true, + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/are-we-there-yet/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -1820,6 +1929,12 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/bindings": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.1.tgz", + "integrity": "sha512-i47mqjF9UbjxJhxGf+pZ6kSxrnI3wBLlnGI2ArWJ4r0VrvDS7ZYXkprq/pLaBWYq4GM0r4zdHY+NNRqEMU7uew==", + "dev": true + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1952,6 +2067,15 @@ "node": ">=10" } }, + "node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/ci-info": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", @@ -2021,6 +2145,15 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/color-support": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", + "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", + "dev": true, + "bin": { + "color-support": "bin.js" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -2042,6 +2175,12 @@ "typedarray": "^0.0.6" } }, + "node_modules/console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", + "dev": true + }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", @@ -2135,6 +2274,21 @@ "node": ">=0.10.0" } }, + "node_modules/delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", + "dev": true + }, + "node_modules/detect-libc": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", + "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -2583,6 +2737,36 @@ "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", "dev": true }, + "node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fs-minipass/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -2612,6 +2796,27 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/gauge": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", + "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==", + "deprecated": "This package is no longer supported.", + "dev": true, + "dependencies": { + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.2", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.1", + "object-assign": "^4.1.1", + "signal-exit": "^3.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.2" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -2739,6 +2944,12 @@ "node": ">=8" } }, + "node_modules/has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", + "dev": true + }, "node_modules/hasown": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", @@ -2757,6 +2968,19 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -3727,6 +3951,21 @@ "node": ">= 0.8.0" } }, + "node_modules/libxmljs": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/libxmljs/-/libxmljs-1.0.11.tgz", + "integrity": "sha512-ChqXkhZuvhbjariwPakKs/h+dF5Pe7j+QJ/PmTidzx7mDiFa5chhy7806PQiO+VnBJZ5mVLVq4Dk+W7fZP6luw==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "@mapbox/node-pre-gyp": "^1.0.9", + "bindings": "~1.3.0", + "nan": "^2.17.0" + }, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", @@ -3870,18 +4109,96 @@ "node": "*" } }, + "node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minizlib/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "node_modules/nan": { + "version": "2.20.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.20.0.tgz", + "integrity": "sha512-bk3gXBZDGILuuo/6sKtr0DQmSThYHLtNCdSdXk9YkxD/jK6X2vmCyyXBBxyqZ4XcnzTyYEAThfX3DCEnLf6igw==", + "dev": true + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dev": true, + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -3894,6 +4211,21 @@ "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", "dev": true }, + "node_modules/nopt": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "dev": true, + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -3915,6 +4247,28 @@ "node": ">=8" } }, + "node_modules/npmlog": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz", + "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==", + "deprecated": "This package is no longer supported.", + "dev": true, + "dependencies": { + "are-we-there-yet": "^2.0.0", + "console-control-strings": "^1.1.0", + "gauge": "^3.0.0", + "set-blocking": "^2.0.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -4477,6 +4831,12 @@ "semver": "bin/semver.js" } }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", + "dev": true + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -4678,6 +5038,29 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/tar": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "dev": true, + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/tar/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -4725,6 +5108,12 @@ "node": ">=8.0" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true + }, "node_modules/tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", @@ -4885,6 +5274,22 @@ "makeerror": "1.0.12" } }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -4900,6 +5305,15 @@ "node": ">= 8" } }, + "node_modules/wide-align": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", + "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", + "dev": true, + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -4945,6 +5359,18 @@ "node": ">=0.6.0" } }, + "node_modules/xsd-validator": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/xsd-validator/-/xsd-validator-1.1.1.tgz", + "integrity": "sha512-gHpPtBJ7B7mQOwP+ZT91kt2qLdK/Ek3jGZNl3Rz5pu5z4j/Nn6OWfEI17W26VoqDEqaptuU3WvjwLbP9TLCFKg==", + "dev": true, + "dependencies": { + "libxmljs": "^1.0.9" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", diff --git a/package.json b/package.json index 4e9c7cf..a48c657 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "jest": "^29.7.0", "pre-commit": "*", "uglify-js": "^3.3.20", - "xpath": "^0.0.33" + "xpath": "^0.0.33", + "xsd-validator": "^1.1.1" }, "engines": { "node": "*" diff --git a/schema/pain.001.001.02.xsd b/schema/pain.001.001.02.xsd new file mode 100644 index 0000000..43529da --- /dev/null +++ b/schema/pain.001.001.02.xsd @@ -0,0 +1,784 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/schema/pain.001.001.03.xsd b/schema/pain.001.001.03.xsd new file mode 100644 index 0000000..8649779 --- /dev/null +++ b/schema/pain.001.001.03.xsd @@ -0,0 +1,921 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/schema/pain.001.001.08.xsd b/schema/pain.001.001.08.xsd new file mode 100644 index 0000000..25b1182 --- /dev/null +++ b/schema/pain.001.001.08.xsd @@ -0,0 +1,1036 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/schema/pain.001.001.09.xsd b/schema/pain.001.001.09.xsd new file mode 100644 index 0000000..555d5b6 --- /dev/null +++ b/schema/pain.001.001.09.xsd @@ -0,0 +1,1114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/schema/pain.008.001.02.xsd b/schema/pain.008.001.02.xsd new file mode 100644 index 0000000..6335972 --- /dev/null +++ b/schema/pain.008.001.02.xsd @@ -0,0 +1,879 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/schema/pain.008.001.08.xsd b/schema/pain.008.001.08.xsd new file mode 100644 index 0000000..91f5231 --- /dev/null +++ b/schema/pain.008.001.08.xsd @@ -0,0 +1,1106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 58fbb2889c2d5f21552f6fefc3226fa8b31ebb02 Mon Sep 17 00:00:00 2001 From: Hanno Fellmann Date: Sat, 6 Jul 2024 08:37:58 +0200 Subject: [PATCH 2/2] remove outdated creditor id --- lib/sepa.js | 8 ++------ lib/sepa.test.js | 26 ++------------------------ 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/lib/sepa.js b/lib/sepa.js index d197da3..10ffd9b 100644 --- a/lib/sepa.js +++ b/lib/sepa.js @@ -199,7 +199,7 @@ r(grpHdr, 'MsgId', this.id); r(grpHdr, 'CreDtTm', this.created.toISOString().substr(0,19)); - // XML v2 formats, add grouping + batch booking nodes + // XML >= v2 formats, add batch booking nodes if (painVersion === 2) { r(grpHdr, 'BtchBookg', this.batchBooking.toString()); } @@ -207,7 +207,7 @@ r(grpHdr, 'NbOfTxs', this.transactionCount); r(grpHdr, 'CtrlSum', this.controlSum.toFixed(2)); - // XML v2 formats, add grouping + batch booking nodes + // XML v2 formats, add grouping booking nodes if (painVersion === 2) { r(grpHdr, 'Grpg', this.grouping); } @@ -425,10 +425,6 @@ var emitter = n(pmtInf, emitterNodeName); r(emitter, 'Nm', this[pullFrom + 'Name']); - if (this[pullFrom + 'Id']) { - var id = n(emitter, 'Id', 'PrvtId', 'Othr', 'Id'); - r(id, this[pullFrom + 'Id']); - } if (this[pullFrom + 'Street'] && this[pullFrom + 'City'] && this[pullFrom + 'Country']) { var pstl = n(emitter, 'PstlAdr'); diff --git a/lib/sepa.test.js b/lib/sepa.test.js index 853765c..f3fc68b 100644 --- a/lib/sepa.test.js +++ b/lib/sepa.test.js @@ -103,7 +103,7 @@ describe('xml generation for transfer documents', () => { expect(debtorId).toBeUndefined(); }); - test('debtor name and id are included in transfer documents when they are set', () => { + test('debtor name is included in transfer documents when it is set', () => { // GIVEN const doc = validTransferDocument({debtorId: 'FR72ZZZ123456', debtorName: 'debtor-name'}); @@ -118,28 +118,6 @@ describe('xml generation for transfer documents', () => { const debtorName = select('/p:Document/p:CstmrCdtTrfInitn/p:PmtInf/p:Dbtr/p:Nm', dom, true); expect(debtorName).not.toBeUndefined(); expect(debtorName.textContent).toBe('debtor-name'); - - const debtorId = select('/p:Document/p:CstmrCdtTrfInitn/p:PmtInf/p:Dbtr/p:Id', dom, true); - expect(debtorId).not.toBeUndefined(); - expect(debtorId.textContent).toBe('FR72ZZZ123456'); - }); - - test('dutch debtor ids are accepted', () => { - // GIVEN - const validDutchCreditorId = 'NL79ZZZ999999990000'; - const doc = validTransferDocument({debtorId: validDutchCreditorId}); - - // WHEN - const dom = doc.toXML(); - - // THEN - const select = xpath.useNamespaces({ - p: `urn:iso:std:iso:20022:tech:xsd:${PAIN_FOR_TRANSFERS}`, - }); - - const debtorId = select('/p:Document/p:CstmrCdtTrfInitn/p:PmtInf/p:Dbtr/p:Id', dom, true); - expect(debtorId).not.toBeUndefined(); - expect(debtorId.textContent).toBe(validDutchCreditorId); }); test('detects invalid characters for end2endId', () => { @@ -299,7 +277,7 @@ describe('xml generation for direct debit documents', () => { p: `urn:iso:std:iso:20022:tech:xsd:${PAIN_FOR_DIRECT_DEBIT}`, }); - const creditorId = select('/p:Document/p:CstmrDrctDbtInitn/p:PmtInf/p:Cdtr/p:Id', dom, true); + const creditorId = select('/p:Document/p:CstmrDrctDbtInitn/p:PmtInf/p:CdtrSchmeId/p:Id/p:PrvtId/p:Othr/p:Id', dom, true); expect(creditorId).not.toBeUndefined(); expect(creditorId.textContent).toBe('IT66ZZZA1B2C3D4E5F6G7H8'); });