gaynetdinov / ex_money

An [abandoned] self-hosted personal finance app
ISC License
167 stars 12 forks source link

Dashboard and transactions sections are blank. #50

Open idanci opened 8 years ago

idanci commented 8 years ago

I have one successfully connected login to SaltEdge, it is shown in logins section, but there is nothing on the dashboard.

screen shot 2016-03-16 at 15 56 10 screen shot 2016-03-16 at 15 56 19 screen shot 2016-03-16 at 15 56 24

Any ideas how can I debug this?

Thanks, Ivan

gaynetdinov commented 8 years ago

Hello. Sorry, I didn't see your issue as I wasn't in the watching list by some reason :)

Once you have a login, you also have to have accounts in Settings -> Accounts section. Do you have some? Please make sure that you tick 'Show on Dashboard' checkbox so an account can be displayed on Dashboard(both desktop and mobile).

If everything is ok with accounts, then there might be an error with syncing transactions. I'm afraid that the only way to debug it so far is application logs. Did you deploy to Heroku? If so, you can try to reconnect your login with heroku logs -t --source=app command running in the console(or can see your logs on heroku.com as well). If you see an error you can post logs here(don't forget to remove your customer_id from them first).

Also, you can check Saltedge login page to see if there is a LAST FAIL MESSAGE field populated. Also please check if there are some transactions on Saltedge side.

Is your login interactive? If it's not you can try to restart your application by running heroku restart -a your-app-name. The thing is that if your login is not interactive, then a ExMoney background worker should pick up your login and run periodic job to sync accounts/transactions. Maybe by some reason it didn't work during first login connect.

idanci commented 8 years ago

/settings/accounts doesn't show any accounts imported from SaltEdge(SE). In SE I can see all the data, including 2 accounts and many transactions.

However I skipped the section with adding scheduler because my heroku account is not verified. Do these workers relay on scheduler?

Thanks, Ivan :)

gaynetdinov commented 8 years ago

No, all ExMoney workers with business logic are OTP GenServer workers, so they don't need external schedulers. That worker which should be runnning with a heroku's scheduler is for waking up an app from idling.

I'll try to start one of my logins from scratch and then hopefully will come up with some more ideas how to debug the issue.

gaynetdinov commented 8 years ago

Just tried to reconnect a login(for the first time ever) and saw that on reconnect SE sends customer_id field in the notify callback request as ID value from SE customer page, but usually, SE sends customer_id as CUSTOMER ID as shown here https://docs.saltedge.com/guides/callbacks.

ExMoney does not expect that, I will fix callbacks.

idanci commented 8 years ago

I also noticed that heroku branch is a bit behind master. Do you plan to sync master's features with heroku branch?

gaynetdinov commented 8 years ago

Yeah, that's a problem: I don't know how to handle heroku branch properly. Every time I sync heroku branch with master I do rebase and then push with --force. I could merge master in heroku branch all the time, but then it will become overloaded with merge commits really quickly.

Probably I need to merge heroku in master, because heroku probably should be the first option to deploy.

I just updated heroku branch and rebased it on master, so you will need to run git pull with --rebase option and then add --force when pushing to heroku.

I've added a field Saltedge ID to a user which represents customer's ID field, you will need to fill it in(I didn't come up with the way how to sync a user in ExMoney with a Customer on SE side yet). After that, you can try to reconnect your login and check the logs. Don't forget to run heroku run mix ecto.migrate after deployment and then heroku restart -a appname.

idanci commented 8 years ago

When you create a customer, you get his identifier in synchronous response, so you can just store that value somewhere. Or you can obtain it later calling GET | https://www.saltedge.com/api/v2/customers

gaynetdinov commented 8 years ago

Yeah, that's correct, I meant that according to ExMoney's workflow, a user should first create an account(a customer) in SE, so he can obtain a CUSTOMER ID. Then a user gets CUSTOMER ID from SE page and fills it in on Settings -> User Account page. Having CUSTOMER ID allows a user to create new logins using New link on Settings -> Saltedge Logins page. The New link goes to Saltedge Connect page. Without CUSTOMER ID, ExMoney cannot get a token, without a token a user cannot be redirected to Saltedge Connect.

As you can see in this workflow there is no point where ExMoney could sync a customer from SE since customer on SE side and a user on ExMoney side are created at different times. The workaround I introduced tomorrow to make Login reconnect work is to provide ID field from SE side as well, so a user have to fill in CUSTOMER ID and ID fields on Settings -> User Account page.

idanci commented 8 years ago

I mean that you don't have to force the user to visit his SE profile to obtain the customer id. You can just add a button like create customer which will make create customer request and sync its ID automatically. After then there's no problem to send create token request with all the necessary attributes. It takes time to implement and not so important, but doable :)

P.S. Deployed to heroku from your master, but had to clone config/prod.exc from heroku branch. Connected one new login but accounts still didn't show up (but SE has all the data). Also, deleting login from ex-money didn't delete the login from SE, had to delete it from SE profile manually. Maybe delete button should also send delete request to SE

gaynetdinov commented 8 years ago

It's more than clear to me that ExMoney should have an ability to visualize a process of adding/refreshing a login. I'll try to implement such feature during this weekend and will come to you.

idanci commented 8 years ago

If you need any additional information about SE integration or some tips about app workflows you can reach me directly via ivand@saltedge.com ;)

gaynetdinov commented 8 years ago

Oh great, thank you!

gaynetdinov commented 8 years ago

I just merged my pull-request so now if you go to Settings -> Saltedge Logins and click on a login name you will see a history of login refresh/sync operations. I hope this can help you to debug your issue. Also, you can sync each login separately by clicking on a 'Sync' link.

The change is on master and heroku branches, after deployment you will need to run heroku run mix ecto.migrate and then heroru restart -a app_name.

idanci commented 8 years ago

I'm confused... Which branch should I deploy? Last time I deployed heroku branch, last few days I run master branch on heroku. Is there any reason to keep the heroku branch?

gaynetdinov commented 8 years ago

If you're deploying to Heroku you should use a heroku branch. There are some changes between heroku branch master branches:

All these changes are not needed if you're deploying to VPS, that's why I have to have two branches: one for VPS, one for Heroku.