]> git.ipfire.org Git - thirdparty/python-fints.git/commitdiff
Add workaround for Sparkasse Heidelberg
authorRaphael Michel <michel@rami.io>
Sat, 26 Oct 2024 14:07:56 +0000 (16:07 +0200)
committerRaphael Michel <michel@rami.io>
Sat, 26 Oct 2024 14:08:05 +0000 (16:08 +0200)
fints/client.py
fints/utils.py

index 1fbc42d25ca5c371cf5ab85be4834d28dfdc5c31..7e1d3c9225af8d8722ad6b12c10f8d270a619649 100644 (file)
@@ -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(
index 130f5b640c99dc1aecd709f2129c37d092698d63..b787283103c86f76e8f0e3e475765d313a98e570 100644 (file)
@@ -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]):