Common Lisp Package: COM.INFORMATIMAGO.COMMON-LISP.BANK.IBAN

This class is an Internationnal Bank Account Number, according to the European standard: IBAN Format: <http://www.ecbs.org/iban/iban.htm> To create find the IBAN given an account number with a country-code: (make-instance 'iban :basic-form (remove #\space (format nil "~2A00~A" country-code account))) this will compute the IBAN key, and print the IBAN instance. To get the IBAN as a string with groups separated by spaces: (com.informatimago.common-lisp.bank.iban:get-iban iban :with-spaces t) License: AGPL3 Copyright Pascal J. Bourguignon 1994 - 2012 This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>

README:

FUNCTION

Public

CHECK-IBAN-KEY (IBAN)

DO: Check the IBAN KEY The IBAN string must be in basic format, all non alphanumeric characters removed. 0- move the first four characters of the IBAN to the end. 1- convert the letters into numerics. 2- apply MOD 97-10 (ISO 7064) : remainder of n by 97 must be 1 3- return T when the IBAN key checks. RETURN: Whether the IBAN key checks.

COMPUTE-IBAN-KEY (COUNTRY ACCOUNT)

DO: Compute the IBAN key for the given ACCOUNT. ACCOUNT must be in basic format, all non alphanumeric characters removed. 0- create artificial IBAN with 00 check sum. 1- move the first four characters of the IBAN to the end. 2- convert the letters into numerics. 3- apply MOD 97-10 (ISO 7064): check sum is 98 - n mod 97. 4- return the complete IBAN. RETURN: The new complete IBANA.

Private

COUNTRY-CODES

Returns a list of 2-letter country codes.

GENERIC-FUNCTION

Public

CHECK-COUNTRY (SELF)

DO: Checks the country code in the basic-form, and raises an error if not valid. RAISE: IBAN-ERROR RETURN: SELF

GET-AND-CHECK-ALPHANUM (SELF STRING &OPTIONAL LENGTH)

Check that STRING contains only alphanumeric character valid in an IBAN.

GET-COUNTRY-CODE (SELF)

RETURN: The country code in the IBAN.

GET-IBAN (SELF &KEY WITH-SPACES (WITH-SPACES NIL))

RETURN: The IBAN as a string, with spaces inserted when WITH-SPACES is true, else in basic form.

GET-KEY (SELF)

RETURN: The computed key of the IBAN.

SET-IBAN (SELF IBAN &KEY WITH-KEY (WITH-KEY NIL))

DO: Change the IBAN. If WITH-KEY is true then the IBAN key is checked and an error raised if it is not valid, else the IBAN key is computed and substituted. RETURN: SELF SIGNAL: An IBAN-ERROR when with-key and the key in the IBAN is incorrect.

SLOT-ACCESSOR

Public

BASIC-FORM (IBAN)

The RETURN: The basic form of the IBAN.

VARIABLE

Private

*COUNTRY-CODES*

List of 2-letter country codes.

Undocumented

+ALPHABET-FROM+

CLASS

Public

IBAN

The Internationnal Bank Account Number class.

CONDITION

Public

IBAN-ERROR

An IBAN error.