From: Raphael Michel Date: Sat, 26 Oct 2024 14:07:56 +0000 (+0200) Subject: Add workaround for Sparkasse Heidelberg X-Git-Tag: v4.2.0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06d3a755c02bdcf34582b6a61ec6e1661474223f;p=thirdparty%2Fpython-fints.git Add workaround for Sparkasse Heidelberg --- 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 .exceptions import * 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 @@ class FinTS3PinTanClient(FinTS3Client): 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]):