From afb5de2d8b13ea402e6729bcff5034ac05883fef Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Sat, 26 Oct 2024 14:46:56 +0200 Subject: [PATCH] Allow to request pending transactions --- fints/client.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fints/client.py b/fints/client.py index 0931e54..42584db 100644 --- a/fints/client.py +++ b/fints/client.py @@ -512,13 +512,15 @@ def _find_highest_supported_command(self, *segment_classes, **kwargs): else: return version_map.get(max_version.header.version) - def get_transactions(self, account: SEPAAccount, start_date: datetime.date = None, end_date: datetime.date = None): + def get_transactions(self, account: SEPAAccount, start_date: datetime.date = None, end_date: datetime.date = None, + include_pending = False): """ Fetches the list of transactions of a bank account in a certain timeframe. :param account: SEPA :param start_date: First day to fetch :param end_date: Last day to fetch + :param include_pending: Include pending transactions (might lack some data like booking day) :return: A list of mt940.models.Transaction objects """ @@ -535,7 +537,10 @@ def get_transactions(self, account: SEPAAccount, start_date: datetime.date = Non date_end=end_date, touchdown_point=touchdown, ), - lambda responses: mt940_to_array(''.join([seg.statement_booked.decode('iso-8859-1') for seg in responses])), + lambda responses: mt940_to_array(''.join( + [seg.statement_booked.decode('iso-8859-1') for seg in responses] + + ([seg.statement_pending.decode('iso-8859-1') for seg in responses] if include_pending else []) + )), 'HIKAZ', # Note 1: Some banks send the HIKAZ data in arbitrary splits. # So better concatenate them before MT940 parsing.