python-fints icon indicating copy to clipboard operation
python-fints copied to clipboard

ING: KeyError '999' in minimal_interactive_cli_bootstrap

Open tovolkmar opened this issue 5 years ago • 7 comments
trafficstars

Describe the bug When running the function minimal_interactive_cli_bootstrap for the ING, i get the following error: KeyError: '999'. The configuration worked with version 2 of this api, so pin, identifier and so on should be correct.

Bank I tested this with Name of the bank: ING FinTS URL: https://fints.ing.de/fints/

Log output / error message Call stack: File "/BankingController/FinTS/Api.py", line 25, in init minimal_interactive_cli_bootstrap(self.finClient) File "/venv/lib/python3.7/site-packages/fints/utils.py", line 319, in minimal_interactive_cli_bootstrap if client.is_tan_media_required() and not client.selected_tan_medium: File "/venv/lib/python3.7/site-packages/fints/client.py", line 1171, in is_tan_media_required tan_mechanism = self.get_tan_mechanisms()[self.get_current_tan_mechanism()] KeyError: '999'

Can you please help me with this issue? Please let me know when you need additional informations. Thanks, Tobias

tovolkmar avatar Mar 24 '20 15:03 tovolkmar

Same problem. It seems the HITANS fields are not found properly, as this line in client.py always returns empty: for seg in self.bpd.find_segments('HITANS', version):

c64bob avatar Aug 06 '20 07:08 c64bob

The debug log shows a header with HITANS, so in theory this should work:

	    fints.segments.message.HNVSD1( # Verschlüsselte Daten, version 1
	                # ...
	                fints.segments.auth.HITANS1(
	                    header = fints.formals.SegmentHeader('HITANS', 11, 1, 4), # Segmentkopf

Edit: I think there is a version mismatch Edit 2: There are a lot of segments with the correct type, but the version is wrong for all of them. Not sure how to proceed here without deeper FinTS knowledge. Edit 3: Could it be the same problem as fixed here? https://github.com/nemiah/phpFinTS/pull/253

bahlo avatar Aug 08 '20 16:08 bahlo

Works when you don't use with or minimal_interactive_cli_bootstrap for me!

bahlo avatar Aug 08 '20 20:08 bahlo

Works when you don't use with or minimal_interactive_cli_bootstrap for me!

No success for me. Could you describe how you got it working?

c64bob avatar Aug 12 '20 07:08 c64bob

Sure, it's basically this code:

fints_client = FinTS3PinTanClient(
    # ...
)
accounts = fints_client.get_sepa_accounts() # or whatever

Please note that my only use case is getting the accounts and transactions. Plus I'm sure this is still something to be fixed with with and minimal_interactive_cli_bootstrap, but that's at least a workaround.

bahlo avatar Aug 12 '20 11:08 bahlo

This issue seems to be because ING does not support any TAN mode in FinTS: https://www.ing.de/ueber-uns/wissenswert/psd2/

If I add following check to https://github.com/raphaelm/python-fints/blob/bc1c81e0a42be245c6af24bb0885ce1b2407bd2a/fints/client.py#L1175 it goes one step further: if not self.get_tan_mechanisms(): return False

But then https://github.com/raphaelm/python-fints/blob/bc1c81e0a42be245c6af24bb0885ce1b2407bd2a/fints/client.py#L1285 failes, obviously because of a standing dialog. Content of response is: fints.formals.Response(code='3920', reference_element=None, text='Zugelassene Ein- und Zwei-Schritt-Verfahren für den Benutzer', parameters=['900']) but self.get_tan_mechanisms() is, as above, empty. If I additionally remove the set tan statement, the code from there works: https://python-fints.readthedocs.io/en/latest/trouble.html

Are there some inconsistent responses by FinTS interface by ING? (maybe @raphaelm can interpret it easily? Do you need further debug output?)

I can also confirm, that it works without with/minimal_interactive... as @bahlo suggested. As we don't need TANs at all... everything should work like that.

tloebhard avatar Jan 06 '21 17:01 tloebhard

@bahlo : I have the same issue, but struggle a bit to get it running. Could you please provide me with a full executable code?

KevinSzr avatar Aug 16 '22 19:08 KevinSzr