]> git.ipfire.org Git - thirdparty/python-fints.git/commitdiff
Make get_information() return the supported SEPA versions
authorHenryk Plötz <henryk@ploetzli.ch>
Sat, 8 Jun 2019 18:18:29 +0000 (20:18 +0200)
committerHenryk Plötz <henryk@ploetzli.ch>
Sat, 8 Jun 2019 18:23:38 +0000 (20:23 +0200)
fints/client.py

index c5a7d722b4b401ff996aab9edae0a1b82201830a..5814491a9a8637d1a7315681ed9c8c9222e9436b 100644 (file)
@@ -350,6 +350,8 @@ class FinTS3Client:
             bank:
                 name: Bank Name
                 supported_operations: dict(FinTSOperations -> boolean)
+                supported_formats: dict(FinTSOperation -> ['urn:iso:std:iso:20022:tech:xsd:pain.001.003.03', ...])
+                supported_sepa_formats: ['urn:iso:std:iso:20022:tech:xsd:pain.001.003.03', ...]
             accounts:
                 - iban: IBAN
                   account_number: Account Number
@@ -376,6 +378,15 @@ class FinTS3Client:
                 op: any(self.bpd.find_segment_first(cmd[0]+'I'+cmd[2:]+'S') for cmd in op.value)
                 for op in FinTSOperations
             }
+            retval['bank']['supported_formats'] = {}
+            for op in FinTSOperations:
+                for segment in (self.bpd.find_segment_first(cmd[0] + 'I' + cmd[2:] + 'S') for cmd in op.value):
+                    if not hasattr(segment, 'parameter'):
+                        continue
+                    formats = getattr(segment.parameter, 'supported_sepa_formats', [])
+                    retval['bank']['supported_formats'][op] = list(
+                        set(retval['bank']['supported_formats'].get(op, [])).union(set(formats))
+                    )
             hispas = self.bpd.find_segment_first('HISPAS')
             if hispas:
                 retval['bank']['supported_sepa_formats'] = list(hispas.parameter.supported_sepa_formats)