Show specific counts and amounts in confirmation bars
This commit is contained in:
3
main.go
3
main.go
@@ -367,7 +367,8 @@ func handleDonateSuccess(w http.ResponseWriter, r *http.Request) {
|
|||||||
log.Println("[ERROR] failed to process payment:", err)
|
log.Println("[ERROR] failed to process payment:", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
http.Redirect(w, r, fmt.Sprintf("/%s?donated=1", eventID), http.StatusSeeOther)
|
amount := float64(sess.AmountTotal) / 100
|
||||||
|
http.Redirect(w, r, fmt.Sprintf("/%s?donated=%.2f", eventID, amount), http.StatusSeeOther)
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleStripeWebhook(w http.ResponseWriter, r *http.Request) {
|
func handleStripeWebhook(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|||||||
@@ -179,7 +179,9 @@
|
|||||||
|
|
||||||
const eventId = 'afac26';
|
const eventId = 'afac26';
|
||||||
|
|
||||||
if (new URLSearchParams(location.search).get('donated') === '1') {
|
const donatedAmount = new URLSearchParams(location.search).get('donated');
|
||||||
|
if (donatedAmount) {
|
||||||
|
document.getElementById('thank-you').textContent = `Thank you for your $${parseFloat(donatedAmount).toFixed(2)} donation!`;
|
||||||
document.getElementById('thank-you').style.display = 'block';
|
document.getElementById('thank-you').style.display = 'block';
|
||||||
history.replaceState({}, '', location.pathname);
|
history.replaceState({}, '', location.pathname);
|
||||||
}
|
}
|
||||||
@@ -269,6 +271,8 @@
|
|||||||
location.href = data.url;
|
location.href = data.url;
|
||||||
} else {
|
} else {
|
||||||
updateUI(data);
|
updateUI(data);
|
||||||
|
const word = data.numPeople === 1 ? 'person' : 'people';
|
||||||
|
document.getElementById('rsvp-confirmed').textContent = `Your RSVP has been updated to ${data.numPeople} ${word}.`;
|
||||||
document.getElementById('rsvp-confirmed').style.display = 'block';
|
document.getElementById('rsvp-confirmed').style.display = 'block';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user