clear cookie if completed
This commit is contained in:
22
main.go
22
main.go
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user