test checkout and confirmation as webpages
Some checks failed
Build and Publish / BuildAndDeploy (push) Successful in 3m18s
Build and Publish / BuildAndDeployAmd64 (push) Has been cancelled

This commit is contained in:
matst80
2025-05-13 18:08:00 +02:00
parent ea173260b9
commit 79fc990a98

21
main.go
View File

@@ -242,6 +242,27 @@ func main() {
log.Printf("Error executing template: %v\n", err)
}
})
mux.HandleFunc("/confirmation/{order_id}", func(w http.ResponseWriter, r *http.Request) {
orderId := r.PathValue("order_id")
order, err := KlarnaInstance.GetOrder(orderId)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte(err.Error()))
return
}
t, err := template.New("confirmation").Parse(tpl)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte(err.Error()))
}
err = t.Execute(w, &order)
if err != nil {
log.Printf("Error executing template: %v\n", err)
}
})
mux.HandleFunc("/push", func(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost {