better
This commit is contained in:
@@ -35,6 +35,11 @@ func HandlePaymentStarted(g *CheckoutGrain, m *messages.PaymentStarted) error {
|
||||
|
||||
payment, found := g.FindPayment(paymentID)
|
||||
|
||||
var sessionData *json.RawMessage
|
||||
if m.SessionData != nil {
|
||||
sessionData = (*json.RawMessage)(&m.SessionData.Value)
|
||||
}
|
||||
|
||||
if found {
|
||||
if payment.Status != "pending" {
|
||||
return fmt.Errorf("PaymentStarted: payment already started")
|
||||
@@ -54,7 +59,7 @@ func HandlePaymentStarted(g *CheckoutGrain, m *messages.PaymentStarted) error {
|
||||
payment.Method = method
|
||||
}
|
||||
if m.SessionData != nil {
|
||||
payment.SessionData = (*json.RawMessage)(&m.SessionData.Value)
|
||||
payment.SessionData = sessionData
|
||||
}
|
||||
payment.StartedAt = &startedAt
|
||||
|
||||
@@ -64,7 +69,7 @@ func HandlePaymentStarted(g *CheckoutGrain, m *messages.PaymentStarted) error {
|
||||
PaymentId: paymentID,
|
||||
Status: "pending",
|
||||
Amount: m.Amount,
|
||||
SessionData: (*json.RawMessage)(&m.SessionData.Value),
|
||||
SessionData: sessionData,
|
||||
Currency: currency,
|
||||
Provider: provider,
|
||||
Method: method,
|
||||
|
||||
Reference in New Issue
Block a user