From dcc7cc2dd00bbd71984a69e580ec80ecb0d80b75 Mon Sep 17 00:00:00 2001 From: matst80 Date: Thu, 4 Dec 2025 17:51:00 +0100 Subject: [PATCH] update --- cmd/checkout/pool-server.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cmd/checkout/pool-server.go b/cmd/checkout/pool-server.go index 66d1ca2..96e101b 100644 --- a/cmd/checkout/pool-server.go +++ b/cmd/checkout/pool-server.go @@ -454,7 +454,7 @@ func (s *CheckoutPoolServer) StartPaymentHandler(w http.ResponseWriter, r *http. } // Apply PaymentStarted mutation - res, err := s.ApplyLocal(r.Context(), checkoutId, &messages.PaymentStarted{ + _, err = s.ApplyLocal(r.Context(), checkoutId, &messages.PaymentStarted{ PaymentId: session.Id, Amount: session.Amount.Value, Currency: session.Amount.Currency, @@ -467,7 +467,7 @@ func (s *CheckoutPoolServer) StartPaymentHandler(w http.ResponseWriter, r *http. return err } - return s.WriteResult(w, res) + return s.WriteResult(w, session) case "klarna": order, err := s.CreateOrUpdateCheckout(r, grain, nil) @@ -475,7 +475,7 @@ func (s *CheckoutPoolServer) StartPaymentHandler(w http.ResponseWriter, r *http. logger.Error("unable to create klarna session", "error", err) return err } - res, err := s.ApplyLocal(r.Context(), checkoutId, &messages.PaymentStarted{ + _, err = s.ApplyLocal(r.Context(), checkoutId, &messages.PaymentStarted{ PaymentId: order.ID, Amount: int64(order.OrderAmount), Currency: order.PurchaseCurrency, @@ -483,7 +483,12 @@ func (s *CheckoutPoolServer) StartPaymentHandler(w http.ResponseWriter, r *http. Method: &payload.Method, StartedAt: timestamppb.New(time.Now()), }) - return s.WriteResult(w, res) + if err != nil { + logger.Error("unable to apply payment started mutation", "error", err) + return err + } + + return s.WriteResult(w, order) default: http.Error(w, "unsupported payment provider", http.StatusBadRequest)