all the refactor
Build and Publish / BuildAndDeployAmd64 (push) Failing after 5s
Build and Publish / BuildAndDeployArm64 (push) Failing after 6s

This commit is contained in:
2026-06-28 17:51:52 +02:00
parent 7db0d236c7
commit aa8b2bdedc
84 changed files with 4328 additions and 2344 deletions
+4 -3
View File
@@ -8,6 +8,7 @@ import (
"time"
"git.k6n.net/mats/go-cart-actor/pkg/cart"
"git.k6n.net/mats/platform/money"
)
var errInvalidTimeFormat = errors.New("invalid time format")
@@ -28,14 +29,14 @@ type PromotionItem struct {
SKU string
Quantity uint16
Category string
PriceIncVat int64
PriceIncVat money.Cents
}
// PromotionEvalContext carries all dynamic data required to evaluate promotion
// conditions. It can be constructed from a cart.CartGrain plus optional
// customer/order metadata.
type PromotionEvalContext struct {
CartTotalIncVat int64
CartTotalIncVat money.Cents
TotalItemQuantity uint32
Items []PromotionItem
CustomerSegment string
@@ -358,7 +359,7 @@ func evaluateGroup(g ConditionGroup, ctx *PromotionEvalContext) bool {
func evaluateBaseCondition(b BaseCondition, ctx *PromotionEvalContext) bool {
switch b.Type {
case CondCartTotal:
return evalNumberCompare(float64(ctx.CartTotalIncVat), b)
return evalNumberCompare(float64(ctx.CartTotalIncVat.Int64()), b)
case CondItemQuantity:
return evalNumberCompare(float64(ctx.TotalItemQuantity), b)
case CondCustomerSegment: