byrokrat / banking

Data types and factories for bank accounts in the swedish banking system, Handelsbanken, ICA-banken, Nordea, SEB, Skandiabanken, Swedbank, PlusGirot, Bankgirot among others.
The Unlicense
11 stars 10 forks source link

Let AccountFactory suggest valid account numbers when parsing fails #9

Closed hanneskod closed 7 years ago

hanneskod commented 8 years ago

This lib imposes some restrictions on the format of account numbers that users may or may not be aware of. For example the clearing and serial numbers are separated by a comma:

1234,123456

A common misstake is to use a dash as a clearing-serial-separator:

1234-123456

If transforming a dah to a comma makes an unvalid account number valid AccountFactory could suggest doing so..

Another use case where this could be helpful would be incorrect usage of the clearing checkdigit in swedbank account numbers. If treating the first digit of the serial number as a clearing checkdigit transforms an unvalid account number into a valid one AccountFactory could suggest doing so as well..

This:

1234,123456

Into this:

1234-1,23456

More situations where this could be implemented?