# stdnum.es.ccc

CCC (Código Cuenta Corriente, Spanish Bank Account Code)

CCC code is the country-specific part in Spanish IBAN codes. In order to fully validate an Spanish IBAN you have to validate as well the country specific part as a valid CCC. It was used for home banking transactions until February 1st 2014 when IBAN codes started to be used as an account ID.

The CCC has 20 digits, all being numbers: EEEE OOOO DD NNNNNNNNNN

- EEEE: banking entity
- OOOO: office
- DD: check digits
- NNNNN NNNNN: account identifier

This module does not check if the bank code to exist. Existing bank codes are published on the ‘Registro de Entidades’ by ‘Banco de España’ (Spanish Central Bank).

More information:

- https://es.wikipedia.org/wiki/Código_cuenta_cliente
- http://www.bde.es/bde/es/secciones/servicios/Particulares_y_e/Registros_de_Ent/

    >>> validate('1234-1234-16 1234567890')
    '12341234161234567890'
    >>> validate('134-1234-16 1234567890')  # wrong length
    Traceback (most recent call last):
        ...
    InvalidLength: ...
    >>> validate('12X4-1234-16 1234567890')  # non numbers
    Traceback (most recent call last):
        ...
    InvalidFormat: ...
    >>> validate('1234-1234-00 1234567890')  # invalid check digits
    Traceback (most recent call last):
        ...
    InvalidChecksum: ...
    >>> format('12341234161234567890')
    '1234 1234 16 12345 67890'
    >>> to_iban('21000418450200051331')
    'ES2121000418450200051331'

`stdnum.es.ccc.``calc_check_digits`(number)

  Calculate the check digits for the number. The supplied number should have check digits included but are ignored.

`stdnum.es.ccc.``compact`(number)

  Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

`stdnum.es.ccc.``format`(number)

  Reformat the number to the standard presentation format.

`stdnum.es.ccc.``is_valid`(number)

  Check if the number provided is a valid CCC.

`stdnum.es.ccc.``to_iban`(number)

  Convert the number to an IBAN.

`stdnum.es.ccc.``validate`(number)

  Check if the number provided is a valid CCC.