promotions
This commit is contained in:
@@ -196,13 +196,14 @@ func (s *Server) buildTools() []tool {
|
||||
opts = append(opts, promotions.WithCustomerSegment(a.CustomerSegment))
|
||||
}
|
||||
ctx := promotions.NewContextFromCart(g, opts...)
|
||||
_, actions := s.eval.EvaluateAll(s.store.Snapshot(), ctx)
|
||||
promotions.ApplyActions(g, actions)
|
||||
results, actions := s.eval.EvaluateAll(s.store.Snapshot(), ctx)
|
||||
s.eval.ApplyResults(g, results, ctx)
|
||||
return map[string]any{
|
||||
"subtotalIncVat": a.CartTotalIncVat,
|
||||
"discountIncVat": g.TotalDiscount.IncVat,
|
||||
"netIncVat": g.TotalPrice.IncVat,
|
||||
"matchedActions": actions,
|
||||
"subtotalIncVat": a.CartTotalIncVat,
|
||||
"discountIncVat": g.TotalDiscount.IncVat,
|
||||
"netIncVat": g.TotalPrice.IncVat,
|
||||
"matchedActions": actions,
|
||||
"appliedPromotions": g.AppliedPromotions,
|
||||
}, nil
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user