@@ -160,7 +160,7 @@ class FinTSClientMode(Enum):
160160class FinTS3Client :
161161 def __init__ (self ,
162162 bank_identifier , user_id , customer_id = None ,
163- from_data : bytes = None ,
163+ from_data : bytes = None , system_id = None ,
164164 product_id = None , product_version = version [:5 ],
165165 mode = FinTSClientMode .INTERACTIVE ):
166166 self .accounts = []
@@ -170,7 +170,7 @@ def __init__(self,
170170 self .bank_identifier = BankIdentifier (BankIdentifier .COUNTRY_ALPHA_TO_NUMERIC ['DE' ], bank_identifier )
171171 else :
172172 raise TypeError ("bank_identifier must be BankIdentifier or str (BLZ)" )
173- self .system_id = SYSTEM_ID_UNASSIGNED
173+ self .system_id = system_id or SYSTEM_ID_UNASSIGNED
174174 if not product_id :
175175 raise TypeError ("The product_id keyword argument is mandatory starting with python-fints version 4. See "
176176 "https://python-fints.readthedocs.io/en/latest/upgrading_3_4.html for more information." )
@@ -1158,8 +1158,15 @@ def _new_dialog(self, lazy_init=False):
11581158 )
11591159
11601160 def fetch_tan_mechanisms (self ):
1161- self .set_tan_mechanism ('999' )
1162- self ._ensure_system_id ()
1161+ if self .system_id and not self .get_current_tan_mechanism ():
1162+ # system_id was persisted and given to the client, but nothing else
1163+ self .set_tan_mechanism ('999' )
1164+ with self ._get_dialog (lazy_init = True ) as dialog :
1165+ response = dialog .init ()
1166+ self .process_response_message (dialog , response , internal_send = True )
1167+ else :
1168+ self .set_tan_mechanism ('999' )
1169+ self ._ensure_system_id ()
11631170 if self .get_current_tan_mechanism ():
11641171 # We already got a reply through _ensure_system_id
11651172 return self .get_current_tan_mechanism ()
0 commit comments