Skip to content

Commit 50a224b

Browse files
meyerjJohannes Meyer
and
Johannes Meyer
authored
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 <[email protected]>
1 parent afb5de2 commit 50a224b

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

fints/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,10 +1220,10 @@ def _get_tan_segment(self, orig_seg, tan_process, tan_seg=None):
12201220
raise NotImplementedError("TAN-Process 1 not implemented")
12211221

12221222
if tan_process in ('1', '3', '4') and self.is_tan_media_required():
1223-
if self.selected_tan_medium:
1223+
if self.selected_tan_medium is not None:
12241224
seg.tan_medium_name = self.selected_tan_medium
12251225
else:
1226-
seg.tan_medium_name = 'DUMMY'
1226+
seg.tan_medium_name = ''
12271227

12281228
if tan_process == '4' and tan_mechanism.VERSION >= 6:
12291229
seg.segment_type = orig_seg.header.type

fints/dialog.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,13 @@ def init(self, *extra_segments):
8686

8787
if tan_seg:
8888
for resp in retval.responses(tan_seg):
89-
if resp.code == '0030':
89+
if resp.code in ('0030', '3955'):
9090
self.client.init_tan_response = NeedTANResponse(
9191
None,
9292
retval.find_segment_first('HITAN'),
9393
'_continue_dialog_initialization',
94-
self.client.is_challenge_structured()
94+
self.client.is_challenge_structured(),
95+
resp.code == '3955',
9596
)
9697
self.need_init = False
9798
return retval

fints/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def minimal_interactive_cli_bootstrap(client):
295295
choice = input("Choice: ").strip()
296296
client.set_tan_mechanism(mechanisms[int(choice)][0])
297297

298-
if client.is_tan_media_required() and not client.selected_tan_medium:
298+
if client.selected_tan_medium is None and client.is_tan_media_required():
299299
print("We need the name of the TAN medium, let's fetch them from the bank")
300300
m = client.get_tan_media()
301301
if len(m[1]) == 1:

0 commit comments

Comments
 (0)