more
Some checks failed
Build and Publish / BuildAndDeployAmd64 (push) Has been cancelled
Build and Publish / BuildAndDeployArm64 (push) Has been cancelled

This commit is contained in:
matst80
2025-12-04 23:01:29 +01:00
parent 7964e8b849
commit 2be13462c9
3 changed files with 4 additions and 0 deletions

View File

@@ -102,6 +102,7 @@ type CheckoutGrain struct {
Deliveries []*CheckoutDelivery `json:"deliveries,omitempty"` Deliveries []*CheckoutDelivery `json:"deliveries,omitempty"`
PaymentInProgress uint16 `json:"paymentInProgress"` PaymentInProgress uint16 `json:"paymentInProgress"`
AmountInCentsRemaining int64 `json:"amountRemaining"` AmountInCentsRemaining int64 `json:"amountRemaining"`
AmountInCentsStarted int64 `json:"amountPaid"`
InventoryReserved bool `json:"inventoryReserved"` InventoryReserved bool `json:"inventoryReserved"`
Confirmation *ConfirmationStatus `json:"confirmationViewed,omitempty"` Confirmation *ConfirmationStatus `json:"confirmationViewed,omitempty"`
Payments []*Payment `json:"payments,omitempty"` Payments []*Payment `json:"payments,omitempty"`

View File

@@ -23,6 +23,7 @@ func HandlePaymentDeclined(g *CheckoutGrain, m *messages.PaymentDeclined) error
payment.CompletedAt = asPointer(time.Now()) payment.CompletedAt = asPointer(time.Now())
payment.Status = "failed" payment.Status = "failed"
g.PaymentInProgress-- g.PaymentInProgress--
g.AmountInCentsStarted -= payment.Amount
return nil return nil
} }

View File

@@ -77,6 +77,8 @@ func HandlePaymentStarted(g *CheckoutGrain, m *messages.PaymentStarted) error {
}) })
} }
g.AmountInCentsStarted += m.Amount
return nil return nil
} }