fix
This commit is contained in:
@@ -452,13 +452,21 @@ func (s *CheckoutPoolServer) StartPaymentHandler(w http.ResponseWriter, r *http.
|
||||
logger.Error("unable to create adyen session", "error", err)
|
||||
return err
|
||||
}
|
||||
|
||||
sessionBytes, err := json.Marshal(session)
|
||||
if err != nil {
|
||||
logger.Error("unable to marshal session", "error", err)
|
||||
return err
|
||||
}
|
||||
// Apply PaymentStarted mutation
|
||||
_, err = s.ApplyLocal(r.Context(), checkoutId, &messages.PaymentStarted{
|
||||
PaymentId: session.Id,
|
||||
Amount: session.Amount.Value,
|
||||
Currency: session.Amount.Currency,
|
||||
Provider: "adyen",
|
||||
SessionData: &anypb.Any{
|
||||
TypeUrl: "type.googleapis.com/google.protobuf.StringValue",
|
||||
Value: sessionBytes,
|
||||
},
|
||||
Method: &payload.Method,
|
||||
StartedAt: timestamppb.New(time.Now()),
|
||||
})
|
||||
@@ -475,12 +483,21 @@ func (s *CheckoutPoolServer) StartPaymentHandler(w http.ResponseWriter, r *http.
|
||||
logger.Error("unable to create klarna session", "error", err)
|
||||
return err
|
||||
}
|
||||
orderBytes, err := json.Marshal(order)
|
||||
if err != nil {
|
||||
logger.Error("unable to marshal order", "error", err)
|
||||
return err
|
||||
}
|
||||
_, err = s.ApplyLocal(r.Context(), checkoutId, &messages.PaymentStarted{
|
||||
PaymentId: order.ID,
|
||||
Amount: int64(order.OrderAmount),
|
||||
Currency: order.PurchaseCurrency,
|
||||
Provider: "klarna",
|
||||
Method: &payload.Method,
|
||||
SessionData: &anypb.Any{
|
||||
TypeUrl: "type.googleapis.com/google.protobuf.StringValue",
|
||||
Value: orderBytes,
|
||||
},
|
||||
StartedAt: timestamppb.New(time.Now()),
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user