Skip to content

Commit

Permalink
Warn more to not close pop-up or page during payment
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanberckmans committed Jul 11, 2024
1 parent 980b16c commit 851523b
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion 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.b5bad16770ff7a2f335b.js",
"main.js": "/static/pretix_eth/web3modal-dist/web3modal.188eafb69c8869265210.js",
"periodicCheck.js": "/static/pretix_eth/web3modal-dist/web3modal.a234c18f76a118072ed6.js",
"web3modal.js.map": "/static/pretix_eth/web3modal-dist/web3modal.a234c18f76a118072ed6.js.map"
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

4 changes: 2 additions & 2 deletions pretix_eth/web3modal/src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ async function makePayment() {
// }

make3citiesIframe({
tcBaseUrl: 'https://3cities.xyz/#/pay?c=CAESFGdAb29187sroN7d8mdtO6b1XHAPIgICASoCARA6DEVUSCBXRVRIIERBSUowAQoBAAoEAgEGAQoIBAUDCgUDBAMFAgoHBwcHBwcHCgUJAQQECggBBAUHCgMEBAQD', // this is a production payment link with baked in settings: single receiver address 0x67406f6F75F3Bb2bA0DeDdf2676D3bA6F55C700F; chain allowlist: Ethereum Mainnet, OP Mainnet, Arbitrum One, Scroll, Linea, Zora, Base, Blast, Mode; TODO add zkSync Era after multi receiver address is implemented and Taiko; TODO add Polygon zkEVM after the payment bugs on it are fixed; token allowlist: ETH, WETH, DAI; TODO add USDC, USDT, LUSD, USDP, PYUSD, GUSD after legal approval; TODO add USDGLO to 3cities --> TODO pass chain/token allowlist as URL params sourced from plugin config
tcBaseUrl: 'https://3cities.xyz/#/pay?c=CAESFKwNd1PqKBZQG1f66a1mVzkBg4SzIgICASoCARA6DEVUSCBXRVRIIERBSUowAQoBAAoEAgEGAQoIBAUDCgUDBAMFAgoHBwcHBwcHCgUJAQQECggBBAUHCgMEBAQDWinwn6eQIEtlZXAgdGhpcyBwb3AtdXAgb3BlbiBkdXJpbmcgc2lnbmluZw', // this is a production payment link with baked in settings: single receiver address 0x67406f6F75F3Bb2bA0DeDdf2676D3bA6F55C700F; chain allowlist: Ethereum Mainnet, OP Mainnet, Arbitrum One, Scroll, Linea, Zora, Base, Blast, Mode; TODO add zkSync Era after multi receiver address is implemented and Taiko; TODO add Polygon zkEVM after the payment bugs on it are fixed; token allowlist: ETH, WETH, DAI; TODO add USDC, USDT, LUSD, USDP, PYUSD, GUSD after legal approval; TODO add USDGLO to 3cities --> TODO pass chain/token allowlist as URL params sourced from plugin config
receiverAddress: GlobalPretixEthState.paymentDetails['recipient_address'],
paymentLogicalAssetAmountInUsd: GlobalPretixEthState.paymentDetails['amount'],
primaryCurrency: GlobalPretixEthState.paymentDetails['primary_currency'],
Expand Down Expand Up @@ -168,7 +168,7 @@ async function scheduleTransactionDetailsForServerSubmission(transactionDetailsF
try {
await addPendingTransactionDetails({ transactionDetailsUrlSearchParams: usp });
} catch (error) {
showError(`!!! Critical error: payment was sent but details were lost. Please email these details to support: ${JSON.stringify(usp)} Error: ${error}`, true);
showError(`🚨🚨🚨🚨🚨🚨 Critical error: payment was sent but details were lost. Please email these details to support: ${JSON.stringify(usp)} Error: ${error}`, true);
}
}

Expand Down
6 changes: 5 additions & 1 deletion pretix_eth/web3modal/src/transactionDetailsBuffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ export async function monitorAndSubmitPendingTransactionDetails(attempt = 1) {
throw new Error('transaction details submission fetch response not OK');
}
} catch (error) {
showError(`Do not close this window yet! There was an error processing your payment. We will re-try shortly. If this error does not go away, please contact support. Save these details: Your payment was sent in transaction ${txDetailsToSubmit.transactionHash} on ${txDetailsToSubmit.chainName} (chain ID ${txDetailsToSubmit.chainId}). Receipt link ${txDetailsToSubmit.receiptUrl}.`, false);
(() => { // pending transaction details were detected for this page's order ID, so paying again would result in a duplicate payment, and submitting these pending details to the server had an error, so we must hide the pay button to prevent duplicate payments. NB the pay button is hidden by another mechanism if pending details server submission is successful, so here we only worry about hiding the button iff pending tx details for this order ID exist but submission failed
const payBtn = document.getElementById("btn-pay");
if (payBtn) payBtn.style.display = 'none';
})();
showError(`🚨🚨🚨 Do not close this window yet! There was an error processing your payment. We will re-try shortly. If this error does not go away, please contact support. Save these details: Your payment was sent in transaction ${txDetailsToSubmit.transactionHash} on ${txDetailsToSubmit.chainName} (chain ID ${txDetailsToSubmit.chainId}). Receipt link ${txDetailsToSubmit.receiptUrl}.`, false);
nextAttempt = attempt + 1; // submission POST failed, so we will retry with exponential backoff, where exponential backoff is enabled by incrementing current attempt count
}
}
Expand Down

0 comments on commit 851523b

Please sign in to comment.