English Deutsch

Dokumentation fintech.iban

IBAN module of the Python Fintech package.

This module defines functions to check IBANs and BICs and querying bank data from the SCL directory, published by the German Central Bank.

Index
fintech.iban.check_iban(iban, bic=None, country=None, sepa=False)

Checks an IBAN for validity.

Parameters
  • iban – The IBAN to be checked.
  • bic – If given, IBAN and BIC are checked in the context of each other.
  • country – If given, the IBAN is checked in the context of this country. Must be an ISO-3166 ALPHA 2 code.
  • sepa – If sepa evaluates to True, the IBAN is checked to be valid in the Single Euro Payments Area.
Returns
True on validity, False otherwise.
fintech.iban.create_iban(bankcode, account, bic=False)

Creates an IBAN from a German bank code and account number.

The kontocheck package is required to perform this function. Otherwise a RuntimeError is raised.

Deprecated, use function create_iban() of the kontocheck library. Will be removed in version 8.

Parameters
  • bankcode – The German bank code.
  • account – The account number.
  • bic – Flag if the corresponding BIC should be returned as well.
Returns
Either the IBAN or a 2-tuple in the form of (IBAN, BIC).
fintech.iban.check_bic(bic, country=None, scl=False)

Checks a BIC for validity.

Parameters
  • bic – The BIC to be checked.
  • country – If given, the BIC is checked in the context of this country. Must be an ISO-3166 ALPHA 2 code.
  • scl – If set to True, the BIC is checked for occurrence in the SEPA Clearing Directory, published by the German Central Bank. If set to a value of SCT, SDD, COR1, B2B, or SCC, the BIC is also checked to be valid for this payment order type. Up to v7.8.x the kontocheck package was required to use this option.
Returns
True on validity, False otherwise.
fintech.iban.get_bic(iban)

Returns the corresponding BIC for the given IBAN. The following countries are supported: DE, AT, CH.

Up to v7.8.x the kontocheck package was required to use this function.

fintech.iban.parse_iban(iban)

Splits a given IBAN into its fragments.

Returns a 4-tuple in the form of (COUNTRY, CHECKSUM, BANK_CODE, ACCOUNT_NUMBER)

fintech.iban.get_bankname(iban_or_bic)

Returns the bank name of a given European BIC or IBAN. In case of an IBAN the following countries are supported: DE, AT, CH.

Up to v7.8.x the kontocheck package was required to use this function.

fintech.iban.get_routing(iban_or_bic)

Returns a dictionary with the SEPA routing information for the given European BIC or IBAN from the SCL Directory. In case of an IBAN the following countries are supported: DE, AT, CH. New since v7.9.0

Available keys:

  • SCT: SEPA Credit Transfer
  • SDD: SEPA Direct Debit (COR)
  • COR1: SEPA Direct Debit (COR1, deprecated)
  • B2B: SEPA Direct Debit (B2B)
  • SCC: SEPA Card Clearing
  • NAME: Bank name
fintech.iban.load_bankcodes(path, clear=False)

Loads mappings from domestic bankcodes to BICs from the file specified by path. If clear evaluates to True, the initial loaded mapping table will be purged. New since v7.9.0

fintech.iban.load_scl_data(path, clear=False)

Loads the SCL Directory from the file specified by path. If clear evaluates to True, the initial loaded SCL Directory will be purged. New since v7.9.0