update
Some checks failed
Build and Publish / BuildAndDeployAmd64 (push) Successful in 45s
Build and Publish / BuildAndDeployArm64 (push) Has been cancelled

This commit is contained in:
matst80
2025-11-20 22:37:01 +01:00
parent a01feb615b
commit c859796b1e
2 changed files with 41 additions and 28 deletions

View File

@@ -90,32 +90,37 @@ type Marking struct {
} }
type CartGrain struct { type CartGrain struct {
mu sync.RWMutex mu sync.RWMutex
lastItemId uint32 lastItemId uint32
lastDeliveryId uint32 lastDeliveryId uint32
lastVoucherId uint32 lastVoucherId uint32
lastAccess time.Time lastAccess time.Time
lastChange time.Time // unix seconds of last successful mutation (replay sets from event ts) lastChange time.Time // unix seconds of last successful mutation (replay sets from event ts)
userId string userId string
InventoryReserved bool `json:"inventoryReserved"` InventoryReserved bool `json:"inventoryReserved"`
Id CartId `json:"id"` Id CartId `json:"id"`
Items []*CartItem `json:"items"` Items []*CartItem `json:"items"`
TotalPrice *Price `json:"totalPrice"` TotalPrice *Price `json:"totalPrice"`
TotalDiscount *Price `json:"totalDiscount"` TotalDiscount *Price `json:"totalDiscount"`
Deliveries []*CartDelivery `json:"deliveries,omitempty"` Deliveries []*CartDelivery `json:"deliveries,omitempty"`
Processing bool `json:"processing"` Processing bool `json:"processing"`
PaymentInProgress bool `json:"paymentInProgress"` PaymentInProgress bool `json:"paymentInProgress"`
OrderReference string `json:"orderReference,omitempty"` OrderReference string `json:"orderReference,omitempty"`
PaymentStatus string `json:"paymentStatus,omitempty"` PaymentStatus string `json:"paymentStatus,omitempty"`
Vouchers []*Voucher `json:"vouchers,omitempty"` Vouchers []*Voucher `json:"vouchers,omitempty"`
Notifications []CartNotification `json:"cartNotification,omitempty"` Notifications []CartNotification `json:"cartNotification,omitempty"`
SubscriptionDetails map[string]*SubscriptionDetails `json:"subscriptionDetails,omitempty"` SubscriptionDetails map[string]*SubscriptionDetails `json:"subscriptionDetails,omitempty"`
PaymentDeclinedNotices []Notice `json:"paymentDeclinedNotices,omitempty"` PaymentDeclinedNotices []Notice `json:"paymentDeclinedNotices,omitempty"`
ConfirmationViewCount int `json:"confirmationViewCount,omitempty"` Confirmation *ConfirmationStatus `json:"confirmation,omitempty"`
ConfirmationLastViewedAt time.Time `json:"confirmationLastViewedAt,omitempty"` CheckoutOrderId string `json:"checkoutOrderId,omitempty"`
CheckoutOrderId string `json:"checkoutOrderId,omitempty"` CheckoutStatus string `json:"checkoutStatus,omitempty"`
CheckoutStatus string `json:"checkoutStatus,omitempty"` CheckoutCountry string `json:"checkoutCountry,omitempty"`
CheckoutCountry string `json:"checkoutCountry,omitempty"` }
type ConfirmationStatus struct {
Code *string `json:"code,omitempty"`
ViewCount int `json:"viewCount"`
LastViewedAt time.Time `json:"lastViewedAt"`
} }
type Voucher struct { type Voucher struct {

View File

@@ -7,7 +7,15 @@ import (
) )
func ConfirmationViewed(grain *CartGrain, req *messages.ConfirmationViewed) error { func ConfirmationViewed(grain *CartGrain, req *messages.ConfirmationViewed) error {
grain.ConfirmationViewCount++ if grain.Confirmation == nil {
grain.ConfirmationLastViewedAt = time.Now() grain.Confirmation = &ConfirmationStatus{
ViewCount: 1,
LastViewedAt: time.Now(),
}
} else {
grain.Confirmation.ViewCount++
grain.Confirmation.LastViewedAt = time.Now()
}
return nil return nil
} }