From: Johannes Meyer Date: Sat, 26 Oct 2024 14:07:39 +0000 (+0200) Subject: Fix TAN request with response code 3955 during initialization of the dialog (#171) X-Git-Tag: v4.2.0~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50a224bbf620200ed4b291b0bdc7c900118f3589;p=thirdparty%2Fpython-fints.git Fix TAN request with response code 3955 during initialization of the dialog (#171) * 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 --- diff --git a/fints/client.py b/fints/client.py index 42584db..1fbc42d 100644 --- a/fints/client.py +++ b/fints/client.py @@ -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 diff --git a/fints/dialog.py b/fints/dialog.py index e115d69..0c97daf 100644 --- a/fints/dialog.py +++ b/fints/dialog.py @@ -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 diff --git a/fints/utils.py b/fints/utils.py index 5e009a6..130f5b6 100644 --- a/fints/utils.py +++ b/fints/utils.py @@ -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: