Open tloebhard opened 3 years ago
I think it needs to be saved in deconstruct and restored in set_data ?
That's probably the easiest solution, although it's probably not easy to store the lambda. I'm not sure if it would be theoretically better to store the information in NeedRetryResponse.from_data instead and reconstruct from there. The latter might make more sense if it is allowed to do a different operation "in-between". NeedRetryResponse would kinda need to know which operation it belongs to (HKKAZ in this case) and then send_tan could initialize the touchpoint state based on that information
send_tan could initialize the touchpoint state
Quite pragmatic, but what do you think of this solution just before return statement in send_tan
# Restore _touchdown_... attributes
if challenge.resume_method == '_continue_fetch_with_touchdowns' and challenge.command_seg.TYPE == 'HKKAZ':
self._touchdown_args = ['HIKAZ']
self._touchdown_kwargs = {}
self._touchdown_responses = []
self._touchdown_counter = 1
self._touchdown_dialog = dialog
self._touchdown_response_processor = lambda responses: mt940_to_array(
''.join([seg.statement_booked.decode('iso-8859-1') for seg in responses]))
hkkaz = self._find_highest_supported_command(HKKAZ5, HKKAZ6, HKKAZ7)
self._touchdown_segment_factory = lambda touchdown: hkkaz(
account=challenge.command_seg.account,
all_accounts=False,
date_start=challenge.command_seg.date_start,
date_end=challenge.command_seg.date_end,
touchdown_point=touchdown,
)
Any idea of using less hardcoding or maybe have a more flexible way of handling operations, ...? This solution at least works for getting transactions with comdirect and Skatbank.
...and we need to do that for all operations? Maybe it could be centralized somewhere?
for get_transactions_xml it seems to be:
if tan_request.command_seg.TYPE == 'HKCAZ':
client._touchdown_args = ['HICAZ']
self._touchdown_kwargs = {}
self._touchdown_responses = []
self._touchdown_counter = 1
self._touchdown_dialog = dialog
client._touchdown_response_processor = FinTS3Client._response_handler_get_transactions_xml
hkcaz = self._find_highest_supported_command(fints.segments.statement.HKCAZ1)
client._touchdown_segment_factory = lambda touchdown: hkcaz(
account=challenge.command_seg.account,
all_accounts=False,
date_start=challenge.command_seg.date_start,
date_end=challenge.command_seg.date_end,
touchdown_point=touchdown,
supported_camt_messages=SupportedMessageTypes(
['urn:iso:std:iso:20022:tech:xsd:camt.052.001.02']),
)
Hi, is there any chance that this will be fixed? The problem also appears in my code with Comdirect bank was well.
Nevertheless, the outlined workaround seems to work for me after slightly modifying it.
def do_process_tan(self, tan, fints_client):
print("TAN entered " + tan)
tan_request = NeedRetryResponse.from_data(self.fints_tan_data)
fints_client._touchdown_args = ['HIKAZ']
fints_client._touchdown_kwargs = {}
fints_client._touchdown_responses = []
fints_client._touchdown_counter = 1
fints_client._touchdown_dialog = fints_client._get_dialog()
fints_client._touchdown_response_processor = lambda responses: mt940_to_array(''.join([seg.statement_booked.decode('iso-8859-1') for seg in responses]))
hkkaz = fints_client._find_highest_supported_command(fints.segments.statement.HKKAZ5,
fints.segments.statement.HKKAZ6,
fints.segments.statement.HKKAZ7)
fints_client._touchdown_segment_factory = lambda touchdown: hkkaz(
account=tan_request.command_seg.account,
all_accounts=False,
date_start=tan_request.command_seg.date_start,
date_end=tan_request.command_seg.date_end,
touchdown_point=touchdown,
)
return fints_client.send_tan(tan_request, tan)
Thanks, Regards, Daniel
is there any chance that this will be fixed?
Maybe! It would require either
I don't remember running into this when I tested the implementation with my banks, but I'm not sure.
Describe the bug For getting older transactions from Skatbank and comdirect there is a TAN needed. I need to pause dialogue, deconstruct client (including private data) and store request. After restoring/resuming and sending TAN there is an exception in
_continue_fetch_with_touchdowns
, because self._touchdown_args (amonst others) is not set. TAN seems to be processed already correctly and accepted by bank.Bank I tested this with Name of the bank: comdirect (using PhotoTAN) FinTS URL: https://fints.comdirect.de/fints
Name of the bank: Skatbank (using VR-SecureGo (Push TAN)) FinTS URL: https://hbci11.fiducia.de/cgi-bin/hbciservlet
Expected behavior After sending TAN it should return requested transactions
Code required to reproduce (copied from https://python-fints.readthedocs.io/en/latest/trouble.html)
Log output / error message
Solution / Quick hack After setting the missing attributes in
ask_for_tan
beforef.send_tan
- it works: (just some dirty copy paste from_fetch_with_touchdowns
andget_transactions
)I think it needs to be saved in
deconstruct
and restored inset_data
?