Skip to content
Examples / Quote and acceptance

Quote and acceptance.

Calculate a quote, inspect its typed result, and accept only the terms that are still current.

BookingQuoteRequestQuote resultAcceptance

Inspect a path through the work.

Change the scenario to see the inputs, operations, and outcome. These are guided browser illustrations of repository reference products.

bookingQuote / Q-2081Local calculation · sample terms

Define the terms.

20% sample tax. Amounts are calculated in integer cents; discount and tax round to the nearest cent.

unit_price_minor: integerunits: integerdiscount_bps: integer
$2,700.00

Calculated total, including tax.

Subtotal
$2,500.00
Discount
−$250.00
Tax
$450.00
Result type
total_minor: integer

Changing the inputs clears the previous verification and plan.

This local demo does not call an authoritative backend.Inspect the real client code

What happens,
and why.

  1. 01

    Load the current request and its pricing inputs.

  2. 02

    Calculate local feedback as the operator changes the terms.

  3. 03

    Run the authoritative Function to verify the current quote.

  4. 04

    Plan acceptance against the selected request and inspect its effects.

  5. 05

    Execute the current plan and record the accepted outcome.

When the conditions are no longer met.

Editing terms invalidates the previous verification in the reference application. A delayed response must not replace newer inputs, and acceptance still crosses the server’s Action checks.

Inspect the implementation.

Verify and accept a quote tsx
  async function acceptCurrentQuote() {    if (local === null || isAcceptanceInFlight.current) return;    isAcceptanceInFlight.current = true;    setIsAccepting(true);    const revision = inputRevision.current;    const input = {      request_id: requestId, unit_price_minor: BigInt(unitPrice), units: BigInt(units),      discount_bps: BigInt(discount), tax_bps: BigInt(tax),    };    try {      setOperationError(null);      const plan = await acceptBookingQuote.plan(client, input, { targetKey: requestId });      if (inputRevision.current !== revision) return;      await acceptBookingQuote.execute(client, plan, { planHash: plan.hash });      if (inputRevision.current !== revision) return;      setAccepted(true);    } catch (cause) {      if (inputRevision.current !== revision) return;
Follow the developer learning path

The capabilities behind this example.

Bring us a process.
We'll build it with you.

A business process, the systems it touches, and the rules it needs to follow.