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