Skip to content

IBAN Validation fails although data is valid according to XSD #163

@DannyvdSluijs

Description

@DannyvdSluijs

Introduction

The urn:iso:std:iso:20022:tech:xsd:camt.053.001.12 XSD describes the IBAN2007Identifier as follows:

    <xs:simpleType name="IBAN2007Identifier">
        <xs:restriction base="xs:string">
            <xs:pattern value="[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}"/>
        </xs:restriction>
    </xs:simpleType>

Problem

Which states that an IBAN is a string valid according to the regex [A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}. This makes that a value like ZZ12345678901234SOMEASCIITEXT is valid according to the XSD. (This exact value didn't occur in a file but the same pattern was observed).

There is a change this is an issue at the banking software, however currently this lib validates the IBAN as being valid when parsing the file. This poses several issues:

  • This library does something beyond what is in the specification
  • Throws an exception while parsing the file when an invalid IBAN is encountered, resulting in an unreadable file

Possible solutions

  • The obvious solution is removing the IBAN validation, but this could have a high impact on other users who might be unaware of such a change.
  • Another option might be to provide context/config in order to indicate if you want to validate the IBAN or if your need is to be willing to accept unvalidated values (and thus possible accept invalid IBAN values)
  • A third option is to make the validation lazy e.g. only validating the IBAN value when invoking getIban or __toString() methods. As this would allow to wrap those methods being invoked in a try-catch block at level where this library is being used.

Before starting to work on a pull request it might be best to pick a solution direction before putting in any effort.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions