Restore automatic redirect on payment confirmation via JavaScript polling
- Add redirect logic when status changes from non-confirmed to confirmed - Only redirect when detected via JavaScript polling, not when browsing to already-confirmed quote - Uses existing lastKnownStatus tracking to detect legitimate status changes - 2 second delay to show confirmation message before redirect - Fixes regression where payments stayed on quote page after confirmation
This commit is contained in:
parent
c3c05796da
commit
cb606256ce
1 changed files with 9 additions and 1 deletions
|
|
@ -372,13 +372,21 @@
|
|||
expiresEl.parentNode.style.display = 'none';
|
||||
}
|
||||
} else if (currentStatus === 'confirmed' || currentStatus === 'confirmed-overpaid') {
|
||||
// Payment confirmed - replace with invoice link and redirect
|
||||
// Payment confirmed - replace with invoice link
|
||||
replaceButtonsWithInvoiceLink(data.invoice_url);
|
||||
|
||||
// Hide countdown
|
||||
if (expiresEl && expiresEl.parentNode) {
|
||||
expiresEl.parentNode.style.display = 'none';
|
||||
}
|
||||
|
||||
// Redirect only if status changed from non-confirmed to confirmed (via polling)
|
||||
// Don't redirect if user browsed directly to already-confirmed quote
|
||||
if (lastKnownStatus && lastKnownStatus !== 'confirmed' && lastKnownStatus !== 'confirmed-overpaid' && data.redirect_url) {
|
||||
setTimeout(() => {
|
||||
window.location.href = data.redirect_url;
|
||||
}, 2000); // 2 second delay to show confirmation message
|
||||
}
|
||||
} else if (terminalStatuses.includes(currentStatus)) {
|
||||
// Terminal status - replace with invoice link
|
||||
replaceButtonsWithInvoiceLink(data.invoice_url);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue