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