1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
import json
import openpyxl
data = {}
data["databases"] = []
BLZ = 1
BIC = 2
INSTITUTE = 3
CITY = 4
ORGANIZATION = 6
URL = 24
def get_logo(bank: str) -> str:
if bank in ('dsgv', 'bvr', 'comdirect', 'dkb'):
return bank
return "bank"
# Open official list
wb = openpyxl.load_workbook("fints_institute.xlsx", data_only=True)
worksheet = wb["fints_institute_Master"]
for row in worksheet.iter_rows(min_row=2):
if row[BLZ].value:
data["databases"].append(
{
"blz": row[BLZ].value,
"bic": str(row[BIC].value).lower(),
"institute": row[INSTITUTE].value,
"logo": get_logo(
"comdirect"
if "comdirect" in row[INSTITUTE].value.lower()
else (
row[ORGANIZATION].value.lower()
if row[ORGANIZATION].value
else ""
)
),
"url": row[URL].value,
"city": row[CITY].value,
}
)
# Add custom entries
# TODO: Consider automatically checking for missing entries in:
# https://github.com/aqbanking/aqbanking/blob/23ea0303a999e87656f992f2f479dcf75ade8113/
# src/libs/plugins/bankinfo/generic/de.tar.bz2
for i in ("66", "77", "88", "99"):
data["databases"].append(
{
"blz": "200411" + i,
"bic": "cobadehd0" + i,
"institute": "comdirect bank AG",
"logo": "comdirect",
"url": "https://fints.comdirect.de/fints",
"city": "Quickborn",
}
)
# Demo data for testing purpose
data["databases"].append(
{
"blz": "00000000",
"bic": "",
"institute": "Demo Bank",
"logo": "bank",
"url": "http://0.0.0.0",
"city": "Virtual",
}
)
with open("resources/database.json", "w") as outfile:
json.dump(data, outfile)
|