split cart and checkout and checkout vs payments
This commit is contained in:
26
pkg/checkout/mutation_confirmation_viewed.go
Normal file
26
pkg/checkout/mutation_confirmation_viewed.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package checkout
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
messages "git.k6n.net/go-cart-actor/proto/checkout"
|
||||
)
|
||||
|
||||
func HandleConfirmationViewed(g *CheckoutGrain, m *messages.ConfirmationViewed) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("ConfirmationViewed: nil payload")
|
||||
}
|
||||
|
||||
if g.Confirmation != nil {
|
||||
g.Confirmation = &ConfirmationStatus{
|
||||
ViewCount: 1,
|
||||
LastViewedAt: time.Now(),
|
||||
}
|
||||
} else {
|
||||
g.Confirmation.ViewCount++
|
||||
g.Confirmation.LastViewedAt = time.Now()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user