Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions fints/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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.")
Expand Down Expand Up @@ -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()
Expand Down
Loading