]> git.ipfire.org Git - thirdparty/python-fints.git/commitdiff
Fix TAN request with response code 3955 during initialization of the dialog (#171)
authorJohannes Meyer <johannes@intermodalics.eu>
Sat, 26 Oct 2024 14:07:39 +0000 (16:07 +0200)
committerGitHub <noreply@github.com>
Sat, 26 Oct 2024 14:07:39 +0000 (16:07 +0200)
* Fix TAN request with response code 3955 during initialization of the dialog

* Do not call client.is_tan_media_required() in minimal_interactive_cli_bootstrap if client.selected_tan_medium is already defined

---------

Co-authored-by: Johannes Meyer <johannes@sfg-giulini.de>
fints/client.py
fints/dialog.py
fints/utils.py

index 42584dbcebf42b97ae2240d8e4732e8935003c87..1fbc42d25ca5c371cf5ab85be4834d28dfdc5c31 100644 (file)
@@ -1220,10 +1220,10 @@ class FinTS3PinTanClient(FinTS3Client):
             raise NotImplementedError("TAN-Process 1 not implemented")
 
         if tan_process in ('1', '3', '4') and self.is_tan_media_required():
-            if self.selected_tan_medium:
+            if self.selected_tan_medium is not None:
                 seg.tan_medium_name = self.selected_tan_medium
             else:
-                seg.tan_medium_name = 'DUMMY'
+                seg.tan_medium_name = ''
 
         if tan_process == '4' and tan_mechanism.VERSION >= 6:
             seg.segment_type = orig_seg.header.type
index e115d69a2e8df237912b7cc4bb0bf9dd432602ab..0c97daf7f7f4bee94ec6cdb2d1950e41523b22f2 100644 (file)
@@ -86,12 +86,13 @@ class FinTSDialog:
 
                 if tan_seg:
                     for resp in retval.responses(tan_seg):
-                        if resp.code == '0030':
+                        if resp.code in ('0030', '3955'):
                             self.client.init_tan_response = NeedTANResponse(
                                 None,
                                 retval.find_segment_first('HITAN'),
                                 '_continue_dialog_initialization',
-                                self.client.is_challenge_structured()
+                                self.client.is_challenge_structured(),
+                                resp.code == '3955',
                             )
                 self.need_init = False
                 return retval
index 5e009a61998b06db462b16a121ff82618163db04..130f5b640c99dc1aecd709f2129c37d092698d63 100644 (file)
@@ -295,7 +295,7 @@ def minimal_interactive_cli_bootstrap(client):
             choice = input("Choice: ").strip()
             client.set_tan_mechanism(mechanisms[int(choice)][0])
 
-    if client.is_tan_media_required() and not client.selected_tan_medium:
+    if client.selected_tan_medium is None and client.is_tan_media_required():
         print("We need the name of the TAN medium, let's fetch them from the bank")
         m = client.get_tan_media()
         if len(m[1]) == 1: