update
This commit is contained in:
@@ -111,13 +111,18 @@ type CartGrain struct {
|
||||
Notifications []CartNotification `json:"cartNotification,omitempty"`
|
||||
SubscriptionDetails map[string]*SubscriptionDetails `json:"subscriptionDetails,omitempty"`
|
||||
PaymentDeclinedNotices []Notice `json:"paymentDeclinedNotices,omitempty"`
|
||||
ConfirmationViewCount int `json:"confirmationViewCount,omitempty"`
|
||||
ConfirmationLastViewedAt time.Time `json:"confirmationLastViewedAt,omitempty"`
|
||||
Confirmation *ConfirmationStatus `json:"confirmation,omitempty"`
|
||||
CheckoutOrderId string `json:"checkoutOrderId,omitempty"`
|
||||
CheckoutStatus string `json:"checkoutStatus,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 {
|
||||
Code string `json:"code"`
|
||||
Applied bool `json:"applied"`
|
||||
|
||||
@@ -7,7 +7,15 @@ import (
|
||||
)
|
||||
|
||||
func ConfirmationViewed(grain *CartGrain, req *messages.ConfirmationViewed) error {
|
||||
grain.ConfirmationViewCount++
|
||||
grain.ConfirmationLastViewedAt = time.Now()
|
||||
if grain.Confirmation == nil {
|
||||
grain.Confirmation = &ConfirmationStatus{
|
||||
ViewCount: 1,
|
||||
LastViewedAt: time.Now(),
|
||||
}
|
||||
} else {
|
||||
grain.Confirmation.ViewCount++
|
||||
grain.Confirmation.LastViewedAt = time.Now()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user