]> git.ipfire.org Git - thirdparty/python-fints.git/commitdiff
Implement get_balance for PSD2
authorRaphael Michel <mail@raphaelmichel.de>
Sun, 22 Dec 2019 17:20:26 +0000 (18:20 +0100)
committerRaphael Michel <mail@raphaelmichel.de>
Sun, 22 Dec 2019 17:20:26 +0000 (18:20 +0100)
fints/client.py

index d8a5232e49446ff37253a1ca3e48373e12248467..bd513afeafc127449bd13a59443e37d03d80b51e 100644 (file)
@@ -603,6 +603,10 @@ class FinTS3Client:
 
         return responses
 
+    def _get_balance(self, command_seg, response):
+        for resp in response.response_segments(command_seg, 'HISAL'):
+            return resp.balance_booked.as_mt940_Balance()
+
     def get_balance(self, account: SEPAAccount):
         """
         Fetches an accounts current balance.
@@ -619,10 +623,8 @@ class FinTS3Client:
                 all_accounts=False,
             )
 
-            response = dialog.send(seg)
-
-            for resp in response.response_segments(seg, 'HISAL'):
-                return resp.balance_booked.as_mt940_Balance()
+            response = self._send_with_possible_retry(dialog, seg, self._get_balance)
+            return response
 
     def get_holdings(self, account: SEPAAccount):
         """