From 2be13462c9e05964f5be4973bc0ebe9046517c00 Mon Sep 17 00:00:00 2001 From: matst80 Date: Thu, 4 Dec 2025 23:01:29 +0100 Subject: [PATCH] more --- pkg/checkout/checkout-grain.go | 1 + pkg/checkout/mutation_payment_declined.go | 1 + pkg/checkout/mutation_payment_started.go | 2 ++ 3 files changed, 4 insertions(+) diff --git a/pkg/checkout/checkout-grain.go b/pkg/checkout/checkout-grain.go index adfe171..7713df8 100644 --- a/pkg/checkout/checkout-grain.go +++ b/pkg/checkout/checkout-grain.go @@ -102,6 +102,7 @@ type CheckoutGrain struct { Deliveries []*CheckoutDelivery `json:"deliveries,omitempty"` PaymentInProgress uint16 `json:"paymentInProgress"` AmountInCentsRemaining int64 `json:"amountRemaining"` + AmountInCentsStarted int64 `json:"amountPaid"` InventoryReserved bool `json:"inventoryReserved"` Confirmation *ConfirmationStatus `json:"confirmationViewed,omitempty"` Payments []*Payment `json:"payments,omitempty"` diff --git a/pkg/checkout/mutation_payment_declined.go b/pkg/checkout/mutation_payment_declined.go index dcccb9c..1a23ecf 100644 --- a/pkg/checkout/mutation_payment_declined.go +++ b/pkg/checkout/mutation_payment_declined.go @@ -23,6 +23,7 @@ func HandlePaymentDeclined(g *CheckoutGrain, m *messages.PaymentDeclined) error payment.CompletedAt = asPointer(time.Now()) payment.Status = "failed" g.PaymentInProgress-- + g.AmountInCentsStarted -= payment.Amount return nil } diff --git a/pkg/checkout/mutation_payment_started.go b/pkg/checkout/mutation_payment_started.go index 4f983e9..0144792 100644 --- a/pkg/checkout/mutation_payment_started.go +++ b/pkg/checkout/mutation_payment_started.go @@ -77,6 +77,8 @@ func HandlePaymentStarted(g *CheckoutGrain, m *messages.PaymentStarted) error { }) } + g.AmountInCentsStarted += m.Amount + return nil }