From edf3ba6a698d6779f5ef73e631df04c426f4430e Mon Sep 17 00:00:00 2001 From: AlexanderF123 <114923541+AlexanderF123@users.noreply.github.com> Date: Thu, 21 May 2026 17:41:51 +0200 Subject: [PATCH 1/2] Add pyproject.toml for kefiya project setup --- pyproject.toml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..cbdc322 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,19 @@ +[project] +name = "kefiya" +authors = [ + { name = "Phamos GmbH", email = "info@phamos.eu" }, +] +description = "FinTS Connector for ERPNext (Germany)" +requires-python = ">=3.10" +readme = "README.md" +dynamic = ["version"] +dependencies = [ + "fints==5.0.0b1" +] + +[build-system] +requires = ["flit_core >=3.4,<4"] +build-backend = "flit_core.buildapi" + +[tool.flit.module] +name = "kefiya" From 5b5fc0887bd1e6a0501e58328cecf49cad28e935 Mon Sep 17 00:00:00 2001 From: AlexanderF123 <114923541+AlexanderF123@users.noreply.github.com> Date: Sat, 30 May 2026 20:50:41 +0200 Subject: [PATCH 2/2] Fix MT940 import path: use old_kefiya_import + flatten transactions Phamos kefiya_import() erwartet CAMT-Format; FinTS liefert aber MT940 via mt940.JSONEncoder. Switch zu old_kefiya_import + defensives Flatten. --- kefiya/utils/fints_controller_legacy.py | 36 ++++++++++++++++++++----- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/kefiya/utils/fints_controller_legacy.py b/kefiya/utils/fints_controller_legacy.py index 10d5351..b92501f 100644 --- a/kefiya/utils/fints_controller_legacy.py +++ b/kefiya/utils/fints_controller_legacy.py @@ -237,14 +237,38 @@ def import_fints_transactions(self, kefiya_import): # curr_doc.start_date = tansactions[0]["date"] # curr_doc.end_date = tansactions[-1]["date"] - first_txn = tansactions[0][0] - last_txn = tansactions[0][-1] + # PATCH: tansactions kann verschachtelt oder flach sein - normalisieren +if tansactions and isinstance(tansactions[0], list): + flat = [] + for entry in tansactions: + if isinstance(entry, list): + flat.extend(entry) + else: + flat.append(entry) + tansactions = flat + +# PATCH: Debug-Log fuer Diagnose (kann spaeter entfernt werden) +try: + frappe.log_error( + title="Kefiya FinTS Debug", + message="Count={} Type={} Sample={}".format( + len(tansactions), + type(tansactions[0]).__name__ if tansactions else 'N/A', + str(tansactions[0])[:500] if tansactions else 'empty' + ) + ) +except Exception: + pass + +first_txn = tansactions[0] +last_txn = tansactions[-1] - curr_doc.start_date = first_txn.get("date") or first_txn.get("ValueDate.Date") - curr_doc.end_date = last_txn.get("date") or last_txn.get("ValueDate.Date") +curr_doc.start_date = first_txn.get("date") or first_txn.get("ValueDate.Date") +curr_doc.end_date = last_txn.get("date") or last_txn.get("ValueDate.Date") - importer = ImportBankTransaction(self.kefiya_login, self.interactive) - importer.kefiya_import(tansactions) +importer = ImportBankTransaction(self.kefiya_login, self.interactive) +# PATCH: old_kefiya_import statt kefiya_import - MT940-Format-Handler fuer FinTS +importer.old_kefiya_import(tansactions) if len(importer.bank_transactions) == 0: frappe.msgprint(_("No new payments found"))