Skip to content

Structured remittance info invalid when validated against the XSD #226

Description

@xuannghia

Hello,
I am using this library to generate a file in the pain.001.001.09 format, and I’ve noticed that the file is invalid when validated against the XSD schema.
I only changed the remittanceInfo from the default test value to structuredRemittanceInfo.
Could you please help to check it?

describe('transfer schema validation tests with structured remittance info',
  () => {
    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.structuredRemittanceInfo = {
        type: 'SCOR',
        issuer: 'ISO',
        reference: '500234326411'
      };

      tx.end2endId = 'XMPL.CUST487.INVOICE.54';
      info.addTransaction(tx);

      const validation = validateSchema(doc.toString(), fs.readFileSync('schema/' + format + '.xsd'));
      expect(validation).toBe(true);
    });
  });

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions