Skip to content

Commit

Permalink
Allow to request pending transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelm committed Oct 26, 2024
1 parent 65a74b2 commit afb5de2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions fints/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""

Expand All @@ -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.
Expand Down

0 comments on commit afb5de2

Please sign in to comment.