---
id: ATS-COM-ORD-001
scope: CAP-COM-ORD-001
product_area: commerce
module: orders
revision: 2
status: proposed
approved_by: null
approved_at: null
source_sha:
  services-commerce: c8b66a98e2490617aec38ba5c8165dd9bd0a8f9b
  macroservice-libraries: 54536a441935c6e09fdb7f96f0bec71c52ba4e03
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
scenarios:
  - id: ATS-COM-ORD-001-01
    title: Portal purchase cannot name another contact
    level: api
    proves:
      - BR-CAP-COM-ORD-001-01
    preconditions: The signed-in member and a different contact share a workspace.
    steps:
      - do: Attempt creation with the different contact as buyer.
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a member opening a
          checkout for another contact, 403
    expected: The response is 403 and creation does not proceed.
    negative: true
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a member opening a checkout
        for another contact, 403
      - TST-COM-ORD-027
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a member opening a checkout
      for another contact, 403
    category: permission
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a member opening a checkout
      for another contact, 403
  - id: ATS-COM-ORD-001-02
    title: Invalid items leave the cart unchanged
    level: api
    proves:
      - BR-CAP-COM-ORD-001-02
    preconditions: >-
      The fixtures include retired and unsellable products, a two-unit limit, a required payload and USD-only
      support.
    steps:
      - do: 'Submit the invalid product, excessive quantity, malformed details and unsupported currency cases.'
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a product the tenant does
          not have: product_not_sellable
    expected: Each request returns 400 with the relevant item or currency problem and no accepted item write.
    negative: true
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a product the tenant does
        not have: product_not_sellable
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a retired product and an
        unsellable product type: product_not_sellable
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a quantity past the
        product’s purchase limit: quantity_out_of_limits
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a payload that does not
        parse as the participant’s schema: payload_does_not_parse
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a currency the business
        unit does not support: currency_not_supported
      - TST-COM-ORD-027
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a product the tenant does not
      have: product_not_sellable
    category: validation
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a product the tenant does not
      have: product_not_sellable
  - id: ATS-COM-ORD-001-03
    title: Party references require record identities
    level: api
    proves:
      - BR-CAP-COM-ORD-001-03
    preconditions: Contact records have both internal identities and alternative text labels.
    steps:
      - do: 'Use alternative labels for the buyer, acting contact, bill-to and recipient.'
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/e2e/checkout-record-ids.e2e.spec.js#refuses a buyer that is
          a slug when the checkout is opened, 400 naming buyer_id, and writes nothing
    expected: Validation returns 400 identifying the offending field before saving.
    negative: true
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/checkout/tests/e2e/checkout-record-ids.e2e.spec.js#refuses a buyer that is a
        slug when the checkout is opened, 400 naming buyer_id, and writes nothing
      - >-
        services-commerce:modules/checkout/tests/e2e/checkout-record-ids.e2e.spec.js#refuses an acting
        contact, a bill-to and a recipient that are slugs, each naming its field
      - TST-COM-ORD-024
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/checkout-record-ids.e2e.spec.js#refuses a buyer that is a
      slug when the checkout is opened, 400 naming buyer_id, and writes nothing
    category: boundary
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/e2e/checkout-record-ids.e2e.spec.js#refuses a buyer that is a
      slug when the checkout is opened, 400 naming buyer_id, and writes nothing
  - id: ATS-COM-ORD-001-04
    title: Organization authority can be overridden by permitted staff
    level: api
    proves:
      - BR-CAP-COM-ORD-001-04
    preconditions: A contact lacks the organization’s required role; two staff contexts differ in placement authority.
    steps:
      - do: Attempt the organization purchase as the member and each staff context.
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#accepts a member who holds the
          store’s purchasing role at the organization
    expected: The authorized staff case records an override; the other cases return buyer_may_not_act.
    negative: false
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#accepts a member who holds the
        store’s purchasing role at the organization
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a member affiliated without
        the role: buyer_may_not_act, NOT_AUTHORIZED_FOR_ORGANIZATION
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#lets a console user with
        commerce.orders.create buy for the organization naming any acting contact, and audits the override
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a console clerk without
        commerce.orders.create the same purchase, 400 buyer_may_not_act
      - TST-COM-ORD-027
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#accepts a member who holds the
      store’s purchasing role at the organization
    category: permission
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#accepts a member who holds the
      store’s purchasing role at the organization
  - id: ATS-COM-ORD-001-05
    title: Public assortment checks permit staff exceptions
    level: api
    proves:
      - BR-CAP-COM-ORD-001-05
    preconditions: One fixture product is unpublished and another falls outside the selected assortment.
    steps:
      - do: Try both products as a portal buyer and as authorized console staff.
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/e2e/checkout-public-sale.e2e.spec.js#refuses a portal
          member opening a checkout with a draft product: 400 product_not_published, naming the store, nothing
          written
    expected: Portal requests return publication or assortment problems; staff can retain both items.
    negative: false
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/checkout/tests/e2e/checkout-public-sale.e2e.spec.js#refuses a portal member
        opening a checkout with a draft product: 400 product_not_published, naming the store, nothing written
      - >-
        services-commerce:modules/checkout/tests/e2e/checkout-public-sale.e2e.spec.js#refuses a portal member
        a published product the store does not admit: 400 product_not_in_store_assortment
      - >-
        services-commerce:modules/checkout/tests/e2e/checkout-public-sale.e2e.spec.js#lets a console user
        holding commerce.orders.create open a checkout with the draft product and add the one outside the
        assortment
      - TST-COM-ORD-023
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/checkout-public-sale.e2e.spec.js#refuses a portal member
      opening a checkout with a draft product: 400 product_not_published, naming the store, nothing written
    category: permission
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/e2e/checkout-public-sale.e2e.spec.js#refuses a portal member
      opening a checkout with a draft product: 400 product_not_published, naming the store, nothing written
  - id: ATS-COM-ORD-001-06
    title: Cart changes retain version and actor evidence
    level: api
    proves:
      - BR-CAP-COM-ORD-001-06
    preconditions: An open cart and a stand-in support identity are available.
    steps:
      - do: 'Add, replace and remove items, then inspect version and event data.'
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#adds after the last, changes the
          intent and clears what was advised, removes, each bumping the version
    expected: Versions advance and the event helper records the supplied support actor.
    negative: false
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#adds after the last, changes the
        intent and clears what was advised, removes, each bumping the version
      - 'services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#leaves an event for every change'
      - >-
        services-commerce:modules/checkout/tests/unit/checkout/checkout-event-actor.spec.js#names the support
        identity as the actor of the event
      - TST-COM-ORD-027
      - TST-COM-ORD-048
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#adds after the last, changes the
      intent and clears what was advised, removes, each bumping the version
    category: invariant
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#adds after the last, changes the
      intent and clears what was advised, removes, each bumping the version
  - id: ATS-COM-ORD-001-07
    title: Expiry processing respects limits and workspace ownership
    level: api
    proves:
      - BR-CAP-COM-ORD-001-07
    preconditions: Expired carts span two workspaces alongside live and placed records.
    steps:
      - do: 'Run expiry selection and abandonment with a bounded limit, then run again.'
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/integration/services/checkout/checkout-sweeper.integration.spec.js#abandoned
          each expired open checkout in its own tenant, with the system as the actor and expired as the reason
    expected: Expired records are processed in expiry order within their workspace; other states remain untouched.
    negative: false
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/checkout/tests/integration/services/checkout/checkout-sweeper.integration.spec.js#abandoned
        each expired open checkout in its own tenant, with the system as the actor and expired as the reason
      - >-
        services-commerce:modules/checkout/tests/integration/services/checkout/checkout-sweeper.integration.spec.js#takes
        at most the limit, oldest expiry first, and leaves the rest to the next run; a cancelled checkout is
        not found
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#expires seven days out, and the
        first item carries the participant’s current schema version, unvalidated
      - TST-COM-ORD-040
      - TST-COM-ORD-027
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/integration/services/checkout/checkout-sweeper.integration.spec.js#abandoned
      each expired open checkout in its own tenant, with the system as the actor and expired as the reason
    category: transition
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/integration/services/checkout/checkout-sweeper.integration.spec.js#abandoned
      each expired open checkout in its own tenant, with the system as the actor and expired as the reason
  - id: ATS-COM-ORD-001-08
    title: Abandonment releases the held item
    level: api
    proves:
      - BR-CAP-COM-ORD-001-08
    preconditions: A cart has an application-held scarce resource.
    steps:
      - do: Abandon it and attempt a later item addition.
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#moves an open checkout to
          abandoned, after which it no longer changes (409 checkout_not_open)
    expected: The hold is released with history and the later addition returns checkout_not_open.
    negative: true
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#moves an open checkout to
        abandoned, after which it no longer changes (409 checkout_not_open)
      - >-
        services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#releases every hold when the
        checkout is abandoned
      - TST-COM-ORD-027
      - TST-COM-ORD-029
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#moves an open checkout to abandoned,
      after which it no longer changes (409 checkout_not_open)
    category: transition
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#moves an open checkout to abandoned,
      after which it no longer changes (409 checkout_not_open)
  - id: ATS-COM-ORD-001-09
    title: Scarce holds reject competing or excessive requests
    level: api
    proves:
      - BR-CAP-COM-ORD-001-09
    preconditions: The last booth is reserved for one buyer.
    steps:
      - do: 'Request it as a second buyer, extend beyond the allowed ceiling and remove the held item.'
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#acquires the hold: 200
          with the reservation held, the item prepared with it, the participant’s row held, hold_acquired on
          the trail
    expected: >-
      The competing and excessive requests return hold_unavailable and hold_not_extendable; removal releases
      the resource.
    negative: true
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#acquires the hold: 200 with
        the reservation held, the item prepared with it, the participant’s row held, hold_acquired on the
        trail
      - >-
        services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#refuses another buyer the
        booth: 409 hold_unavailable with the participant’s reason, and their preview marks the item
        unavailable
      - >-
        services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#refuses an extension past
        the policy’s ceiling, 409 hold_not_extendable with the participant’s problem
      - >-
        services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#releases an item’s hold
        through the participant when the item is removed, with holds_released on the trail
      - TST-COM-ORD-029
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#acquires the hold: 200 with
      the reservation held, the item prepared with it, the participant’s row held, hold_acquired on the trail
    category: edge
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#acquires the hold: 200 with
      the reservation held, the item prepared with it, the participant’s row held, hold_acquired on the trail
  - id: ATS-COM-ORD-001-10
    title: Cart transitions reject skipped and terminal moves
    level: api
    proves:
      - BR-CAP-COM-ORD-001-14
    preconditions: An open cart exists and a separate cart has completed placement.
    steps:
      - do: >-
          Attempt direct placement without preparation, place without an order link and transition the placed
          cart; also exercise permitted preparation and cancellation transitions.
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/integration/services/persistence/checkouts.integration.spec.js#refuses
          open to placed (preparing comes first), and lets open go abandoned or cancelled
    expected: Invalid moves are refused and allowed moves preserve their required order linkage.
    negative: true
    data_needs: Use the isolated checkout records prepared by the persistence suite.
    bound_to:
      - >-
        services-commerce:modules/checkout/tests/integration/services/persistence/checkouts.integration.spec.js#refuses
        open to placed (preparing comes first), and lets open go abandoned or cancelled
      - >-
        services-commerce:modules/checkout/tests/integration/services/persistence/checkouts.integration.spec.js#refuses
        placed without an order, and any other status with one, 409
      - >-
        services-commerce:modules/checkout/tests/integration/services/persistence/checkouts.integration.spec.js#refuses
        every move out of placed, 409
      - TST-COM-ORD-043
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/integration/services/persistence/checkouts.integration.spec.js#refuses
      open to placed (preparing comes first), and lets open go abandoned or cancelled
    category: transition
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/integration/services/persistence/checkouts.integration.spec.js#refuses
      open to placed (preparing comes first), and lets open go abandoned or cancelled
  - id: ATS-COM-ORD-001-11
    title: An elapsed booth hold becomes stale
    category: transition
    level: api
    proves:
      - BR-CAP-COM-ORD-001-10
    preconditions: A booth has an elapsed unplaced hold.
    steps:
      - do: 'Run the reservation pass, inspect the cart and let the next buyer reserve it.'
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#expires the ledger’s row,
          marks the item stale with hold_expired on the trail, and counts it
    expected: The first selection is stale and the next buyer can hold the booth.
    negative: false
    data_needs: Use an isolated workspace with the records and responses named in the preconditions.
    bound_to:
      - >-
        services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#expires the ledger’s row,
        marks the item stale with hold_expired on the trail, and counts it
      - >-
        services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#lets the next buyer hold the
        booth
      - TST-COM-ORD-029
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#expires the ledger’s row,
      marks the item stale with hold_expired on the trail, and counts it
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#expires the ledger’s row,
      marks the item stale with hold_expired on the trail, and counts it
  - id: ATS-COM-ORD-001-12
    title: A bundle cannot refer to a missing parent
    category: validation
    level: api
    proves:
      - BR-CAP-COM-ORD-001-11
    preconditions: The cart contains a main item.
    steps:
      - do: 'Add a child with an absent parent, then one naming the main item.'
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/e2e/checkout-record-ids.e2e.spec.js#refuses an item whose
          parent_item_id names no item of the checkout, 400 envelope_invalid, and takes one that does
          (COM-ACC-0025)
    expected: The first request returns 400; the second retains the parent connection.
    negative: true
    data_needs: Use an isolated workspace with the records and responses named in the preconditions.
    bound_to:
      - >-
        services-commerce:modules/checkout/tests/e2e/checkout-record-ids.e2e.spec.js#refuses an item whose
        parent_item_id names no item of the checkout, 400 envelope_invalid, and takes one that does
        (COM-ACC-0025)
      - TST-COM-ORD-024
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/checkout-record-ids.e2e.spec.js#refuses an item whose
      parent_item_id names no item of the checkout, 400 envelope_invalid, and takes one that does
      (COM-ACC-0025)
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/e2e/checkout-record-ids.e2e.spec.js#refuses an item whose
      parent_item_id names no item of the checkout, 400 envelope_invalid, and takes one that does
      (COM-ACC-0025)
  - id: ATS-COM-ORD-001-13
    title: Long process references stay on the cart without crossing the application contract
    category: boundary
    level: api
    proves:
      - BR-CAP-COM-ORD-001-12
    preconditions: 'Create carts with references of 128, 129, 500 and 501 characters.'
    steps:
      - do: Preview valid carts and capture the application envelopes.
        provenance: proposed
        source: >-
          services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a process_ref of 501
          characters on create, 400
    expected: >-
      The 128-character reference crosses the envelope; longer accepted references stay on the cart, and the
      501-character request writes nothing.
    negative: true
    data_needs: Use an isolated workspace with the records and responses named in the preconditions.
    bound_to: []
    provenance: proposed
    source: >-
      services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a process_ref of 501
      characters on create, 400
    expected_provenance: proposed
    expected_source: >-
      services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a process_ref of 501
      characters on create, 400
  - id: ATS-COM-ORD-001-14
    title: Clearing a shipping choice writes an explicit empty selection
    category: rule
    level: unit
    proves:
      - BR-CAP-COM-ORD-001-13
    preconditions: An open cart carries a selected shipping strategy.
    steps:
      - do: Clear the choice and inspect the persistence update.
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/unit/checkout/shipping-choice.spec.js#writes null for a
          cleared choice, the property present so the update clears the column
    expected: The update contains an explicit empty strategy value.
    negative: false
    data_needs: Use an isolated workspace with the records and responses named in the preconditions.
    bound_to:
      - >-
        services-commerce:modules/checkout/tests/unit/checkout/shipping-choice.spec.js#writes null for a
        cleared choice, the property present so the update clears the column
      - TST-COM-ORD-060
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/unit/checkout/shipping-choice.spec.js#writes null for a cleared
      choice, the property present so the update clears the column
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/unit/checkout/shipping-choice.spec.js#writes null for a cleared
      choice, the property present so the update clears the column
  - id: ATS-COM-ORD-001-15
    title: A conflicting item leaves the selected cart policy intact
    category: interaction
    level: api
    proves:
      - BR-CAP-COM-ORD-001-02
      - BR-CAP-COM-ORD-002-02
    preconditions: A cart already resolves one policy.
    steps:
      - do: 'Add a main item that resolves a different policy, then read the cart.'
        provenance: proposed
        source:
          - >-
            services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a quantity past the
            product’s purchase limit: quantity_out_of_limits
          - >-
            services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#refuses a
            later main item whose context resolves another profile, 409 ordering_profile_conflict naming both,
            nothing added
    expected: The addition is refused and the original items and policy remain.
    negative: true
    data_needs: Use an isolated workspace with the records and responses named in the preconditions.
    bound_to: []
    provenance: proposed
    source:
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a quantity past the
        product’s purchase limit: quantity_out_of_limits
      - >-
        services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#refuses a later
        main item whose context resolves another profile, 409 ordering_profile_conflict naming both, nothing
        added
    exercises:
      - CAP-COM-ORD-001
      - CAP-COM-ORD-002
    related_capabilities:
      - CAP-COM-ORD-002
    expected_provenance: proposed
    expected_source:
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a quantity past the
        product’s purchase limit: quantity_out_of_limits
      - >-
        services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#refuses a later
        main item whose context resolves another profile, 409 ordering_profile_conflict naming both, nothing
        added
  - id: ATS-COM-ORD-001-16
    title: An edited item receives a fresh preview
    category: interaction
    level: api
    proves:
      - BR-CAP-COM-ORD-001-06
      - BR-CAP-COM-ORD-003-01
    preconditions: An open cart has an advised item and saved preview.
    steps:
      - do: Change its quantity and request another preview.
        provenance: proposed
        source:
          - >-
            services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#adds after the last, changes
            the intent and clears what was advised, removes, each bumping the version
          - >-
            services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#stores the price snapshot on
            the checkout, with the totals, and leaves a previewed event
    expected: The old advice is cleared and the saved result prices the new quantity.
    negative: false
    data_needs: Use an isolated workspace with the records and responses named in the preconditions.
    bound_to: []
    provenance: proposed
    source:
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#adds after the last, changes the
        intent and clears what was advised, removes, each bumping the version
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#stores the price snapshot on the
        checkout, with the totals, and leaves a previewed event
    exercises:
      - CAP-COM-ORD-001
      - CAP-COM-ORD-003
    related_capabilities:
      - CAP-COM-ORD-003
    expected_provenance: proposed
    expected_source:
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#adds after the last, changes the
        intent and clears what was advised, removes, each bumping the version
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#stores the price snapshot on the
        checkout, with the totals, and leaves a previewed event
  - id: ATS-COM-ORD-001-17
    title: Abandoned shopping cannot create a purchase
    category: interaction
    level: api
    proves:
      - BR-CAP-COM-ORD-001-08
      - BR-CAP-COM-ORD-005-05
    preconditions: A cart with a reserved item is abandoned.
    steps:
      - do: Attempt placement and inspect the reservation and order list.
        provenance: proposed
        source:
          - >-
            services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#moves an open checkout to
            abandoned, after which it no longer changes (409 checkout_not_open)
          - >-
            services-commerce:modules/checkout/tests/e2e/placement.e2e.spec.js#answers 409 placement_refused
            with the participant’s problem naming the item
    expected: 'Placement is refused, the hold is released and no order exists for the cart.'
    negative: false
    data_needs: Use an isolated workspace with the records and responses named in the preconditions.
    bound_to: []
    provenance: proposed
    source:
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#moves an open checkout to
        abandoned, after which it no longer changes (409 checkout_not_open)
      - >-
        services-commerce:modules/checkout/tests/e2e/placement.e2e.spec.js#answers 409 placement_refused with
        the participant’s problem naming the item
    exercises:
      - CAP-COM-ORD-001
      - CAP-COM-ORD-005
    related_capabilities:
      - CAP-COM-ORD-005
    expected_provenance: proposed
    expected_source:
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#moves an open checkout to
        abandoned, after which it no longer changes (409 checkout_not_open)
      - >-
        services-commerce:modules/checkout/tests/e2e/placement.e2e.spec.js#answers 409 placement_refused with
        the participant’s problem naming the item
  - id: ATS-COM-ORD-001-18
    title: A reader cannot change another authorized cart
    category: interaction
    level: api
    proves:
      - BR-CAP-COM-ORD-001-01
      - BR-CAP-COM-ORD-011-02
    preconditions: A workspace reader can read a staff-created cart.
    steps:
      - do: 'Read the cart, attempt an item addition and read its version again.'
        provenance: proposed
        source:
          - >-
            services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a member opening a
            checkout for another contact, 403
          - >-
            services-commerce:modules/checkout/tests/e2e/checkout-security.e2e.spec.js#a reader is refused
            every write, 403 permission_missing, leaving the checkout as it was
    expected: 'The read succeeds, the write is refused and the version stays unchanged.'
    negative: false
    data_needs: Use an isolated workspace with the records and responses named in the preconditions.
    bound_to: []
    provenance: proposed
    source:
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a member opening a checkout
        for another contact, 403
      - >-
        services-commerce:modules/checkout/tests/e2e/checkout-security.e2e.spec.js#a reader is refused every
        write, 403 permission_missing, leaving the checkout as it was
    exercises:
      - CAP-COM-ORD-001
      - CAP-COM-ORD-011
    related_capabilities:
      - CAP-COM-ORD-011
    expected_provenance: proposed
    expected_source:
      - >-
        services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a member opening a checkout
        for another contact, 403
      - >-
        services-commerce:modules/checkout/tests/e2e/checkout-security.e2e.spec.js#a reader is refused every
        write, 403 permission_missing, leaving the checkout as it was
  - id: ATS-COM-ORD-001-19
    title: A deposit cart reaches a priced review within its buyer scope
    category: interaction
    level: api
    proves:
      - BR-CAP-COM-ORD-001-01
      - BR-CAP-COM-ORD-002-01
      - BR-CAP-COM-ORD-003-01
      - BR-CAP-COM-ORD-004-01
      - BR-CAP-COM-ORD-009-01
      - BR-CAP-COM-ORD-011-01
    preconditions: A member owns an open cart with an active deposit policy and a qualifying code.
    steps:
      - do: >-
          Add its main item, select the offered plan, apply the code and preview as the owner; repeat the
          preview as another member.
        provenance: proposed
        source:
          - 'services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js'
          - 'services-commerce:modules/checkout/services/checkout/purchasing-roles.ts'
          - >-
            services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#refuses another buyer
            the booth: 409 hold_unavailable with the participant’s reason, and their preview marks the item
            unavailable
          - 'services-commerce:modules/checkout/tests/e2e/checkout-preprocessing.e2e.spec.js'
          - 'services-commerce:modules/checkout/tests/e2e/participant-unavailable.e2e.spec.js'
          - 'services-commerce:modules/checkout/tests/e2e/product-purchase-eligibility.e2e.spec.js'
          - 'services-commerce:modules/checkout/tests/e2e/accounting-tax.e2e.spec.js'
          - 'services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js'
          - 'services-commerce:modules/checkout/aws/lambda/SWEEPER.ts:handler'
    expected: The owner sees the discounted deposit quotation and the other member is refused.
    negative: false
    data_needs: Use an isolated workspace with the records and responses named in the preconditions.
    bound_to: []
    provenance: proposed
    source:
      - 'services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js'
      - 'services-commerce:modules/checkout/services/checkout/purchasing-roles.ts'
      - >-
        services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#refuses another buyer the
        booth: 409 hold_unavailable with the participant’s reason, and their preview marks the item
        unavailable
      - 'services-commerce:modules/checkout/tests/e2e/checkout-preprocessing.e2e.spec.js'
      - 'services-commerce:modules/checkout/tests/e2e/participant-unavailable.e2e.spec.js'
      - 'services-commerce:modules/checkout/tests/e2e/product-purchase-eligibility.e2e.spec.js'
      - 'services-commerce:modules/checkout/tests/e2e/accounting-tax.e2e.spec.js'
      - 'services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js'
      - 'services-commerce:modules/checkout/aws/lambda/SWEEPER.ts:handler'
    exercises:
      - CAP-COM-ORD-001
      - CAP-COM-ORD-002
      - CAP-COM-ORD-003
      - CAP-COM-ORD-004
      - CAP-COM-ORD-009
      - CAP-COM-ORD-011
    workflows:
      - WF-COM-ORD-001
    expected_provenance: proposed
    expected_source:
      - 'services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js'
      - 'services-commerce:modules/checkout/services/checkout/purchasing-roles.ts'
      - >-
        services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#refuses another buyer the
        booth: 409 hold_unavailable with the participant’s reason, and their preview marks the item
        unavailable
      - 'services-commerce:modules/checkout/tests/e2e/checkout-preprocessing.e2e.spec.js'
      - 'services-commerce:modules/checkout/tests/e2e/participant-unavailable.e2e.spec.js'
      - 'services-commerce:modules/checkout/tests/e2e/product-purchase-eligibility.e2e.spec.js'
      - 'services-commerce:modules/checkout/tests/e2e/accounting-tax.e2e.spec.js'
      - 'services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js'
      - 'services-commerce:modules/checkout/aws/lambda/SWEEPER.ts:handler'
  - id: ATS-COM-ORD-001-20
    title: An interrupted minute pass leaves later work visible
    category: interaction
    level: api
    proves:
      - BR-CAP-COM-ORD-001-01
      - BR-CAP-COM-ORD-005-01
      - BR-CAP-COM-ORD-006-01
      - BR-CAP-COM-ORD-007-01
      - BR-CAP-COM-ORD-008-01
      - BR-CAP-COM-ORD-009-01
      - BR-CAP-COM-ORD-010-01
      - BR-CAP-COM-ORD-011-01
      - BR-CAP-COM-ORD-013-01
    preconditions: 'An expired cart, elapsed hold, unbilled sale and expired grant are candidates in an isolated workspace.'
    steps:
      - do: >-
          Fail the cart-release application during the shared pass, inspect later candidates, restore it and
          run again.
        provenance: proposed
        source:
          - 'services-commerce:modules/checkout/aws/lambda/SWEEPER.ts:handler'
          - 'services-commerce:modules/orders/services/reservations/reservation-sweeper.ts:sweepReservations'
          - 'services-commerce:modules/orders/services/orders/tender-window-sweeper.ts:sweepTenderWindows'
          - 'services-commerce:modules/checkout/aws/lambda/SWEEPER.ts:handler'
          - 'services-commerce:modules/orders/services/orders/financial-sweeps.ts:sweepFinancials'
          - 'services-commerce:modules/entitlements/services/register/entitlement-sweeper.ts:sweepEntitlements'
          - 'services-commerce:modules/checkout/aws/lambda/SWEEPER.ts:handler'
    expected: >-
      Later work remains pending after the interruption and eligible candidates are processed by the recovered
      pass.
    negative: false
    data_needs: Use an isolated workspace with the records and responses named in the preconditions.
    bound_to: []
    provenance: proposed
    source:
      - 'services-commerce:modules/checkout/aws/lambda/SWEEPER.ts:handler'
      - 'services-commerce:modules/orders/services/reservations/reservation-sweeper.ts:sweepReservations'
      - 'services-commerce:modules/orders/services/orders/tender-window-sweeper.ts:sweepTenderWindows'
      - 'services-commerce:modules/checkout/aws/lambda/SWEEPER.ts:handler'
      - 'services-commerce:modules/orders/services/orders/financial-sweeps.ts:sweepFinancials'
      - 'services-commerce:modules/entitlements/services/register/entitlement-sweeper.ts:sweepEntitlements'
      - 'services-commerce:modules/checkout/aws/lambda/SWEEPER.ts:handler'
    exercises:
      - CAP-COM-ORD-001
      - CAP-COM-ORD-005
      - CAP-COM-ORD-006
      - CAP-COM-ORD-007
      - CAP-COM-ORD-008
      - CAP-COM-ORD-009
      - CAP-COM-ORD-010
      - CAP-COM-ORD-011
      - CAP-COM-ORD-013
    workflows:
      - WF-COM-ORD-006
    expected_provenance: proposed
    expected_source:
      - 'services-commerce:modules/checkout/aws/lambda/SWEEPER.ts:handler'
      - 'services-commerce:modules/orders/services/reservations/reservation-sweeper.ts:sweepReservations'
      - 'services-commerce:modules/orders/services/orders/tender-window-sweeper.ts:sweepTenderWindows'
      - 'services-commerce:modules/checkout/aws/lambda/SWEEPER.ts:handler'
      - 'services-commerce:modules/orders/services/orders/financial-sweeps.ts:sweepFinancials'
      - 'services-commerce:modules/entitlements/services/register/entitlement-sweeper.ts:sweepEntitlements'
      - 'services-commerce:modules/checkout/aws/lambda/SWEEPER.ts:handler'
evidence:
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/checkout-public-sale.e2e.spec.js#lets a
    console user holding commerce.orders.create open a checkout with the draft product and add the one outside
    the assortment
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/checkout-public-sale.e2e.spec.js#refuses
    a portal member a published product the store does not admit: 400 product_not_in_store_assortment
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/checkout-public-sale.e2e.spec.js#refuses
    a portal member opening a checkout with a draft product: 400 product_not_published, naming the store,
    nothing written
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/checkout-record-ids.e2e.spec.js#refuses a
    buyer that is a slug when the checkout is opened, 400 naming buyer_id, and writes nothing
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/checkout-record-ids.e2e.spec.js#refuses
    an acting contact, a bill-to and a recipient that are slugs, each naming its field
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#accepts a member
    who holds the store’s purchasing role at the organization
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#adds after the
    last, changes the intent and clears what was advised, removes, each bumping the version
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#expires seven days
    out, and the first item carries the participant’s current schema version, unvalidated
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#leaves an event for
    every change
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#lets a console user
    with commerce.orders.create buy for the organization naming any acting contact, and audits the override
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#moves an open
    checkout to abandoned, after which it no longer changes (409 checkout_not_open)
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a console
    clerk without commerce.orders.create the same purchase, 400 buyer_may_not_act
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a currency
    the business unit does not support: currency_not_supported
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a member
    affiliated without the role: buyer_may_not_act, NOT_AUTHORIZED_FOR_ORGANIZATION
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a member
    opening a checkout for another contact, 403
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a payload
    that does not parse as the participant’s schema: payload_does_not_parse
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a product
    the tenant does not have: product_not_sellable
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a quantity
    past the product’s purchase limit: quantity_out_of_limits
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js#refuses a retired
    product and an unsellable product type: product_not_sellable
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#acquires the
    hold: 200 with the reservation held, the item prepared with it, the participant’s row held, hold_acquired
    on the trail
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#refuses an
    extension past the policy’s ceiling, 409 hold_not_extendable with the participant’s problem
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#refuses
    another buyer the booth: 409 hold_unavailable with the participant’s reason, and their preview marks the
    item unavailable
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#releases an
    item’s hold through the participant when the item is removed, with holds_released on the trail
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#releases
    every hold when the checkout is abandoned
  - >-
    Examined reference:
    services-commerce:modules/checkout/tests/integration/services/checkout/checkout-sweeper.integration.spec.js#abandoned
    each expired open checkout in its own tenant, with the system as the actor and expired as the reason
  - >-
    Examined reference:
    services-commerce:modules/checkout/tests/integration/services/checkout/checkout-sweeper.integration.spec.js#takes
    at most the limit, oldest expiry first, and leaves the rest to the next run; a cancelled checkout is not
    found
  - >-
    Examined reference:
    services-commerce:modules/checkout/tests/unit/checkout/checkout-event-actor.spec.js#names the support
    identity as the actor of the event
coverage:
  rule: covered
  transition: 'gap: FND-COM-ORD-058'
  validation: covered
  permission: 'gap: FND-COM-ORD-058'
  edge: covered
  failure: 'gap: FND-COM-ORD-058'
  boundary: covered
  concurrency: 'gap: FND-COM-ORD-058'
  invariant: 'gap: FND-COM-ORD-058'
  interaction: covered
coverage_definition: Covered means a design scenario exists; executable coverage and execution results are separate.
permission_coverage:
  - key: commerce.checkouts.create
    where_checked: api
    scenarios:
      - ATS-COM-ORD-001-01
      - ATS-COM-ORD-001-04
    gap: FND-COM-ORD-058
    note: >-
      The listed examples do not establish a complete allow-and-deny matrix for this key; unused catalogue
      keys need no invented route.
    provenance: unknown
    source: FND-COM-ORD-058
  - key: commerce.checkouts.read
    where_checked: api
    scenarios:
      - ATS-COM-ORD-001-01
      - ATS-COM-ORD-001-04
    gap: FND-COM-ORD-058
    note: >-
      The listed examples do not establish a complete allow-and-deny matrix for this key; unused catalogue
      keys need no invented route.
    provenance: unknown
    source: FND-COM-ORD-058
  - key: commerce.checkouts.update
    where_checked: api
    scenarios:
      - ATS-COM-ORD-001-01
      - ATS-COM-ORD-001-04
    gap: FND-COM-ORD-058
    note: >-
      The listed examples do not establish a complete allow-and-deny matrix for this key; unused catalogue
      keys need no invented route.
    provenance: unknown
    source: FND-COM-ORD-058
  - key: commerce.orders.create
    where_checked: service
    scenarios:
      - ATS-COM-ORD-001-01
      - ATS-COM-ORD-001-04
    gap: FND-COM-ORD-058
    note: >-
      The listed examples do not establish a complete allow-and-deny matrix for this key; unused catalogue
      keys need no invented route.
    provenance: unknown
    source: FND-COM-ORD-058
transition_coverage:
  - state_model: STATE-COM-ORD-001
    from: open
    to: preparing
    trigger: Placement begins its commit after remote assessment succeeds.
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: 'services-commerce:modules/orders/services/placement/place-order.ts:placeOrder'
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-001
    from: preparing
    to: placed
    trigger: The placement transaction completes its sale and dependent writes.
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: >-
      services-commerce:modules/checkout/tests/e2e/placement.e2e.spec.js#leaves the checkout placed, naming
      the order, its items frozen with what prepare attested, and its trail telling the story
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-001
    from: preparing
    to: open
    trigger: The declared rollback destination permits return to shopping.
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: 'services-commerce:modules/checkout/services/persistence/checkouts.ts:CHECKOUT_TRANSITIONS'
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-001
    from: open
    to: abandoned
    trigger: A caller abandons shopping or the composer replaces the purchasing parties.
    scenarios:
      - ATS-COM-ORD-001-08
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#releases every hold when the
      checkout is abandoned
    note: The cited test exercises this transition; other transitions retain separate gaps.
  - state_model: STATE-COM-ORD-001
    from: open
    to: abandoned
    trigger: The expiry pass discovers an overdue cart.
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: 'services-commerce:modules/checkout/services/checkout/checkout-sweeper.ts:sweepExpiredCheckouts'
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-001
    from: open
    to: cancelled
    trigger: The map permits internal cart cancellation without a current caller.
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: 'services-commerce:modules/checkout/services/persistence/checkouts.ts:CHECKOUT_TRANSITIONS'
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-002
    from: unvalidated
    to: advised
    trigger: The assessment obtains participant advice.
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: 'services-commerce:modules/checkout/services/checkout/checkout-assessment.ts'
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-002
    from: unvalidated
    to: problems
    trigger: 'Assessment records seller, price or eligibility blockers.'
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: 'services-commerce:modules/checkout/services/checkout/checkout-assessment.ts'
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-002
    from: advised
    to: unvalidated
    trigger: Selection editing or preprocessing changes the item.
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: >-
      services-commerce:modules/checkout/services/checkout/checkout-workflow.ts:changeItem;
      modules/checkout/services/checkout/checkout-preprocessing.ts
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-002
    from: unvalidated
    to: prepared
    trigger: The seller answers an early reservation request.
    scenarios:
      - ATS-COM-ORD-001-09
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#acquires the hold: 200 with
      the reservation held, the item prepared with it, the participant’s row held, hold_acquired on the trail
    note: The cited test exercises this transition; other transitions retain separate gaps.
  - state_model: STATE-COM-ORD-002
    from: prepared
    to: stale
    trigger: Reservation expiry discovers the item's elapsed hold.
    scenarios:
      - ATS-COM-ORD-001-11
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#expires the ledger’s row,
      marks the item stale with hold_expired on the trail, and counts it
    note: The cited test exercises this transition; other transitions retain separate gaps.
  - state_model: STATE-COM-ORD-002
    from: advised
    to: frozen
    trigger: Placement captures newly prepared purchase details.
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: 'services-commerce:modules/orders/services/placement/place-order.ts:placeOrder'
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-003
    from: held
    to: committed
    trigger: Placement converts a hold or a later pass confirms a placed lease.
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: >-
      services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#places the checkout: the hold
      re-affirmed and converted in TX-P, the ledger committed on the line, the claim frozen on the purchase
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-003
    from: held
    to: expired
    trigger: The reservation pass discovers a lapsed unplaced hold.
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: 'services-commerce:modules/orders/services/reservations/reservation-sweeper.ts:sweepReservations'
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-003
    from: held
    to: released
    trigger: Item removal or cart abandonment returns held resources.
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: 'services-commerce:modules/checkout/services/checkout/hold-release.ts:releaseHeldReservations'
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-003
    from: committed
    to: released
    trigger: Void or after-sale execution returns committed resources.
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: >-
      services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#releases a placed order’s
      committed claims on void, cancels its pending obligations and leaves claims_released on its history
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-003
    from: committed
    to: consumed
    trigger: Delivery completes using the committed claim.
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: 'services-commerce:modules/orders/services/persistence/reservations.ts:RESERVATION_TRANSITIONS'
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-003
    from: held
    to: mismatch
    trigger: Lease confirmation reports expired capacity or conflict.
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: 'services-commerce:modules/orders/services/placement/lease-confirmation.ts:confirmLease'
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
invariant_coverage:
  - invariant: INV-DOM-COM-ORD-001-01
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: 'services-commerce:modules/checkout/db/checkouts.table.ts:checkouts_placed_order_check'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-001-02
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: 'services-commerce:modules/checkout/db/checkouts.table.ts:checkouts_placed_order_uq'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-001-03
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: >-
      services-commerce:modules/checkout/db/checkouts.table.ts:checkouts_currency_check,
      checkouts_ordering_profile_source_check
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-001-04
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: 'services-commerce:modules/checkout/services/persistence/checkouts.ts:CHECKOUT_TRANSITIONS'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-001-05
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: >-
      services-commerce:modules/checkout/tests/e2e/placement.e2e.spec.js#leaves the checkout placed, naming
      the order, its items frozen with what prepare attested, and its trail telling the story;
      services-commerce:modules/checkout/services/persistence/checkouts.ts:updateCheckout, appendCheckoutEvent
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-001-06
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: 'services-commerce:modules/checkout/db/checkouts.table.ts:checkouts_ship_to_check'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-001-07
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: 'services-commerce:modules/checkout/tests/e2e/checkout-security.e2e.spec.js'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-001-08
    scenarios: []
    gap: FND-COM-ORD-058
    provenance: unknown
    source: >-
      services-commerce:modules/checkout/db/checkout-items.table.ts:checkout_items_quantity_check;
      modules/checkout/services/checkout/checkout-part-checks.ts
    note: Broader invariant coverage remains open beyond the concrete examples.
workflow_coverage:
  - workflow: WF-COM-ORD-001
    scenarios:
      - ATS-COM-ORD-001-19
    gap: FND-COM-ORD-058
    provenance: proposed
    source:
      - 'services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js'
      - 'services-commerce:modules/checkout/services/checkout/purchasing-roles.ts'
      - >-
        services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#refuses another buyer the
        booth: 409 hold_unavailable with the participant’s reason, and their preview marks the item
        unavailable
      - 'services-commerce:modules/checkout/tests/e2e/checkout-preprocessing.e2e.spec.js'
      - 'services-commerce:modules/checkout/tests/e2e/participant-unavailable.e2e.spec.js'
      - 'services-commerce:modules/checkout/tests/e2e/product-purchase-eligibility.e2e.spec.js'
      - 'services-commerce:modules/checkout/tests/e2e/accounting-tax.e2e.spec.js'
      - 'services-commerce:modules/checkout/tests/e2e/checkouts.e2e.spec.js'
      - 'services-commerce:modules/checkout/aws/lambda/SWEEPER.ts:handler'
  - workflow: WF-COM-ORD-006
    scenarios:
      - ATS-COM-ORD-001-20
    gap: FND-COM-ORD-058
    provenance: proposed
    source:
      - 'services-commerce:modules/checkout/aws/lambda/SWEEPER.ts:handler'
      - 'services-commerce:modules/orders/services/reservations/reservation-sweeper.ts:sweepReservations'
      - 'services-commerce:modules/orders/services/orders/tender-window-sweeper.ts:sweepTenderWindows'
      - 'services-commerce:modules/checkout/aws/lambda/SWEEPER.ts:handler'
      - 'services-commerce:modules/orders/services/orders/financial-sweeps.ts:sweepFinancials'
      - 'services-commerce:modules/entitlements/services/register/entitlement-sweeper.ts:sweepEntitlements'
      - 'services-commerce:modules/checkout/aws/lambda/SWEEPER.ts:handler'
interaction_coverage:
  - with: CAP-COM-ORD-002
    scenarios:
      - ATS-COM-ORD-001-15
  - with: CAP-COM-ORD-003
    scenarios:
      - ATS-COM-ORD-001-16
  - with: CAP-COM-ORD-005
    scenarios:
      - ATS-COM-ORD-001-17
  - with: CAP-COM-ORD-011
    scenarios:
      - ATS-COM-ORD-001-18
unproved_rules: []
---

# Build a buyer’s cart: Capability Test Specification

## Coverage

| Rule | Scenario or finding |
|---|---|
| `BR-CAP-COM-ORD-001-01` | `ATS-COM-ORD-001-01`, `ATS-COM-ORD-001-18`, `ATS-COM-ORD-001-19`, `ATS-COM-ORD-001-20` |
| `BR-CAP-COM-ORD-001-02` | `ATS-COM-ORD-001-02`, `ATS-COM-ORD-001-15` |
| `BR-CAP-COM-ORD-001-03` | `ATS-COM-ORD-001-03` |
| `BR-CAP-COM-ORD-001-04` | `ATS-COM-ORD-001-04` |
| `BR-CAP-COM-ORD-001-05` | `ATS-COM-ORD-001-05` |
| `BR-CAP-COM-ORD-001-06` | `ATS-COM-ORD-001-06`, `ATS-COM-ORD-001-16` |
| `BR-CAP-COM-ORD-001-07` | `ATS-COM-ORD-001-07` |
| `BR-CAP-COM-ORD-001-08` | `ATS-COM-ORD-001-08`, `ATS-COM-ORD-001-17` |
| `BR-CAP-COM-ORD-001-09` | `ATS-COM-ORD-001-09` |
| `BR-CAP-COM-ORD-001-10` | `ATS-COM-ORD-001-11` |
| `BR-CAP-COM-ORD-001-11` | `ATS-COM-ORD-001-12` |
| `BR-CAP-COM-ORD-001-12` | `ATS-COM-ORD-001-13` |
| `BR-CAP-COM-ORD-001-13` | `ATS-COM-ORD-001-14` |
| `BR-CAP-COM-ORD-001-14` | `ATS-COM-ORD-001-10` |

## Interactions With Related Capabilities

A conflicting item leaves the selected cart policy intact. A cart already resolves one policy. Add a main item that resolves a different policy, then read the cart.

An edited item receives a fresh preview. An open cart has an advised item and saved preview. Change its quantity and request another preview.

Abandoned shopping cannot create a purchase. A cart with a reserved item is abandoned. Attempt placement and inspect the reservation and order list.

A reader cannot change another authorized cart. A workspace reader can read a staff-created cart. Read the cart, attempt an item addition and read its version again.

Crossing workflow examples also cover preparation, commitment and recovery at their service handoffs. Their structured bindings distinguish specified outcomes from executable evidence.
