add receipt page for plan
This commit is contained in:
parent
5ab6ad85f7
commit
48098ba817
@ -277,3 +277,9 @@ func (app *application) BronzePlan(w http.ResponseWriter, r *http.Request) {
|
||||
app.errorLog.Println(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (app *application) BronzePlanReceipt(w http.ResponseWriter, r *http.Request) {
|
||||
if err := app.renderTemplate(w, r, "receipt-plan", &templateData{}); err != nil {
|
||||
app.errorLog.Println(err)
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ func (app *application) routes() http.Handler {
|
||||
mux.Post("/payment-succeeded", app.PaymentSucceeded)
|
||||
|
||||
mux.Get("/plans/bronze", app.BronzePlan)
|
||||
mux.Get("/receipt/bronze", app.BronzePlanReceipt)
|
||||
|
||||
fileServer := http.FileServer(http.Dir("./static"))
|
||||
mux.Handle("/static/*", http.StripPrefix("/static", fileServer))
|
||||
|
@ -66,8 +66,12 @@ function stripePaymentMethodHandler(result, plan_id, api) {
|
||||
.then(function (data) {
|
||||
console.log(data);
|
||||
processing.classList.add("d-none");
|
||||
// set hidden vars
|
||||
// submit the form
|
||||
showCardSuccess();
|
||||
sessionStorage.first_name = document.getElementById("first-name").value;
|
||||
sessionStorage.last_name = document.getElementById("last-name").value;
|
||||
sessionStorage.amount = document.getElementById("amount").value;
|
||||
sessionStorage.last_four = result.paymentMethod.card.last4;
|
||||
location.href = "/receipt/bronze";
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user