34 lines
1.0 KiB
Go
34 lines
1.0 KiB
Go
package checkout
|
|
|
|
import (
|
|
"git.k6n.net/go-cart-actor/pkg/actor"
|
|
)
|
|
|
|
type CheckoutMutationContext struct {
|
|
// Add any services needed, e.g., for delivery calculations, but since inventory is pre-handled, maybe none
|
|
}
|
|
|
|
func NewCheckoutMutationContext() *CheckoutMutationContext {
|
|
return &CheckoutMutationContext{}
|
|
}
|
|
|
|
func NewCheckoutMutationRegistry(ctx *CheckoutMutationContext) actor.MutationRegistry {
|
|
reg := actor.NewMutationRegistry()
|
|
reg.RegisterMutations(
|
|
actor.NewMutation(HandleInitializeCheckout),
|
|
actor.NewMutation(HandlePaymentStarted),
|
|
actor.NewMutation(HandlePaymentCompleted),
|
|
actor.NewMutation(HandlePaymentDeclined),
|
|
actor.NewMutation(HandlePaymentEvent),
|
|
actor.NewMutation(HandleConfirmationViewed),
|
|
actor.NewMutation(HandleOrderCreated),
|
|
actor.NewMutation(HandleInventoryReserved),
|
|
actor.NewMutation(HandleSetDelivery),
|
|
actor.NewMutation(HandleSetPickupPoint),
|
|
actor.NewMutation(HandleRemoveDelivery),
|
|
actor.NewMutation(HandleContactDetailsUpdated),
|
|
actor.NewMutation(HandlePaymentCancelled),
|
|
)
|
|
return reg
|
|
}
|