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/>
(basic-form iban)
generic-function
RETURN: The basic form of the IBAN.
(check-country self)
generic-function
DO:     Checks the country code in the basic-form,
        and raises an error if not valid.
RAISE:  IBAN-ERROR
RETURN: SELF
(check-iban-key iban)
function
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)
function
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.
(get-and-check-alphanum self string &optional length)
generic-function
Check that STRING contains only alphanumeric character valid in an IBAN.
(get-country-code self)
generic-function
RETURN: The country code in the IBAN.
(get-iban self &key with-spaces)
generic-function
RETURN: The IBAN as a string, with spaces inserted when WITH-SPACES is
        true, else in basic form.
(get-key self)
generic-function
RETURN: The computed key of the IBAN.
iban
class
The Internationnal Bank Account Number class.
Class precedence list: IBAN STANDARD-OBJECT T
Class init args: BASIC-FORM
iban-error
condition
An IBAN error.
Class precedence list: IBAN-ERROR SIMPLE-ERROR SIMPLE-CONDITION ERROR SERIOUS-CONDITION CONDITION STANDARD-OBJECT T
Class init args: FORMAT-CONTROL FORMAT-ARGUMENTS
(set-iban self iban &key with-key)
generic-function
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.