fixes
Build and Publish / BuildAndDeployArm64 (push) Failing after 49s
Build and Publish / BuildAndDeployAmd64 (push) Has been cancelled

This commit is contained in:
2026-06-16 13:14:35 +02:00
parent faec360789
commit 60722e3414
29 changed files with 1946 additions and 455 deletions
+31
View File
@@ -0,0 +1,31 @@
package cart
import (
"fmt"
messages "git.k6n.net/go-cart-actor/proto/cart"
)
// SetLineItemCustomFields sets/merges user-supplied custom input fields on an
// existing cart line. It is the dict equivalent of LineItemMarking: keys in the
// request are upserted; existing keys not present in the request are left
// untouched. (Send an empty value to clear a single field at the API layer if
// desired.)
func SetLineItemCustomFields(grain *CartGrain, req *messages.SetLineItemCustomFields) error {
for _, item := range grain.Items {
if item.Id != req.Id {
continue
}
if len(req.CustomFields) == 0 {
return nil
}
if item.CustomFields == nil {
item.CustomFields = make(map[string]string, len(req.CustomFields))
}
for k, v := range req.CustomFields {
item.CustomFields[k] = v
}
return nil
}
return fmt.Errorf("item with ID %d not found", req.Id)
}