Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TAN request with response code 3955 during initialization of the dialog #171

Merged
merged 2 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions fints/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1215,10 +1215,10 @@ def _get_tan_segment(self, orig_seg, tan_process, tan_seg=None):
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
Expand Down
5 changes: 3 additions & 2 deletions fints/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,13 @@ def init(self, *extra_segments):

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
Expand Down
2 changes: 1 addition & 1 deletion fints/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,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:
Expand Down
Loading