update
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 43s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m44s

This commit is contained in:
matst80
2025-12-04 17:51:00 +01:00
parent ce81e294f2
commit dcc7cc2dd0

View File

@@ -454,7 +454,7 @@ func (s *CheckoutPoolServer) StartPaymentHandler(w http.ResponseWriter, r *http.
} }
// Apply PaymentStarted mutation // Apply PaymentStarted mutation
res, err := s.ApplyLocal(r.Context(), checkoutId, &messages.PaymentStarted{ _, err = s.ApplyLocal(r.Context(), checkoutId, &messages.PaymentStarted{
PaymentId: session.Id, PaymentId: session.Id,
Amount: session.Amount.Value, Amount: session.Amount.Value,
Currency: session.Amount.Currency, Currency: session.Amount.Currency,
@@ -467,7 +467,7 @@ func (s *CheckoutPoolServer) StartPaymentHandler(w http.ResponseWriter, r *http.
return err return err
} }
return s.WriteResult(w, res) return s.WriteResult(w, session)
case "klarna": case "klarna":
order, err := s.CreateOrUpdateCheckout(r, grain, nil) 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) logger.Error("unable to create klarna session", "error", err)
return err return err
} }
res, err := s.ApplyLocal(r.Context(), checkoutId, &messages.PaymentStarted{ _, err = s.ApplyLocal(r.Context(), checkoutId, &messages.PaymentStarted{
PaymentId: order.ID, PaymentId: order.ID,
Amount: int64(order.OrderAmount), Amount: int64(order.OrderAmount),
Currency: order.PurchaseCurrency, Currency: order.PurchaseCurrency,
@@ -483,7 +483,12 @@ func (s *CheckoutPoolServer) StartPaymentHandler(w http.ResponseWriter, r *http.
Method: &payload.Method, Method: &payload.Method,
StartedAt: timestamppb.New(time.Now()), 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: default:
http.Error(w, "unsupported payment provider", http.StatusBadRequest) http.Error(w, "unsupported payment provider", http.StatusBadRequest)