55 lines
1.7 KiB
Go
55 lines
1.7 KiB
Go
package cart
|
|
|
|
import (
|
|
"git.tornberg.me/go-cart-actor/pkg/actor"
|
|
messages "git.tornberg.me/go-cart-actor/pkg/messages"
|
|
)
|
|
|
|
func NewCartMultationRegistry() actor.MutationRegistry {
|
|
|
|
reg := actor.NewMutationRegistry()
|
|
reg.RegisterMutations(
|
|
actor.NewMutation(AddItem, func() *messages.AddItem {
|
|
return &messages.AddItem{}
|
|
}),
|
|
actor.NewMutation(ChangeQuantity, func() *messages.ChangeQuantity {
|
|
return &messages.ChangeQuantity{}
|
|
}),
|
|
actor.NewMutation(RemoveItem, func() *messages.RemoveItem {
|
|
return &messages.RemoveItem{}
|
|
}),
|
|
actor.NewMutation(InitializeCheckout, func() *messages.InitializeCheckout {
|
|
return &messages.InitializeCheckout{}
|
|
}),
|
|
actor.NewMutation(OrderCreated, func() *messages.OrderCreated {
|
|
return &messages.OrderCreated{}
|
|
}),
|
|
actor.NewMutation(RemoveDelivery, func() *messages.RemoveDelivery {
|
|
return &messages.RemoveDelivery{}
|
|
}),
|
|
actor.NewMutation(SetDelivery, func() *messages.SetDelivery {
|
|
return &messages.SetDelivery{}
|
|
}),
|
|
actor.NewMutation(SetPickupPoint, func() *messages.SetPickupPoint {
|
|
return &messages.SetPickupPoint{}
|
|
}),
|
|
actor.NewMutation(ClearCart, func() *messages.ClearCartRequest {
|
|
return &messages.ClearCartRequest{}
|
|
}),
|
|
actor.NewMutation(AddVoucher, func() *messages.AddVoucher {
|
|
return &messages.AddVoucher{}
|
|
}),
|
|
actor.NewMutation(RemoveVoucher, func() *messages.RemoveVoucher {
|
|
return &messages.RemoveVoucher{}
|
|
}),
|
|
actor.NewMutation(UpsertSubscriptionDetails, func() *messages.UpsertSubscriptionDetails {
|
|
return &messages.UpsertSubscriptionDetails{}
|
|
}),
|
|
actor.NewMutation(PreConditionFailed, func() *messages.PreConditionFailed {
|
|
return &messages.PreConditionFailed{}
|
|
}),
|
|
)
|
|
return reg
|
|
|
|
}
|