diff --git a/fints/client.py b/fints/client.py index 1fbc42d..7e1d3c9 100644 --- a/fints/client.py +++ b/fints/client.py @@ -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 @@ -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( diff --git a/fints/utils.py b/fints/utils.py index 130f5b6..b787283 100644 --- a/fints/utils.py +++ b/fints/utils.py @@ -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]):