Skip to content

Commit

Permalink
Add workaround for Sparkasse Heidelberg
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelm committed Oct 26, 2024
1 parent 50a224b commit 06d3a75
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 8 additions & 2 deletions fints/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
from .formals import (
CUSTOMER_ID_ANONYMOUS, KTI1, BankIdentifier, DescriptionRequired,
SynchronizationMode, TANMediaClass4, TANMediaType2,
SupportedMessageTypes)
SupportedMessageTypes, TANUsageOption
)
from .message import FinTSInstituteMessage
from .models import SEPAAccount
from .parser import FinTS3Serializer
Expand Down Expand Up @@ -1414,8 +1415,13 @@ def get_tan_media(self, media_type = TANMediaType2.ALL, media_class = TANMediaCl
context = self._get_dialog()
method = lambda dialog: dialog.send


with context as dialog:
if isinstance(self.init_tan_response, NeedTANResponse):
# This is a workaround for when the dialog already contains return code 3955.
# This occurs with e.g. Sparkasse Heidelberg, which apparently does not require us to choose a
# medium for pushTAN but is totally fine with keeping "" as a TAN medium.
return TANUsageOption.ALL_ACTIVE, []

hktab = self._find_highest_supported_command(HKTAB4, HKTAB5)

seg = hktab(
Expand Down
5 changes: 5 additions & 0 deletions fints/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ def minimal_interactive_cli_bootstrap(client):
m = client.get_tan_media()
if len(m[1]) == 1:
client.set_tan_medium(m[1][0])
elif len(m[1]) == 0:
# This is a workaround for when the dialog already contains return code 3955.
# This occurs with e.g. Sparkasse Heidelberg, which apparently does not require us to choose a
# medium for pushTAN but is totally fine with keeping "" as a TAN medium.
client.selected_tan_medium = ""
else:
print("Multiple tan media available. Which one do you prefer?")
for i, mm in enumerate(m[1]):
Expand Down

0 comments on commit 06d3a75

Please sign in to comment.