klarna as global
Some checks failed
Build and Publish / BuildAndDeploy (push) Successful in 3m19s
Build and Publish / BuildAndDeployAmd64 (push) Has been cancelled

This commit is contained in:
matst80
2025-04-18 20:58:18 +02:00
parent 6c2328495b
commit 19bbf32e68
3 changed files with 33 additions and 22 deletions

View File

@@ -1,7 +1,6 @@
package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
@@ -19,11 +18,10 @@ type PoolServer struct {
klarnaClient *KlarnaClient
}
func NewPoolServer(pool GrainPool, pod_name string, klarnaClient *KlarnaClient) *PoolServer {
func NewPoolServer(pool GrainPool, pod_name string) *PoolServer {
return &PoolServer{
pod_name: pod_name,
pool: pool,
klarnaClient: klarnaClient,
pod_name: pod_name,
pool: pool,
}
}
@@ -253,19 +251,13 @@ func (s *PoolServer) HandleCheckout(w http.ResponseWriter, r *http.Request, id C
return s.WriteResult(w, reply)
}
order, err := s.klarnaClient.CreateOrder(bytes.NewReader(reply.Payload))
// w.Header().Set("Content-Type", "application/json")
// w.Header().Set("X-Pod-Name", s.pod_name)
// w.Header().Set("Cache-Control", "no-cache")
// w.Header().Set("Access-Control-Allow-Origin", "*")
// w.WriteHeader(http.StatusOK)
if nil != err {
return err
}
w.Header().Set("Content-Type", "application/json")
w.Header().Set("X-Pod-Name", s.pod_name)
w.Header().Set("Cache-Control", "no-cache")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.WriteHeader(http.StatusOK)
return json.NewEncoder(w).Encode(order)
return s.WriteResult(w, reply)
}
func NewCartId() CartId {