clear cookie if completed
Some checks failed
Build and Publish / BuildAndDeploy (push) Failing after 2m58s
Build and Publish / BuildAndDeployAmd64 (push) Has been cancelled

This commit is contained in:
matst80
2025-05-13 20:24:08 +02:00
parent 8d26c35f61
commit 7a5f1e3609

22
main.go
View File

@@ -259,6 +259,16 @@ func main() {
} }
w.Header().Set("Content-Type", "text/html; charset=utf-8") w.Header().Set("Content-Type", "text/html; charset=utf-8")
if order.Status == "checkout_complete" {
http.SetCookie(w, &http.Cookie{
Name: "cartid",
Value: "",
Path: "/",
Expires: time.Unix(0, 0),
SameSite: http.SameSiteLaxMode,
})
}
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
w.Write([]byte(fmt.Sprintf(tpl, order.HTMLSnippet))) w.Write([]byte(fmt.Sprintf(tpl, order.HTMLSnippet)))
}) })
@@ -304,12 +314,12 @@ func main() {
return return
} }
err = confirmOrder(order, orderHandler) //err = confirmOrder(order, orderHandler)
if err != nil { //if err != nil {
log.Printf("Error confirming order: %v\n", err) // log.Printf("Error confirming order: %v\n", err)
w.WriteHeader(http.StatusInternalServerError) // w.WriteHeader(http.StatusInternalServerError)
return // return
} //}
err = triggerOrderCompleted(err, syncedServer, order) err = triggerOrderCompleted(err, syncedServer, order)
if err != nil { if err != nil {