Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions fints/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,17 +567,27 @@ def _response_handler_get_transactions_xml(responses):
return booked_streams, pending_streams

def get_transactions_xml(self, account: SEPAAccount, start_date: datetime.date = None,
end_date: datetime.date = None) -> list:
end_date: datetime.date = None, supported_camt_messages = None) -> list:
"""
Fetches the list of transactions of a bank account in a certain timeframe as camt.052.001.02 XML files.
Fetches the list of transactions of a bank account in a certain timeframe as camt XML files.
Returns both booked and pending transactions.

:param account: SEPA
:param start_date: First day to fetch
:param end_date: Last day to fetch
:param supported_camt_messages: Names of accepted camt formats. If `None`, we'll accept whatever the bank offers.
:return: Two lists of bytestrings containing XML documents, possibly empty: first one for booked transactions,
second for pending transactions
"""
hicazs = self.bpd.find_segment_first('HICAZS')
if hicazs:
bank_supported_camt_messages = list(hicazs.parameter.supported_camt_formats)
else:
bank_supported_camt_messages = []
if supported_camt_messages is None:
supported_camt_messages = bank_supported_camt_messages
else:
supported_camt_messages = [m for m in supported_camt_messages if m in bank_supported_camt_messages]

with self._get_dialog() as dialog:
hkcaz = self._find_highest_supported_command(HKCAZ1)
Expand All @@ -591,7 +601,7 @@ def get_transactions_xml(self, account: SEPAAccount, start_date: datetime.date =
date_start=start_date,
date_end=end_date,
touchdown_point=touchdown,
supported_camt_messages=SupportedMessageTypes(['urn:iso:std:iso:20022:tech:xsd:camt.052.001.02']),
supported_camt_messages=SupportedMessageTypes(supported_camt_messages),
),
FinTS3Client._response_handler_get_transactions_xml,
'HICAZ'
Expand Down
10 changes: 10 additions & 0 deletions fints/formals.py
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,16 @@ class ScheduledBatchDebitParameter1(DataElementGroup):
single_booking_allowed = DataElementField(type='jn', _d="Einzelbuchung erlaubt")


class TransactionsTimeParameter1(DataElementGroup):
"""Parameter Kontoumsätze/Zeitraum camt, version 1
Source: FinTS Financial Transaction Services, Schnittstellenspezifikation, Messages -- Multibankfähige Geschäftsvorfälle """
storage_duration = DataElementField(type='num', max_length=4, _d="Speicherzeitraum")
entry_number_entries_allowed = DataElementField(type='jn', _d="Eingabe Anzahl Einträge erlaubt")
all_accounts_allowed = DataElementField(type='jn', _d="Alle Konten erlaubt")
supported_camt_formats = DataElementField(type='an', max_length=256, max_count=99, required=False, _d="Unterstützte camt-Datenformate")


class ScheduledBatchDebitParameter2(DataElementGroup):
"""Parameter terminierte SEPA-Sammellastschrift einreichen, version 2
Expand Down
9 changes: 8 additions & 1 deletion fints/segments/statement.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from fints.fields import DataElementField, DataElementGroupField, CodeField
from fints.formals import KTI1, Account2, Account3, QueryCreditCardStatements2, SupportedMessageTypes, \
BookedCamtStatements1, StatementFormat, Confirmation, ReportPeriod2
BookedCamtStatements1, StatementFormat, Confirmation, ReportPeriod2, TransactionsTimeParameter1

from .base import FinTS3Segment, ParameterSegment

Expand Down Expand Up @@ -90,6 +90,13 @@ class DIKKUS2(ParameterSegment):
parameter = DataElementGroupField(type=QueryCreditCardStatements2, _d="Parameter Kreditkartenumsätze anfordern")


class HICAZS1(ParameterSegment):
"""Kontoumsätze/Zeitraum camt Parameter, version 1

Source: FinTS Financial Transaction Services, Schnittstellenspezifikation, Messages -- Multibankfähige Geschäftsvorfälle """
parameter = DataElementGroupField(type=TransactionsTimeParameter1, _d="Parameter Kontoumsätze/Zeitraum camt")


class HKCAZ1(FinTS3Segment):
"""Kontoumsätze anfordern/Zeitraum, version 5

Expand Down