Skip to content

Commit afb5de2

Browse files
committed
Allow to request pending transactions
1 parent 65a74b2 commit afb5de2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

fints/client.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,13 +512,15 @@ def _find_highest_supported_command(self, *segment_classes, **kwargs):
512512
else:
513513
return version_map.get(max_version.header.version)
514514

515-
def get_transactions(self, account: SEPAAccount, start_date: datetime.date = None, end_date: datetime.date = None):
515+
def get_transactions(self, account: SEPAAccount, start_date: datetime.date = None, end_date: datetime.date = None,
516+
include_pending = False):
516517
"""
517518
Fetches the list of transactions of a bank account in a certain timeframe.
518519
519520
:param account: SEPA
520521
:param start_date: First day to fetch
521522
:param end_date: Last day to fetch
523+
:param include_pending: Include pending transactions (might lack some data like booking day)
522524
:return: A list of mt940.models.Transaction objects
523525
"""
524526

@@ -535,7 +537,10 @@ def get_transactions(self, account: SEPAAccount, start_date: datetime.date = Non
535537
date_end=end_date,
536538
touchdown_point=touchdown,
537539
),
538-
lambda responses: mt940_to_array(''.join([seg.statement_booked.decode('iso-8859-1') for seg in responses])),
540+
lambda responses: mt940_to_array(''.join(
541+
[seg.statement_booked.decode('iso-8859-1') for seg in responses] +
542+
([seg.statement_pending.decode('iso-8859-1') for seg in responses] if include_pending else [])
543+
)),
539544
'HIKAZ',
540545
# Note 1: Some banks send the HIKAZ data in arbitrary splits.
541546
# So better concatenate them before MT940 parsing.

0 commit comments

Comments
 (0)