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

plaid: Handle DEFAULT_UPDATE and TRANSACTIONS_REMOVED webhooks. #144

Closed
2 tasks done
elliotcourant opened this issue Oct 26, 2021 · 0 comments
Closed
2 tasks done
Labels
api Related to or caused by the backend Go REST API. enhancement New feature or request plaid Anything to do with the Plaid integration. production Something needed for initial production release. transactions

Comments

@elliotcourant
Copy link
Member

elliotcourant commented Oct 26, 2021

Handle Transactions webhooks DEFAULT_UPDATE and TRANSACTIONS_REMOVED if your app needs to keep Transactions data up-to-date. For more details, see Handling Transaction webhooks.

  • DEFAULT_UPDATE is currently handled by retrieving the last 7 days worth of transactions for the specified item ID. If it is guaranteed that the new transactions are always the first ones to be returned, then we could set the limit of our request to the number of new transactions to improve efficiency.
  • TRANSACTIONS_REMOVED is completely implemented however need to be checked for correctness, at the time of writing this it had a bug that prevented it from working. Update as needed.

There is a small issue here with the implementation.

We often receive the TRANSACTIONS_REMOVED webhook before the default update. This means that if a pending transaction has a "spent from" then it is lost when the non-pending transaction is created.

With how closely these webhooks can be dispatched I'm concerned that it might be hard to mitigate this behavior.

My thought is that when the TRANSACTIONS_REMOVED webhook is received we cache the spent from for the removed transaction in redis with a short TTL. Then in the DEFAULT_UPDATE webhook handling we check for the pending_transaction_id in redis and see if it has a spent from. If it does then we allocate that spending automatically.

My worry is that if these webhooks are not handled one after another, or if they are handling in the wrong order or at the same time then this behavior will be inconsistent at best.


ORIGINAL: monetr/rest-api#169

@elliotcourant elliotcourant added plaid Anything to do with the Plaid integration. transactions enhancement New feature or request production Something needed for initial production release. api Related to or caused by the backend Go REST API. labels Oct 26, 2021
@elliotcourant elliotcourant added this to the Plaid Production milestone Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Related to or caused by the backend Go REST API. enhancement New feature or request plaid Anything to do with the Plaid integration. production Something needed for initial production release. transactions
Projects
None yet
Development

No branches or pull requests

1 participant