Dokumentation fintech.iban
IBAN module of the Python FinTech package.
This module defines functions to check and create IBANs.
Index- fintech.iban.check_iban(iban, bic=None, country=None, sepa=False)
Checks an IBAN for validity.
If the kontocheck package is available, for German IBANs the bank code and the checksum of the account number are checked as well.
- 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.
- 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, or B2B, SCC, the BIC is also checked to be valid for this payment order type. The kontocheck package is required for this option. Otherwise a RuntimeError is raised.
- Returns
True
on validity,False
otherwise.
- fintech.iban.get_bic(iban)
Returns the corresponding BIC for a given German IBAN.
The kontocheck package is required to perform this function. Otherwise a RuntimeError is raised.
- 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 German IBAN or European BIC. In the latter case the bank name is read from the SEPA Clearing Directory published by the German Central Bank.
The kontocheck package is required to perform this function. Otherwise a RuntimeError is raised.