Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_build_account_dic returns empty dictionary #47

Closed
githubuser3000 opened this issue Oct 5, 2023 · 6 comments
Closed

_build_account_dic returns empty dictionary #47

githubuser3000 opened this issue Oct 5, 2023 · 6 comments

Comments

@githubuser3000
Copy link

githubuser3000 commented Oct 5, 2023

Hi,

very recently the robo stopped working. Login works, but account_dic is empty. I stepped into the problem and found out, that productGroups are empty in the data, that is sent by DKB:

{'product_display': {'data': [{'type': 'productDisplaySettings', 'id': '####################', 'attributes': {'portfolio': 'dkb', 'productSettings': {}, 'productGroups': {}, 'clientTypeSpecificSettings': {}}, 'links': {'self': 'https://api.developer.dkb.de/config/users/me/product-display-settings/####################'}}], 'included': []}

But _build_account_dic needs this data to build the account dic.
The rest of the portfolio_dic looks totally fine.
Without the productGroups, no account dic, no transaction_urls and no chance to get_transactions.

Tested versions 0.23.2 and 0.23.1, legacy_login=False

Anyone else has this issue? Is it really necessary to go via productGroups? It looks, like the account_dic could also be build without it.

Best regards

@githubuser3000 githubuser3000 changed the title _build_account_dic returns empty dict _build_account_dic returns empty dictionary Oct 5, 2023
@grindsa
Copy link
Owner

grindsa commented Oct 5, 2023

Thank you for your explanation. Although I am not able to replicate your issue, I understand what's going wrong. I have an idea how to work around a scenario in which the productGroups attribute is empty. Give me a bid of time to work on a fix...

@grindsa
Copy link
Owner

grindsa commented Oct 7, 2023

Hi again, a potential fix got slotted into the devel branch can you please check if this solves your issue?

@githubuser3000
Copy link
Author

githubuser3000 commented Oct 7, 2023

Hey, thanks for the update.
I tested it and account dictionary is now filled correctly.

However, there are many things, that has been changed by dkb recently and has to be adapted in source code now.
Some of them are e.g.:
in account dic:

  • IBANs are now represented without spaces
  • date format has changed from %d.%m.%Y to %Y-%m-%d

in transactions:

  • date format has also been changed
  • "mandatreferenz" attribute not available anymore
  • "customerreferenz" attribute not always available in each transaction

This only as hint for everyone observing the same changes, since it can't really be changed in the robo.

But, there is one issue remaining:
It seems, like dkb has changed the logic for account balance. The balance, that online banking shows and that is also returned by account dic now sometimes also includes transactions from the future (happens usually at weekends for transactions on next Monday).
get_transactions does not allow date_to in the future (due to validate_dates). This causes the situation, that account balance in account dic shows a value, that can't be reproduced by all transactions returned by get_transactions. This always causes a validation error in my code in this case.
Solution:
Simply allow date_to in the future. Removing "if date_to_uts > now_uts:" branch was working for me.

@grindsa
Copy link
Owner

grindsa commented Oct 11, 2023

Hi,

Sorry for not responding earlier. When building the fix for the issue you reported I did encounter further issues during regression, and it took a bid of time to fix all of them.

You are absolutely right it makes sense to create a list of "breaking changes when switching to the new API". I am thinking to update #42 along with migrating the different methods to the new API; if you have a better idea let me know.

I will implement the "if date_to_uts > now_uts:" change you mentioned next and package a new release tomorrow or the day after.

Sorry again for keeping you waiting and thanks a lot for providing feedback.

@githubuser3000
Copy link
Author

No problem, there is no hurry.

The unpleasant observation is, that the breaking changes didn't came with the new API right away. I used the the new one already a while without the problems and then suddenly it changed. And even worse, I found out, that other accounts do not yet have rolled out the breaking changes in the new API. It might happen suddenly in the background for each account individually.

I try to help as best as I can. And thanks a lot for all your work on this library. Its such a great tool!

@grindsa
Copy link
Owner

grindsa commented Oct 17, 2023

closing as fix got included in v0.24

@grindsa grindsa closed this as completed Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants