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

Duplicate transaction #26

Closed
dafyddj opened this issue Jun 11, 2017 · 17 comments
Closed

Duplicate transaction #26

dafyddj opened this issue Jun 11, 2017 · 17 comments
Assignees
Labels

Comments

@dafyddj
Copy link

dafyddj commented Jun 11, 2017

Hi,

I'm trying to get this to work with Monzo, but all my transactions are detected as duplicates. The only logging I see is:

2017-06-10T21:23:40.627213+00:00 app[web.1]: DEBUG:settings:A previous transaction for the payee Tesco has been found
2017-06-10T21:23:40.627384+00:00 app[web.1]: DEBUG:settings:A subcategory was not found for the previous transaction for Tesco
2017-06-10T21:23:40.627495+00:00 app[web.1]: DEBUG:settings:searching for payee Tesco
2017-06-10T21:23:40.627616+00:00 app[web.1]: DEBUG:settings:Creating transaction object
2017-06-10T21:23:40.632605+00:00 app[web.1]: DEBUG:settings:Duplicate detection
2017-06-10T21:23:40.637105+00:00 app[web.1]: DEBUG:settings:skipping due to duplicate transaction

I don't know if this is related to #19? Any ideas?

@rossdargan
Copy link
Collaborator

Are you using something like postman to post these results, or are you actually purchasing things?

@dafyddj
Copy link
Author

dafyddj commented Jun 12, 2017

These are actual purchases. I've just checked though, and it appears a top-up transaction has gone through.

@rossdargan
Copy link
Collaborator

The code duplication looks for transactions with the following:
Same Amount on the same date for the same payee.

Are there similar transactions for Tesco on the same day?

@dafyddj
Copy link
Author

dafyddj commented Jun 12, 2017

No, I've mostly had one transaction a day, and this message appears for all of them.

@rossdargan
Copy link
Collaborator

Is there anything else in the log?

@dafyddj
Copy link
Author

dafyddj commented Jun 12, 2017

Sorry, I didn't realise there was more logging than I included above. The full log for the latest transaction is here.

The salient bit seems to be:

2017-06-12T14:28:23.089267+00:00 app[web.1]: DEBUG:pynYNAB.Client:Client.push
2017-06-12T14:28:23.226300+00:00 app[web.1]: ERROR:Fintech to YNAB:Exception on /monzo [POST]
2017-06-12T14:28:23.226304+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
2017-06-12T14:28:23.226303+00:00 app[web.1]: Traceback (most recent call last):
2017-06-12T14:28:23.226322+00:00 app[web.1]:     response = self.full_dispatch_request()
2017-06-12T14:28:23.226324+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
2017-06-12T14:28:23.226325+00:00 app[web.1]:     rv = self.handle_user_exception(e)
2017-06-12T14:28:23.226325+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
2017-06-12T14:28:23.226327+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
2017-06-12T14:28:23.226326+00:00 app[web.1]:     reraise(exc_type, exc_value, tb)
2017-06-12T14:28:23.226328+00:00 app[web.1]:     rv = self.dispatch_request()
2017-06-12T14:28:23.226328+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
2017-06-12T14:28:23.226329+00:00 app[web.1]:     return self.view_functions[rule.endpoint](**req.view_args)
2017-06-12T14:28:23.226330+00:00 app[web.1]:     body, code = create_transaction_from_monzo(data['data'], settings, 0)
2017-06-12T14:28:23.226329+00:00 app[web.1]:   File "python/main.py", line 47, in route_monzo
2017-06-12T14:28:23.226331+00:00 app[web.1]:   File "python/main.py", line 188, in create_transaction_from_monzo
2017-06-12T14:28:23.226332+00:00 app[web.1]:     ynab_client.client.push(expected_delta)
2017-06-12T14:28:23.226333+00:00 app[web.1]:   File "/app/.heroku/src/pynynab/pynYNAB/Client.py", line 143, in push
2017-06-12T14:28:23.226333+00:00 app[web.1]:     raise WrongPushException(expected_delta, delta)
2017-06-12T14:28:23.226334+00:00 app[web.1]: WrongPushException
2017-06-12T14:28:23.235269+00:00 app[web.1]: INFO:werkzeug:10.10.130.233 - - [12/Jun/2017 14:28:23] "POST /monzo?secret=<redacted> HTTP/1.1" 500 -

@rossdargan
Copy link
Collaborator

It looks to me like two calls are being made at once. Can you check the webhooks in monzo and see if you have added the webhook twice please.

@rossdargan
Copy link
Collaborator

Never mind, checked the logs again and it doesn't appear like two calls are being made.

@rossdargan
Copy link
Collaborator

Ok. The issue here is for some reason we are back to getting WrongPushException when we add payees. I'll test with some dummy data and see if I can recreate. The duplicate detection is causing an issue because in our un-synchronised copy we do have the transaction added (it just never get's send to ynab).

@rossdargan rossdargan self-assigned this Jun 12, 2017
@rossdargan rossdargan added the bug label Jun 12, 2017
@rossdargan
Copy link
Collaborator

Looks connected to #24

@ganey
Copy link

ganey commented Jun 13, 2017

Also just had this issue today for a new payee.

Wondering if the transaction is only synced in the local copy after being successfully sent to YNAB?
It might improve the false duplication detection, but I'm not sure on what the implications might be.

@rossdargan
Copy link
Collaborator

I'm thinking there is an issue with adding new payees. I'll look into it when I get a second.

@scottrobertson
Copy link
Collaborator

I have added full request body logging so that we can easily debug these.

@rossdargan
Copy link
Collaborator

@scottrobertson I've confirmed this issue. Adding a new payee causes WrongPushException.

@scottrobertson
Copy link
Collaborator

@rossdargan can you try it again after the latest commits i just pushed

@rossdargan
Copy link
Collaborator

@scottrobertson yup... confirmed fixed :)

@scottrobertson
Copy link
Collaborator

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants