parent item mutations
This commit is contained in:
@@ -195,6 +195,16 @@ func cartGrainToResponse(id string, g *cart.CartGrain) CartResponse {
|
||||
resp.Status = string(*g.CheckoutStatus)
|
||||
}
|
||||
|
||||
// Per-line evaluation breakdown. The canonical promotion pipeline
|
||||
// (pkg/promotions.PromotionService.EvaluateAndApply) populates this
|
||||
// field on the grain itself after every successful mutation, so the
|
||||
// conversion just reads g.EvaluatedItems verbatim — no recompute at
|
||||
// response time. Same shape /promotions/evaluate-with-cart returns
|
||||
// (both reference cart.EvaluatedItem and cart.MapEvaluatedItems),
|
||||
// so a line verified via GET /ucp/v1/carts/{id} byte-matches the
|
||||
// preview from /promotions/evaluate-with-cart.
|
||||
resp.EvaluatedItems = g.EvaluatedItems
|
||||
|
||||
for _, it := range g.Items {
|
||||
if it == nil {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user