refactor/checkout (#8)
Co-authored-by: matst80 <mats.tornberg@gmail.com> Reviewed-on: #8 Co-authored-by: Mats Törnberg <mats@tornberg.me> Co-committed-by: Mats Törnberg <mats@tornberg.me>
This commit was merged in pull request #8.
This commit is contained in:
31
pkg/checkout/mutation-context.go
Normal file
31
pkg/checkout/mutation-context.go
Normal file
@@ -0,0 +1,31 @@
|
||||
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),
|
||||
)
|
||||
return reg
|
||||
}
|
||||
Reference in New Issue
Block a user