process
This commit is contained in:
@@ -114,12 +114,14 @@ func main() {
|
||||
log.Printf("Error loading promotions: %v\n", err)
|
||||
}
|
||||
|
||||
log.Printf("loaded %d promotions", len(promotionData.State.Promotions))
|
||||
|
||||
promotionService := promotions.NewPromotionService(nil)
|
||||
|
||||
reg := cart.NewCartMultationRegistry()
|
||||
reg.RegisterProcessor(
|
||||
actor.NewMutationProcessor(func(g *cart.CartGrain) error {
|
||||
ctx := promotions.NewContextFromCart(g)
|
||||
ctx := promotions.NewContextFromCart(g, promotions.WithNow(time.Now()), promotions.WithCustomerSegment("vip"))
|
||||
_, actions := promotionService.EvaluateAll(promotionData.State.Promotions, ctx)
|
||||
for _, action := range actions {
|
||||
log.Printf("apply: %V", action)
|
||||
|
||||
Reference in New Issue
Block a user