Skip to content

Commit

Permalink
Revamp transaction details submission & monitoring
Browse files Browse the repository at this point in the history
Background:

When the user signs a payment transaction, 3cities will provide those
transaction details to the pretix clientside webpage via iframe message
passing.

Those transaction details must then be successfully submitted to the
pretix server.

If submission fails for any reason, the payment details will be lost,
and then the payment can't automatically confirm, and worse, there will
be no record at all that the user ever paid. So the user will have paid
money for nothing, and must reconcile by contacting support.

Before this revamp, transaction details received via iframe message
passing would be submitted to the pretix server. Any submission errors
would result in retrying in perpetuity with exponential backoff.

However, the retry system before this revamp was only in-memory and
transaction details would be permanently lost if the user refreshed the
page prior to success.

With this revamp, transaction details received by 3cities iframe msg
will be immediately saved into local storage before any server
submission is attempted. Then, a monitoring system will detect pending
transaction details and attempt server submission.

This new monitoring system is resilient to page refreshes, network
outages, and multiple concurrent pending orders made by the customer on
the same device.

All the user must do is keep their order page open (or open it again if
closed) and then any saved pending transaction details will be submitted
automatically and marked as submitted.

If the transaction details are received by 3cities iframe msg but saving
them into local storage fails, then payment details have been
permanently lost (the user paid money for nothing), and a "critical
error" is displayed to the user and asks them to contact support.

Note that we use the great 'localForage' library which abstracts over
local storage adapters to make this solution cross-platform, so the
actual storage used might be localStorage, IndexedDB, etc.

Also, this fixes a bug where if the user loaded their order page after
they had successfully paid but before the payment was confirmed, then
payment confirmation would never be automatically detected without
refreshing the page.
  • Loading branch information
ryanberckmans committed Jul 10, 2024
1 parent 69a4d0f commit 980b16c
Show file tree
Hide file tree
Showing 15 changed files with 176 additions and 76 deletions.
6 changes: 3 additions & 3 deletions pretix_eth/static/pretix_eth/web3modal-dist/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"main.js": "/static/pretix_eth/web3modal-dist/web3modal.41f2ebb3989a6b3f7d46.js",
"periodicCheck.js": "/static/pretix_eth/web3modal-dist/web3modal.ebe91d40da5f60dacd9b.js",
"web3modal.js.map": "/static/pretix_eth/web3modal-dist/web3modal.ebe91d40da5f60dacd9b.js.map"
"main.js": "/static/pretix_eth/web3modal-dist/web3modal.b5bad16770ff7a2f335b.js",
"periodicCheck.js": "/static/pretix_eth/web3modal-dist/web3modal.a234c18f76a118072ed6.js",
"web3modal.js.map": "/static/pretix_eth/web3modal-dist/web3modal.a234c18f76a118072ed6.js.map"
}

This file was deleted.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*!
localForage -- Offline Storage, Improved
Version 1.10.0
https://localforage.github.io/localForage
(c) 2013-2017 Mozilla, Apache License 2.0
*/

Large diffs are not rendered by default.

Loading

0 comments on commit 980b16c

Please sign in to comment.