Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revamp transaction details submission & monitoring
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