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

Balances do not match when importing via bunq api. #1607

Closed
OGKevin opened this issue Aug 13, 2018 · 123 comments
Closed

Balances do not match when importing via bunq api. #1607

OGKevin opened this issue Aug 13, 2018 · 123 comments
Labels
fixed Bugs that are fixed (in a coming release).

Comments

@OGKevin
Copy link
Contributor

OGKevin commented Aug 13, 2018

I am running Firefly III version 4.7.5.3

Description
After running import via bunq api. Account balances do not match.

Steps to reproduce
Run the bunq importer via the API and then check its balance.

Extra info
Please add extra info here, such as OS, browser, and the output from the /debug-page of your Firefly III installation (click the version at the bottom).

Bonus points
Earn bonus points by:

  • Add a screenshot

screen shot 2018-08-13 at 09 36 56

minus 8 thousand ? 😅 All these balances make 0 sense. And none are accurate :(

@JC5
Copy link
Member

JC5 commented Aug 13, 2018

Mmm. Incorrect balances are usually caused by incorrect transactions: transfers becoming expenses and deposits. Might that be the case?

The math is pretty much foolproof but if Firefly III is making garbage out of the transactions from the API, the result will be garbage too.

Does the sandbox still have 1 transaction in it?

@OGKevin
Copy link
Contributor Author

OGKevin commented Aug 13, 2018

Yea, sandbox will have 0 transactions you have to create them your self. But thats rather EZ. Just create a lil script that makes 10 batch payments of 100 payments. So you can easily create 1k payments. of random amounts to random sandbox users. alpha, bravo, charlie, delta, echo@bunq.com.

And of-course you would need to topup via a request to suggardaddy@bunq.com.

@JC5
Copy link
Member

JC5 commented Aug 13, 2018

Alright, that's something I can work on. Are the transactions correct otherwise on your import? No weird stuff in Firefly III?

@tbrasser
Copy link

I also had a mismatch in the balances between bunq app and firefly after bunq import. I just changed the initial amount until the value matched the actual value. How far back does the bunq api import from? Because it seems that the initial amount is what's causing the mismatch (in my case anyway).

@OGKevin
Copy link
Contributor Author

OGKevin commented Aug 14, 2018

I think it goes back until the beginning of the monetary account. I saw that my first transaction ever was also imported.

@tbrasser
Copy link

tbrasser commented Aug 14, 2018

I've now added all my accounts and I'm now seeing the same behaviour. Could it be a result of the internal bunq to bunq account transactions being doubled? #1564

@JC5
Copy link
Member

JC5 commented Aug 15, 2018

Yes, that's a possibility. I'm just now building something to fill my own account(s). @OGKevin is there any documentation on sugardaddy and the other accounts? I sent out a payment request, but I'm not sure what to expect.

@OGKevin
Copy link
Contributor Author

OGKevin commented Aug 16, 2018

@JC5 https://github.com/bunq/tinker_php/blob/d95d22158115881d7f32bb3bff7db37cdbacee70/src/BunqLib.php#L484-L495 here is an example.

You literally just send a request to that email and then it will be auto accepted. The max per request is 500 tho. If you did that and you still didn't get the money that i would wait until https://together.bunq.com/d/3779-encountered-error-while-retrieving-new-sandbox-apikey is resolved and then try again.

@JC5
Copy link
Member

JC5 commented Aug 16, 2018

Ah very nice!

I requested 10K, I’m a big spender 😎. I’ll tone it down 😋

@JC5
Copy link
Member

JC5 commented Aug 16, 2018

I've fixed #1564 and I hope the problem is related to this one. Transfers are no longer stored twice so importing data from bunq should result in perfect results.

@OGKevin
Copy link
Contributor Author

OGKevin commented Aug 16, 2018

@JC5 ill pull develop and will let you know.

@OGKevin
Copy link
Contributor Author

OGKevin commented Aug 16, 2018

hmm, is develop broken ? when i visit http://firefly.ogkevin.net/accounts/create/asset throws


Whoops! An error occurred.

Unfortunately, this error was not recoverable. Firefly III broke. The error is:

Trying to get property 'id' of non-object
Error

This error occured in file /home/firefly/firefly-iii/app/Http/Controllers/Account/CreateController.php on line 87 with code 0.

@JC5
Copy link
Member

JC5 commented Aug 16, 2018

Did you migrate the database? There are new account types, I believe the controller is looking for them.

@OGKevin
Copy link
Contributor Author

OGKevin commented Aug 16, 2018

firefly@OGKevinVPS:~/firefly-iii$ php artisan migrate
**************************************
*     Application In Production!     *
**************************************

 Do you really wish to run this command? (yes/no) [no]:
 > yes

Nothing to migrate.
firefly@OGKevinVPS:~/firefly-iii$

🤔

@JC5
Copy link
Member

JC5 commented Aug 16, 2018

🤔

Wait! Add --seed.

@OGKevin
Copy link
Contributor Author

OGKevin commented Aug 16, 2018

yea that worked, but now after the import they still dont match.

screen shot 2018-08-16 at 17 34 23

Im now at -7k. And the other ones are also become less, but still far off. I've also noticed that in the dashboard, you will also see accounts that dont belong to you. As in expense accounts e.g.

screen shot 2018-08-16 at 17 27 15

However none of these are correct tho, as it the amount of euros.

Tested on commit: 566be8d

@JC5
Copy link
Member

JC5 commented Aug 16, 2018

Mmm, stranger and stranger. Especially that last one.

Could you see if any transactions in particular are wrong? In the meantime, I'll try to build a more complex sandbox environment.

@OGKevin
Copy link
Contributor Author

OGKevin commented Aug 16, 2018

I'll take a look at the transactions. You use the payment endpoint to pull transactions i take it ? I can take a look at the code as well and see if i can spot stuff. But thats kinda hard bc you dont use the git flow with pull requests :P.

@tbrasser
Copy link

tbrasser commented Aug 16, 2018 via email

@JC5
Copy link
Member

JC5 commented Aug 16, 2018

I know @OGKevin, I'm old fashioned like that. I'll read up on it 👍

@tbrasser, thanks for the pointer!

@JC5
Copy link
Member

JC5 commented Aug 28, 2018

I've pushed some fixes and it seems my local instance is pretty much up to date after about ~120 transactions. This is just basic stuff though.

screen shot 2018-08-28 at 21 44 33

Regardless, Firefly III will go back in time in a loop until all transactions are downloaded and will then start moving forward in time to keep up with new transactions. That should already stabilise the import a bit.

If any of you have the time to verify this with your own accounts I'd be grateful!

@tbrasser
Copy link

I'll test the dev branch as soon as I'm back from holidays in 2 weeks! Kutgw!

@OGKevin
Copy link
Contributor Author

OGKevin commented Aug 29, 2018

I'll give it a test in a bit as well. Will let you know.

@OGKevin
Copy link
Contributor Author

OGKevin commented Aug 29, 2018

Hi there,

Firefly III v4.7.6 ran into an error: Maximum execution time of 30 seconds exceeded.

The error was of type "Symfony\Component\Debug\Exception\FatalErrorException".

The error occured on/at: Wed, 29 Aug 2018 15:16:42 +0000.

This error occured in file "/home/firefly/firefly-iii/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php" on line 315 with code 1.

    The error was encountered by user #2, ogkevin@bunq.com.

The IP address related to this error is: 10.8.0.14
URL is: http://firefly.ogkevin.net/import/job/store/1r4J2pznsxws
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15

The full stacktrace is below. If you think this is a bug in Firefly III, you
can forward this message to thegrumpydictator@gmail.com. This can help fix
the bug you just encountered.

If you prefer, you can also open a new issue here:

https://github.com/firefly-iii/firefly-iii/issues

The full stacktrace is below:

#0 {main}

Beep boop,

The Firefly III Mail Robot

PS: This message was sent because a request from IP 10.8.0.14 triggered it.

Got this nice little email 😁

@OGKevin
Copy link
Contributor Author

OGKevin commented Aug 29, 2018

So the import didnt finish 🤔

@OGKevin
Copy link
Contributor Author

OGKevin commented Aug 29, 2018

Where do you save the last/newer id ?

I've deleted the entries in the preferences table, but the Import is still continuing from that last save point instead of beginning all over again 🤔

@JC5
Copy link
Member

JC5 commented Oct 29, 2018

The .env file is overwritten at start, so I suggest using -e APP_DEBUG=true -e APP_LOG_LEVEL=debug.

See for more options this file: https://github.com/firefly-iii/firefly-iii/blob/master/.env.docker

I'll expand the wiki.

@tbrasser
Copy link

Got it, I was looking in .env.example instead of .env.docker, so I thought some variables weren't exposed. I'll see to it if I can get to it today, otherwise I'll try again tomorrow.

@JC5
Copy link
Member

JC5 commented Oct 29, 2018

Sure thing, I really appreciate the time you're spending on this.

@tbrasser
Copy link

I have a log in which I did the following:

  • start firefly
  • remove my profile
  • make new profile
  • set-up bank-accounts
  • set bunq api key
  • run import

I will email a sharing link to you (gmail) when it's done importing, please don't share my financial details with anyone (A)

@JC5
Copy link
Member

JC5 commented Oct 30, 2018

Thanks, I saw it. Will dive into it tonight. I appreciate the trust 👍

@bluewalk
Copy link

Ran the import and still incorrect, seems better but now other accounts have +10k whilst another account is in debit whilst it's actually not... Curious of @tbrasser's logs will help you.

JC5 added a commit that referenced this issue Oct 31, 2018
JC5 added a commit that referenced this issue Oct 31, 2018
@JC5
Copy link
Member

JC5 commented Oct 31, 2018

For those in the thread. I've pushed improved logging. If you set the log level to "info" (using either the .env file or the -e command line options) you should be able to see a more concise overview of what is happening in the log files.

@tbrasser
Copy link

tbrasser commented Oct 31, 2018 via email

@stale
Copy link

stale bot commented Nov 14, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale No replies or comments. Will be auto-closed in 14 days. label Nov 14, 2018
@JC5
Copy link
Member

JC5 commented Nov 14, 2018

Let's keep this open for now.

@stale stale bot removed the stale No replies or comments. Will be auto-closed in 14 days. label Nov 14, 2018
@JC5 JC5 added bug and removed possible bug labels Nov 14, 2018
@JC5
Copy link
Member

JC5 commented Nov 23, 2018

@tbrasser When you have time, I would appreciate some feedback on the import process using the new log structure. If you feel uncomfortable using the develop-branch, I suggest I will revive this thread after the release of 4.7.9.

@OGKevin
Copy link
Contributor Author

OGKevin commented Nov 23, 2018

I'll give it a try today if I don't forget 👍

@JC5
Copy link
Member

JC5 commented Nov 23, 2018

That would be cool. I'm especially curious about the DUO and Belastingdienst related payouts.

@tbrasser
Copy link

tbrasser commented Dec 6, 2018

I'm sorry for the delays here. I'm in the middle of a new job (my first 'real' one) and moving. I'm definitely going to use firefly III with Bunq and will test everything here and provide feedback to get it working. I just can't promise on when I can find the time. But really thanks a lot for all the effort here

@JC5
Copy link
Member

JC5 commented Dec 7, 2018

No problem, just let me know. The new "saving goal" option is also wrecking havoc with the importer so plenty of things to test 😉

@OGKevin
Copy link
Contributor Author

OGKevin commented Dec 12, 2018

Alright, so I ran the import. Balances are a lot better but not totally correct yet.

2 of my accounts, my "savings" and "monthly expenses" accounts now have the correct balance.

My saving goals accounts are a little short approx 10 euros short. While my main account is way of. It says I have -90 euro on my account.

The BelastingDienst payments seem to be alright.

@OGKevin
Copy link
Contributor Author

OGKevin commented Dec 13, 2018

I re-ran it tonight, this time included all my accounts. The balances are miss matches now, including the ones that succeeded yesterday :(.

The importer crashes with the following error:

automation_firefly_iii_app.1.lh7ftyn990u2@automation-prod-s-1vcpu-1gb-ams3-01    | [2018-12-13 21:23:04] production.NOTICE: Done storing. Firefly III has stored 1741 transactions.
automation_firefly_iii_app.1.lh7ftyn990u2@automation-prod-s-1vcpu-1gb-ams3-01    | 2018-12-13 21:23:04,748 DEBG 'apache2' stdout output:
automation_firefly_iii_app.1.lh7ftyn990u2@automation-prod-s-1vcpu-1gb-ams3-01    | [2018-12-13 21:23:04] production.NOTICE: Done storing. Firefly III has stored 1741 transactions.
automation_firefly_iii_app.1.lh7ftyn990u2@automation-prod-s-1vcpu-1gb-ams3-01    |
automation_firefly_iii_app.1.lh7ftyn990u2@automation-prod-s-1vcpu-1gb-ams3-01    | [2018-12-13 21:23:05] production.ERROR: The import storage routine crashed: Undefined index: zoom_level
automation_firefly_iii_app.1.lh7ftyn990u2@automation-prod-s-1vcpu-1gb-ams3-01    | 2018-12-13 21:23:05,000 DEBG 'apache2' stdout output:
automation_firefly_iii_app.1.lh7ftyn990u2@automation-prod-s-1vcpu-1gb-ams3-01    | [2018-12-13 21:23:05] production.ERROR: The import storage routine crashed: Undefined index: zoom_level
automation_firefly_iii_app.1.lh7ftyn990u2@automation-prod-s-1vcpu-1gb-ams3-01    |
automation_firefly_iii_app.1.lh7ftyn990u2@automation-prod-s-1vcpu-1gb-ams3-01    | [2018-12-13 21:23:05] production.ERROR: #0 /var/www/firefly-iii/app/Http/Controllers/Import/JobStatusController.php(215): FireflyIII\Http\Controlle$
s\Import\JobStatusController->storeTransactions(Object(FireflyIII\Models\ImportJob))
automation_firefly_iii_app.1.lh7ftyn990u2@automation-prod-s-1vcpu-1gb-ams3-01    | #1 [internal function]: FireflyIII\Http\Controllers\Import\JobStatusController->store(Object(FireflyIII\Models\ImportJob))
automation_firefly_iii_app.1.lh7ftyn990u2@automation-prod-s-1vcpu-1gb-ams3-01    | #2 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
automation_firefly_iii_app.1.lh7ftyn990u2@automation-prod-s-1vcpu-1gb-ams3-01    | #3 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('st$
re', Array)
automation_firefly_iii_app.1.lh7ftyn990u2@automation-prod-s-1vcpu-1gb-ams3-01    | #4 /var/www/firefly-iii/vendor/laravel/framework/src/Illuminate/Routing/Route.php(212): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Il$
uminate\Routing\Route), Object(FireflyIII\Http\Controllers\Import\JobStatusController), 'store')

@JC5
Copy link
Member

JC5 commented Dec 14, 2018

I'll do some digging this weekend. I've been working on the API mostly for the last few weeks.

@JC5
Copy link
Member

JC5 commented Feb 3, 2019

I finally ran into this problem myself. I have two accounts who are off by one euro. Stay tuned.

@JC5
Copy link
Member

JC5 commented Feb 3, 2019

Storing the same auto-save amount twice in one day fails. The second one is probably thought to be a duplicate.

@JC5
Copy link
Member

JC5 commented Feb 8, 2019

This is now fixed. So far, no more problems here.

@JC5 JC5 added the fixed Bugs that are fixed (in a coming release). label Feb 23, 2019
@JC5 JC5 closed this as completed Mar 2, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed Bugs that are fixed (in a coming release).
Projects
None yet
Development

No branches or pull requests

5 participants