update
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user