Skip to content

Commit 06d3a75

Browse files
committed
Add workaround for Sparkasse Heidelberg
1 parent 50a224b commit 06d3a75

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

fints/client.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
from .formals import (
1818
CUSTOMER_ID_ANONYMOUS, KTI1, BankIdentifier, DescriptionRequired,
1919
SynchronizationMode, TANMediaClass4, TANMediaType2,
20-
SupportedMessageTypes)
20+
SupportedMessageTypes, TANUsageOption
21+
)
2122
from .message import FinTSInstituteMessage
2223
from .models import SEPAAccount
2324
from .parser import FinTS3Serializer
@@ -1414,8 +1415,13 @@ def get_tan_media(self, media_type = TANMediaType2.ALL, media_class = TANMediaCl
14141415
context = self._get_dialog()
14151416
method = lambda dialog: dialog.send
14161417

1417-
14181418
with context as dialog:
1419+
if isinstance(self.init_tan_response, NeedTANResponse):
1420+
# This is a workaround for when the dialog already contains return code 3955.
1421+
# This occurs with e.g. Sparkasse Heidelberg, which apparently does not require us to choose a
1422+
# medium for pushTAN but is totally fine with keeping "" as a TAN medium.
1423+
return TANUsageOption.ALL_ACTIVE, []
1424+
14191425
hktab = self._find_highest_supported_command(HKTAB4, HKTAB5)
14201426

14211427
seg = hktab(

fints/utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,11 @@ def minimal_interactive_cli_bootstrap(client):
300300
m = client.get_tan_media()
301301
if len(m[1]) == 1:
302302
client.set_tan_medium(m[1][0])
303+
elif len(m[1]) == 0:
304+
# This is a workaround for when the dialog already contains return code 3955.
305+
# This occurs with e.g. Sparkasse Heidelberg, which apparently does not require us to choose a
306+
# medium for pushTAN but is totally fine with keeping "" as a TAN medium.
307+
client.selected_tan_medium = ""
303308
else:
304309
print("Multiple tan media available. Which one do you prefer?")
305310
for i, mm in enumerate(m[1]):

0 commit comments

Comments
 (0)