import { ApiRequestOptions } from './client.js'; /** * ADD-ONS ON A CART THAT IS ALREADY BEING PAID FOR (MIC-4326). * * Why this is not `updateCartQuantities`. The cart PUT carries only * `quantities` / `donationAmounts` — there is no add-on field on it — and * orders-service guards that route with `rejectIfPriced`, which refuses every * mutation of a cart holding a PaymentIntent. `initializeStripePayment()` runs on * checkout MOUNT, so on the checkout page the cart always has one. A PUT from * here would 409 every time. * * `POST /cart/:uuid/add-ons` is the gift-card door instead: it reprices rather * than refusing — cancelling the stale PaymentIntent so a secret priced without * the t-shirt can never be confirmed — and tells us whether it did. * * NO BUYER-FACING COPY IN THIS FILE, deliberately: VC's l10n gates do not scan * `api/*.ts`, so a hardcoded English sentence here would ship untranslated and * unnoticed. Refusals are surfaced one of two ways — the SERVER's own message * (which is already buyer-readable and localisation-free in the sense that it * names the operator's own product: "Tour t-shirt just sold out"), or, when there * is none, a `null` that the calling component renders from its own labels. */ /** One add-on line as the cart now holds it. Money is CENTS, as everywhere add-ons are. */ export interface CartAddOnLine { addOnId: number; name: string; quantity: number; priceCents: number; lineTotalCents: number; } export interface CartAddOnsResult { success: boolean; /** * The server's refusal sentence, when it gave one. `null` means "no usable * message" and the caller must fall back to its own labelled copy. */ error: string | null; lines: CartAddOnLine[]; addOnQuantity: number; /** * THE FIELD THE CALLER CANNOT SKIP. True means the cart's PaymentIntent was * thrown away and a fresh one must be minted before the buyer can pay. * Inferring this from "no error" would either strand the buyer against a dead * secret or re-mint a perfectly good intent for nothing. * * False on an unchanged cart (an identical re-send short-circuits server-side) * and false on failure, because nothing was repriced. */ repriced: boolean; } /** * Set the add-ons on an existing cart. * * ABSOLUTE, NOT A DELTA — the map is the desired end state ("2 tees"), matching * `addOnQuantities` on cart-create. A delta cannot be retried safely: a dropped * response leaves us unable to tell whether an increment landed, and re-sending * buys a second shirt. The buyer's retry here is a finger on a `+` button, so * idempotence is not theoretical. * * An EMPTY map removes every add-on; there is no separate delete call. */ export declare function updateCartAddOns(cartId: string, quantities: Record, req?: Pick): Promise;