From bdf06a219f7cb4f0677b49befb2bc87de5d807c6 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Mon, 7 Oct 2024 11:31:46 +0200 Subject: [PATCH 1/2] Allow to pass system ID --- fints/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fints/client.py b/fints/client.py index 7e1d3c9..704b025 100644 --- a/fints/client.py +++ b/fints/client.py @@ -160,7 +160,7 @@ class FinTSClientMode(Enum): class FinTS3Client: def __init__(self, bank_identifier, user_id, customer_id=None, - from_data: bytes=None, + from_data: bytes=None, system_id=None, product_id=None, product_version=version[:5], mode=FinTSClientMode.INTERACTIVE): self.accounts = [] @@ -170,7 +170,7 @@ def __init__(self, self.bank_identifier = BankIdentifier(BankIdentifier.COUNTRY_ALPHA_TO_NUMERIC['DE'], bank_identifier) else: raise TypeError("bank_identifier must be BankIdentifier or str (BLZ)") - self.system_id = SYSTEM_ID_UNASSIGNED + self.system_id = system_id or SYSTEM_ID_UNASSIGNED if not product_id: raise TypeError("The product_id keyword argument is mandatory starting with python-fints version 4. See " "https://python-fints.readthedocs.io/en/latest/upgrading_3_4.html for more information.") From 5def2a94feb3ebcf24308c85e5a48553ef81a8a7 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Sat, 26 Oct 2024 16:24:03 +0200 Subject: [PATCH 2/2] Fix TAN handshake --- fints/client.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fints/client.py b/fints/client.py index 704b025..3d8ecc6 100644 --- a/fints/client.py +++ b/fints/client.py @@ -1158,8 +1158,15 @@ def _new_dialog(self, lazy_init=False): ) def fetch_tan_mechanisms(self): - self.set_tan_mechanism('999') - self._ensure_system_id() + if self.system_id and not self.get_current_tan_mechanism(): + # system_id was persisted and given to the client, but nothing else + self.set_tan_mechanism('999') + with self._get_dialog(lazy_init=True) as dialog: + response = dialog.init() + self.process_response_message(dialog, response, internal_send=True) + else: + self.set_tan_mechanism('999') + self._ensure_system_id() if self.get_current_tan_mechanism(): # We already got a reply through _ensure_system_id return self.get_current_tan_mechanism()