update stuff
This commit is contained in:
@@ -26,54 +26,54 @@ import (
|
||||
})
|
||||
*/
|
||||
|
||||
func (s *CheckoutPoolServer) KlarnaHtmlCheckoutHandler(w http.ResponseWriter, r *http.Request, checkoutId checkout.CheckoutId) error {
|
||||
// func (s *CheckoutPoolServer) KlarnaHtmlCheckoutHandler(w http.ResponseWriter, r *http.Request, checkoutId checkout.CheckoutId) error {
|
||||
|
||||
orderId := r.URL.Query().Get("order_id")
|
||||
var order *CheckoutOrder
|
||||
var err error
|
||||
if orderId == "" {
|
||||
order, err = s.CreateOrUpdateCheckout(r, checkoutId)
|
||||
if err != nil {
|
||||
logger.Error("unable to create klarna session", "error", err)
|
||||
return err
|
||||
}
|
||||
// s.ApplyKlarnaPaymentStarted(r.Context(), order, checkoutId)
|
||||
// orderId := r.URL.Query().Get("order_id")
|
||||
// var order *CheckoutOrder
|
||||
// var err error
|
||||
// if orderId == "" {
|
||||
// order, err = s.CreateOrUpdateCheckout(r, checkoutId)
|
||||
// if err != nil {
|
||||
// logger.Error("unable to create klarna session", "error", err)
|
||||
// return err
|
||||
// }
|
||||
// // s.ApplyKlarnaPaymentStarted(r.Context(), order, checkoutId)
|
||||
|
||||
}
|
||||
order, err = s.klarnaClient.GetOrder(r.Context(), orderId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
w.Header().Set("Permissions-Policy", "payment=(self \"https://js.stripe.com\" \"https://m.stripe.network\" \"https://js.playground.kustom.co\")")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
_, err = fmt.Fprintf(w, tpl, order.HTMLSnippet)
|
||||
return err
|
||||
// }
|
||||
// order, err = s.klarnaClient.GetOrder(r.Context(), orderId)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
// w.Header().Set("Permissions-Policy", "payment=(self \"https://js.stripe.com\" \"https://m.stripe.network\" \"https://js.playground.kustom.co\")")
|
||||
// w.WriteHeader(http.StatusOK)
|
||||
// _, err = fmt.Fprintf(w, tpl, order.HTMLSnippet)
|
||||
// return err
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
func (s *CheckoutPoolServer) KlarnaSessionHandler(w http.ResponseWriter, r *http.Request, checkoutId checkout.CheckoutId) error {
|
||||
// func (s *CheckoutPoolServer) KlarnaSessionHandler(w http.ResponseWriter, r *http.Request, checkoutId checkout.CheckoutId) error {
|
||||
|
||||
orderId := r.URL.Query().Get("order_id")
|
||||
var order *CheckoutOrder
|
||||
var err error
|
||||
if orderId == "" {
|
||||
order, err = s.CreateOrUpdateCheckout(r, checkoutId)
|
||||
if err != nil {
|
||||
logger.Error("unable to create klarna session", "error", err)
|
||||
return err
|
||||
}
|
||||
// s.ApplyKlarnaPaymentStarted(r.Context(), order, checkoutId)
|
||||
// orderId := r.URL.Query().Get("order_id")
|
||||
// var order *CheckoutOrder
|
||||
// var err error
|
||||
// if orderId == "" {
|
||||
// order, err = s.CreateOrUpdateCheckout(r, checkoutId)
|
||||
// if err != nil {
|
||||
// logger.Error("unable to create klarna session", "error", err)
|
||||
// return err
|
||||
// }
|
||||
// // s.ApplyKlarnaPaymentStarted(r.Context(), order, checkoutId)
|
||||
|
||||
}
|
||||
order, err = s.klarnaClient.GetOrder(r.Context(), orderId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
return json.NewEncoder(w).Encode(order)
|
||||
// }
|
||||
// order, err = s.klarnaClient.GetOrder(r.Context(), orderId)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
// return json.NewEncoder(w).Encode(order)
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
func (s *CheckoutPoolServer) KlarnaConfirmationHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user