promotions
Build and Publish / BuildAndDeployArm64 (push) Failing after 6s
Build and Publish / BuildAndDeployAmd64 (push) Has been cancelled

This commit is contained in:
2026-06-18 11:32:19 +02:00
parent 2545be4315
commit 2443fd8b49
9 changed files with 583 additions and 55 deletions
+7 -6
View File
@@ -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
},
},