fix
Some checks failed
Build and Publish / BuildAndDeployAmd64 (push) Has been cancelled
Build and Publish / BuildAndDeployArm64 (push) Has started running

This commit is contained in:
matst80
2025-12-04 18:02:06 +01:00
parent dcc7cc2dd0
commit 3becd1c80c
8 changed files with 340 additions and 181 deletions

View File

@@ -1,6 +1,7 @@
package checkout
import (
"encoding/json"
"fmt"
"strings"
"time"
@@ -52,19 +53,23 @@ func HandlePaymentStarted(g *CheckoutGrain, m *messages.PaymentStarted) error {
if method != nil {
payment.Method = method
}
if m.SessionData != nil {
payment.SessionData = (*json.RawMessage)(&m.SessionData.Value)
}
payment.StartedAt = &startedAt
payment.CompletedAt = nil
payment.ProcessorReference = nil
} else {
g.PaymentInProgress++
g.Payments = append(g.Payments, &Payment{
PaymentId: paymentID,
Status: "pending",
Amount: m.Amount,
Currency: currency,
Provider: provider,
Method: method,
StartedAt: &startedAt,
PaymentId: paymentID,
Status: "pending",
Amount: m.Amount,
SessionData: (*json.RawMessage)(&m.SessionData.Value),
Currency: currency,
Provider: provider,
Method: method,
StartedAt: &startedAt,
})
}