]> git.ipfire.org Git - thirdparty/python-fints.git/commitdiff
Pin ING to one step authentication (#182)
authorSebastian Raß <43568284+sebira@users.noreply.github.com>
Tue, 7 Jan 2025 16:05:47 +0000 (17:05 +0100)
committerGitHub <noreply@github.com>
Tue, 7 Jan 2025 16:05:47 +0000 (17:05 +0100)
fints/client.py
fints/formals.py

index 13400eb6b38cc27cd42fddf60f2dda0fe6d89487..3fcb3b78780894c3b4242f96ffef47702639d6f5 100644 (file)
@@ -51,6 +51,10 @@ SYSTEM_ID_UNASSIGNED = '0'
 DATA_BLOB_MAGIC = b'python-fints_DATABLOB'
 DATA_BLOB_MAGIC_RETRY = b'python-fints_RETRY_DATABLOB'
 
+# workaround for ING not offering PSD2 conform two step authentication
+# ING only accepts one step authentication and only allows reading operations
+ING_BANK_IDENTIFIER = BankIdentifier(country_identifier='280', bank_code='50010517')
+
 
 class FinTSOperations(Enum):
     """This enum is used as keys in the 'supported_operations' member of the get_information() response.
@@ -1257,6 +1261,8 @@ class FinTS3PinTanClient(FinTS3Client):
         return data
 
     def is_tan_media_required(self):
+        if self.bank_identifier == ING_BANK_IDENTIFIER:
+            return False
         tan_mechanism = self.get_tan_mechanisms()[self.get_current_tan_mechanism()]
         return getattr(tan_mechanism, 'supported_media_number', None) is not None and \
                 tan_mechanism.supported_media_number > 1 and \
@@ -1379,7 +1385,7 @@ class FinTS3PinTanClient(FinTS3Client):
             return resume_func(challenge.command_seg, response)
 
     def _process_response(self, dialog, segment, response):
-        if response.code == '3920':
+        if response.code == '3920' and not self.bank_identifier == ING_BANK_IDENTIFIER:
             self.allowed_security_functions = list(response.parameters)
             if self.selected_security_function is None or not self.selected_security_function in self.allowed_security_functions:
                 # Select the first available twostep security_function that we support
index 313a839552b7e9eecb757a021685a0721e6bf966..877c0be821721a64320503fcd52ed0c18c252621 100644 (file)
@@ -160,6 +160,12 @@ class BankIdentifier(DataElementGroup):
     country_identifier = DataElementField(type='ctr')
     bank_code = DataElementField(type='an', max_length=30)
 
+    def __eq__(self, other):
+        if not isinstance(other, BankIdentifier):
+            return NotImplemented
+
+        return self.country_identifier == other.country_identifier and self.bank_code == other.bank_code
+
 
 @doc_enum
 class KeyType(RepresentableEnum):