From: Philipp Knechtges Date: Sun, 5 Apr 2020 14:41:30 +0000 (+0200) Subject: implement custom response handler for get_transactions_xml X-Git-Tag: v3.0.1~3^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31a85e5a2068927f561912f649757408b52be531;p=thirdparty%2Fpython-fints.git implement custom response handler for get_transactions_xml --- diff --git a/fints/client.py b/fints/client.py index b868419..7c3f495 100644 --- a/fints/client.py +++ b/fints/client.py @@ -546,6 +546,15 @@ class FinTS3Client: return response + @staticmethod + def _response_handler_get_transactions_xml(responses): + booked_streams = [] + pending_streams = [] + for seg in responses: + booked_streams.extend(seg.statement_booked.camt_statements) + pending_streams.append(seg.statement_pending) + return booked_streams, pending_streams + def get_transactions_xml(self, account: SEPAAccount, start_date: datetime.date = None, end_date: datetime.date = None) -> list: """ @@ -573,17 +582,12 @@ class FinTS3Client: touchdown_point=touchdown, supported_camt_messages=SupportedMessageTypes(['urn:iso:std:iso:20022:tech:xsd:camt.052.001.02']), ), - lambda responses: responses, # TODO + FinTS3Client._response_handler_get_transactions_xml, 'HICAZ' ) logger.info('Fetching done.') - booked_streams = [] - pending_streams = [] - for seg in responses: - booked_streams.extend(seg.statement_booked.camt_statements) - pending_streams.append(seg.statement_pending) - return booked_streams, pending_streams + return responses def get_credit_card_transactions(self, account: SEPAAccount, credit_card_number: str, start_date: datetime.date = None, end_date: datetime.date = None): # FIXME Reverse engineered, probably wrong