---
id: ATS-COM-ORD-002
scope: CAP-COM-ORD-002
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-002-01
    title: Policy precedence retains the selected source
    level: api
    proves:
      - BR-CAP-COM-ORD-002-01
    preconditions: 'Store, application and workspace defaults coexist with explicit and contextual choices.'
    steps:
      - do: Create carts through the resolution cases present in the bindings.
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#carries the
          store’s profile with source store, in the profile’s currency, no decision on the trail
    expected: The returned policy and recorded origin match each exercised precedence case.
    negative: false
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#carries the
        store’s profile with source store, in the profile’s currency, no decision on the trail
      - >-
        services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#takes the first
        main item’s selling context with source selling_context, the context recorded on the checkout and the
        item
      - >-
        services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#takes the
        application default of a context that names no profile, source application_default
      - >-
        services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#takes the tenant
        default when the item’s application has no default, source tenant_default: an item without a context
        resolves by its participant
      - TST-COM-ORD-033
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#carries the store’s
      profile with source store, in the profile’s currency, no decision on the trail
    category: rule
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#carries the store’s
      profile with source store, in the profile’s currency, no decision on the trail
  - id: ATS-COM-ORD-002-02
    title: Conflicting contexts do not create mixed-policy carts
    level: api
    proves:
      - BR-CAP-COM-ORD-002-02
    preconditions: Main items resolve two different checkout policies.
    steps:
      - do: Create a combined cart and attempt to add the second item to an existing one.
        provenance: test
        source: >-
          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: Both paths return ordering_profile_conflict without retaining the conflicting write.
    negative: true
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        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
      - >-
        services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#refuses the
        conflict at the open too, writing no checkout
      - TST-COM-ORD-033
    provenance: test
    source: >-
      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
    category: validation
    expected_provenance: test
    expected_source: >-
      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-002-03
    title: Policy switching distinguishes staff and portal callers
    level: api
    proves:
      - BR-CAP-COM-ORD-002-04
    preconditions: 'The fixtures include an active alternative, an inactive policy and a locked item context.'
    steps:
      - do: Switch as staff and portal callers and exercise inactive and locked choices.
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#lets staff
          switch it explicitly, the currency following, audited; never a portal member
    expected: >-
      Authorized switching updates currency and history; invalid or locked cases return 400 or 409 and portal
      access is refused.
    negative: false
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#lets staff switch
        it explicitly, the currency following, audited; never a portal member
      - >-
        services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#refuses a switch
        to a profile the tenant does not have, and to an inactive one, 400
      - >-
        services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#refuses a switch
        while an item’s context locks its profile, 409
      - TST-COM-ORD-033
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#lets staff switch
      it explicitly, the currency following, audited; never a portal member
    category: permission
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#lets staff switch
      it explicitly, the currency following, audited; never a portal member
  - id: ATS-COM-ORD-002-04
    title: Explicit policy currency must agree
    level: api
    proves:
      - BR-CAP-COM-ORD-002-06
    preconditions: The explicitly selected policy uses EUR.
    steps:
      - do: Request that policy alongside USD during creation.
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#carries the
          profile named on the create with source explicit, and refuses a currency that is not the profile’s,
          400 currency_mismatch
    expected: Creation returns currency_mismatch.
    negative: true
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#carries the
        profile named on the create with source explicit, and refuses a currency that is not the profile’s,
        400 currency_mismatch
      - TST-COM-ORD-033
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#carries the profile
      named on the create with source explicit, and refuses a currency that is not the profile’s, 400
      currency_mismatch
    category: validation
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#carries the profile
      named on the create with source explicit, and refuses a currency that is not the profile’s, 400
      currency_mismatch
  - id: ATS-COM-ORD-002-05
    title: Placement waits for a resolvable policy
    level: api
    proves:
      - BR-CAP-COM-ORD-002-07
    preconditions: A cart has no resolvable default; another cart is empty with a default available.
    steps:
      - do: 'Attempt placement, explicitly choose a policy and retry the populated cart.'
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#refuses placing
          without a profile, 409 placement_refused with ordering_profile_required, the refusal on the trail;
          then places once staff name one
    expected: 'The missing-policy attempt blocks, the populated retry places and the empty cart reports empty_checkout.'
    negative: true
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#refuses placing
        without a profile, 409 placement_refused with ordering_profile_required, the refusal on the trail;
        then places once staff name one
      - >-
        services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#refuses an empty
        checkout with no store empty_checkout when the workspace has a default checkout policy (COMM-M2 R2-5)
      - TST-COM-ORD-033
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#refuses placing
      without a profile, 409 placement_refused with ordering_profile_required, the refusal on the trail; then
      places once staff name one
    category: validation
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#refuses placing
      without a profile, 409 placement_refused with ordering_profile_required, the refusal on the trail; then
      places once staff name one
  - id: ATS-COM-ORD-002-06
    title: Policy edits leave the earlier sale snapshot intact
    level: api
    proves:
      - BR-CAP-COM-ORD-002-08
    preconditions: An order is placed using the current policy settings.
    steps:
      - do: Change the policy’s payment settings and read the earlier order.
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#places a
          checkout under its profile and freezes the snapshot: the id, the version, the source, the context,
          the rules, the kind
    expected: The policy version advances while the order still holds its original version and methods.
    negative: false
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#places a checkout
        under its profile and freezes the snapshot: the id, the version, the source, the context, the rules,
        the kind
      - >-
        services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#keeps a placed
        order’s snapshot when the profile is edited afterwards: the profile moves to version 2, the order
        stays at 1 with its rules (D24)
      - TST-COM-ORD-033
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#places a checkout
      under its profile and freezes the snapshot: the id, the version, the source, the context, the rules, the
      kind
    category: invariant
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#places a checkout
      under its profile and freezes the snapshot: the id, the version, the source, the context, the rules, the
      kind
  - id: ATS-COM-ORD-002-07
    title: Order kinds derive from contributing applications
    level: unit
    proves:
      - BR-CAP-COM-ORD-002-09
    preconditions: 'Input lines belong to one application, multiple applications or no item application.'
    steps:
      - do: Run classification for each input collection.
        provenance: test
        source: >-
          services-commerce:modules/orders/tests/unit/placement/classify-order.spec.js#classifies an order
          whose item lines one application sold as that kind
    expected: 'The result is the single kind, mixed or general for the respective case.'
    negative: false
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/orders/tests/unit/placement/classify-order.spec.js#classifies an order whose
        item lines one application sold as that kind
      - >-
        services-commerce:modules/orders/tests/unit/placement/classify-order.spec.js#classifies an order whose
        item lines two applications sold as mixed, the kinds in line order
      - >-
        services-commerce:modules/orders/tests/unit/placement/classify-order.spec.js#classifies an order with
        no item line of an application as general: a fee-only order, or lines naming no participant
      - TST-COM-ORD-138
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/unit/placement/classify-order.spec.js#classifies an order whose
      item lines one application sold as that kind
    category: rule
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/orders/tests/unit/placement/classify-order.spec.js#classifies an order whose
      item lines one application sold as that kind
  - id: ATS-COM-ORD-002-08
    title: A bundled item leaves policy selection to a later main item
    category: edge
    level: api
    proves:
      - BR-CAP-COM-ORD-002-03
    preconditions: The first selection is a bundle child and policy is not yet resolved.
    steps:
      - do: Add a main item with a selling context.
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#ignores a
          bundled item (one with a parent) when deciding, and decides at a later add
    expected: The later main item determines the selected policy.
    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/ordering-profile-resolution.e2e.spec.js#ignores a bundled
        item (one with a parent) when deciding, and decides at a later add
      - TST-COM-ORD-033
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#ignores a bundled
      item (one with a parent) when deciding, and decides at a later add
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#ignores a bundled
      item (one with a parent) when deciding, and decides at a later add
  - id: ATS-COM-ORD-002-09
    title: An explicit staff policy permits a different selling context
    category: rule
    level: api
    proves:
      - BR-CAP-COM-ORD-002-05
    preconditions: Staff select an active policy explicitly.
    steps:
      - do: Add an item whose context names another policy.
        provenance: test
        source: >-
          services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#takes an item
          of another context under an EXPLICIT profile: staff chose, the items’ own contexts are not held
          against it
    expected: The item is accepted under the explicitly selected policy.
    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/ordering-profile-resolution.e2e.spec.js#takes an item of
        another context under an EXPLICIT profile: staff chose, the items’ own contexts are not held against
        it
      - TST-COM-ORD-033
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#takes an item of
      another context under an EXPLICIT profile: staff chose, the items’ own contexts are not held against it
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#takes an item of
      another context under an EXPLICIT profile: staff chose, the items’ own contexts are not held against it
  - id: ATS-COM-ORD-002-10
    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-002
      - CAP-COM-ORD-001
    related_capabilities:
      - CAP-COM-ORD-001
    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-002-11
    title: The sale preserves the policy selected during shopping
    category: interaction
    level: api
    proves:
      - BR-CAP-COM-ORD-002-08
      - BR-CAP-COM-ORD-005-09
    preconditions: A cart uses an explicit policy with a known version.
    steps:
      - do: 'Place it, change the policy and read the order.'
        provenance: proposed
        source:
          - >-
            services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#keeps a
            placed order’s snapshot when the profile is edited afterwards: the profile moves to version 2, the
            order stays at 1 with its rules (D24)
          - >-
            services-commerce:modules/checkout/tests/e2e/placement.e2e.spec.js#answers 200 with the order:
            numbered 10000, placed, pending billing, pay now with a thirty-minute tender window, created
    expected: The sale retains the original version and selected settlement settings.
    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#keeps a placed
        order’s snapshot when the profile is edited afterwards: the profile moves to version 2, the order
        stays at 1 with its rules (D24)
      - >-
        services-commerce:modules/checkout/tests/e2e/placement.e2e.spec.js#answers 200 with the order:
        numbered 10000, placed, pending billing, pay now with a thirty-minute tender window, created
    exercises:
      - CAP-COM-ORD-002
      - CAP-COM-ORD-005
    related_capabilities:
      - CAP-COM-ORD-005
    expected_provenance: proposed
    expected_source:
      - >-
        services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#keeps a placed
        order’s snapshot when the profile is edited afterwards: the profile moves to version 2, the order
        stays at 1 with its rules (D24)
      - >-
        services-commerce:modules/checkout/tests/e2e/placement.e2e.spec.js#answers 200 with the order:
        numbered 10000, placed, pending billing, pay now with a thirty-minute tender window, created
  - id: ATS-COM-ORD-002-12
    title: Payment follows the purchased policy after settings change
    category: interaction
    level: api
    proves:
      - BR-CAP-COM-ORD-002-08
      - BR-CAP-COM-ORD-007-03
    preconditions: A card-enabled policy is frozen on a placed sale.
    steps:
      - do: Disable the card choice in the live policy and tender the earlier sale.
        provenance: proposed
        source:
          - >-
            services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#keeps a
            placed order’s snapshot when the profile is edited afterwards: the profile moves to version 2, the
            order stays at 1 with its rules (D24)
          - >-
            services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#refuses an offline
            tender by a member, 403 tender_kind_staff_only, and a kind the profile does not allow, 409, read
            from the ORDER’s snapshot: the order placed before the change still allows it (22 §9)
    expected: The earlier sale still uses its frozen choice.
    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#keeps a placed
        order’s snapshot when the profile is edited afterwards: the profile moves to version 2, the order
        stays at 1 with its rules (D24)
      - >-
        services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#refuses an offline tender by
        a member, 403 tender_kind_staff_only, and a kind the profile does not allow, 409, read from the
        ORDER’s snapshot: the order placed before the change still allows it (22 §9)
    exercises:
      - CAP-COM-ORD-002
      - CAP-COM-ORD-007
    related_capabilities:
      - CAP-COM-ORD-007
    expected_provenance: proposed
    expected_source:
      - >-
        services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#keeps a placed
        order’s snapshot when the profile is edited afterwards: the profile moves to version 2, the order
        stays at 1 with its rules (D24)
      - >-
        services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#refuses an offline tender by
        a member, 403 tender_kind_staff_only, and a kind the profile does not allow, 409, read from the
        ORDER’s snapshot: the order placed before the change still allows it (22 §9)
evidence:
  - >-
    Examined reference:
    services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#carries the profile
    named on the create with source explicit, and refuses a currency that is not the profile’s, 400
    currency_mismatch
  - >-
    Examined reference:
    services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#carries the store’s
    profile with source store, in the profile’s currency, no decision on the trail
  - >-
    Examined reference:
    services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#keeps a placed
    order’s snapshot when the profile is edited afterwards: the profile moves to version 2, the order stays at
    1 with its rules (D24)
  - >-
    Examined reference:
    services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#lets staff switch it
    explicitly, the currency following, audited; never a portal member
  - >-
    Examined reference:
    services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#places a checkout
    under its profile and freezes the snapshot: the id, the version, the source, the context, the rules, the
    kind
  - >-
    Examined reference:
    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
  - >-
    Examined reference:
    services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#refuses a switch to a
    profile the tenant does not have, and to an inactive one, 400
  - >-
    Examined reference:
    services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#refuses a switch
    while an item’s context locks its profile, 409
  - >-
    Examined reference:
    services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#refuses an empty
    checkout with no store empty_checkout when the workspace has a default checkout policy (COMM-M2 R2-5)
  - >-
    Examined reference:
    services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#refuses placing
    without a profile, 409 placement_refused with ordering_profile_required, the refusal on the trail; then
    places once staff name one
  - >-
    Examined reference:
    services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#refuses the conflict
    at the open too, writing no checkout
  - >-
    Examined reference:
    services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#takes the application
    default of a context that names no profile, source application_default
  - >-
    Examined reference:
    services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#takes the first main
    item’s selling context with source selling_context, the context recorded on the checkout and the item
  - >-
    Examined reference:
    services-commerce:modules/checkout/tests/e2e/ordering-profile-resolution.e2e.spec.js#takes the tenant
    default when the item’s application has no default, source tenant_default: an item without a context
    resolves by its participant
  - >-
    Examined reference:
    services-commerce:modules/orders/tests/unit/placement/classify-order.spec.js#classifies an order whose
    item lines one application sold as that kind
  - >-
    Examined reference:
    services-commerce:modules/orders/tests/unit/placement/classify-order.spec.js#classifies an order whose
    item lines two applications sold as mixed, the kinds in line order
  - >-
    Examined reference:
    services-commerce:modules/orders/tests/unit/placement/classify-order.spec.js#classifies an order with no
    item line of an application as general: a fee-only order, or lines naming no participant
coverage:
  rule: covered
  transition: 'gap: FND-COM-ORD-059'
  validation: covered
  permission: 'gap: FND-COM-ORD-059'
  edge: covered
  failure: 'gap: FND-COM-ORD-059'
  boundary: 'gap: FND-COM-ORD-059'
  concurrency: 'gap: FND-COM-ORD-059'
  invariant: 'gap: FND-COM-ORD-059'
  interaction: covered
coverage_definition: Covered means a design scenario exists; executable coverage and execution results are separate.
permission_coverage:
  - key: commerce.checkouts.update
    where_checked: api
    scenarios:
      - ATS-COM-ORD-002-03
    gap: FND-COM-ORD-059
    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-059
  - key: commerce.checkouts.create
    where_checked: api
    scenarios:
      - ATS-COM-ORD-002-03
    gap: FND-COM-ORD-059
    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-059
transition_coverage: []
invariant_coverage:
  - invariant: INV-DOM-COM-ORD-001-01
    scenarios: []
    gap: FND-COM-ORD-059
    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-059
    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-059
    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-059
    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-059
    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-059
    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-059
    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-059
    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.
  - invariant: INV-DOM-COM-ORD-002-01
    scenarios: []
    gap: FND-COM-ORD-059
    provenance: unknown
    source: 'services-commerce:modules/orders/db/orders.table.ts:orders_total_check, orders_amounts_check'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-02
    scenarios: []
    gap: FND-COM-ORD-059
    provenance: unknown
    source: >-
      services-commerce:modules/checkout/tests/e2e/idempotency.e2e.spec.js#answers the stored status and body,
      marked Idempotent-Replayed, and runs the placement once: one order row;
      services-commerce:modules/orders/db/orders.table.ts:orders_checkout_uq
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-03
    scenarios: []
    gap: FND-COM-ORD-059
    provenance: unknown
    source: 'services-commerce:modules/orders/db/orders.table.ts:orders_number_uq, orders_number_check'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-04
    scenarios: []
    gap: FND-COM-ORD-059
    provenance: unknown
    source: 'services-commerce:modules/orders/services/persistence/orders.ts:ORDER_TRANSITIONS'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-05
    scenarios: []
    gap: FND-COM-ORD-059
    provenance: unknown
    source: 'services-commerce:modules/orders/db/order-lines.table.ts:order_lines_quantity_check'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-06
    scenarios: []
    gap: FND-COM-ORD-059
    provenance: unknown
    source: >-
      services-commerce:modules/orders/db/order-line-purchases.table.ts:order_line_purchases_write_once_trigger
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-07
    scenarios: []
    gap: FND-COM-ORD-059
    provenance: unknown
    source: >-
      services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#resumes the same attempt on a
      retry, whatever card the retry names, and moves nothing while the intent is processing
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-08
    scenarios: []
    gap: FND-COM-ORD-059
    provenance: unknown
    source: 'services-commerce:modules/orders/db/order-invoices.table.ts:order_invoices_idempotency_key_uq'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-09
    scenarios: []
    gap: FND-COM-ORD-059
    provenance: unknown
    source: 'services-commerce:modules/orders/db/order-events.table.ts'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-10
    scenarios: []
    gap: FND-COM-ORD-059
    provenance: unknown
    source: 'services-commerce:modules/orders/db/order-lines.table.ts:order_lines_order_fk'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-11
    scenarios: []
    gap: FND-COM-ORD-059
    provenance: unknown
    source: 'services-commerce:modules/orders/db/orders.table.ts:orders_installment_schedule_check'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-12
    scenarios: []
    gap: FND-COM-ORD-059
    provenance: unknown
    source: >-
      services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#never stores the card: the
      attempt keeps a reference of the merchant account and the token’s last four only
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-13
    scenarios: []
    gap: FND-COM-ORD-059
    provenance: unknown
    source: >-
      services-commerce:modules/orders/db/reservations.table.ts:reservations_subject_check;
      modules/orders/services/persistence/reservations.ts:RESERVATION_TRANSITIONS
    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-059
    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-002
    scenarios:
      - ATS-COM-ORD-005-19
    gap: FND-COM-ORD-059
    provenance: proposed
    source:
      - 'services-commerce:modules/checkout/tests/e2e/placement.e2e.spec.js'
      - >-
        services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#refuses a placement made
        after the T-shirt was gone with the same 409 claim_conflict, never a preparation refusal
      - 'services-commerce:modules/checkout/tests/e2e/engine-pricing.e2e.spec.js'
      - >-
        services-commerce:modules/checkout/tests/e2e/accounting-tax.e2e.spec.js#is a tax_quote_refused problem
        on the preview and refuses the placement, placing nothing
      - >-
        services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#rolled the first seat claim
        back with the transaction, and left the booth held for the buyer to retry with
      - >-
        services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#confirms it on the sweep:
        the ledger committed, the participant’s claim committed, claim_confirmed on the order
      - >-
        services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#leaves the order placed and
        pending with one attempt; the buyer’s tender bills it first and proceeds
interaction_coverage:
  - with: CAP-COM-ORD-001
    scenarios:
      - ATS-COM-ORD-002-10
  - with: CAP-COM-ORD-005
    scenarios:
      - ATS-COM-ORD-002-11
  - with: CAP-COM-ORD-007
    scenarios:
      - ATS-COM-ORD-002-12
unproved_rules: []
---

# Select and preserve the sale’s checkout policy: Capability Test Specification

## Coverage

| Rule | Scenario or finding |
|---|---|
| `BR-CAP-COM-ORD-002-01` | `ATS-COM-ORD-002-01` |
| `BR-CAP-COM-ORD-002-02` | `ATS-COM-ORD-002-02`, `ATS-COM-ORD-002-10` |
| `BR-CAP-COM-ORD-002-03` | `ATS-COM-ORD-002-08` |
| `BR-CAP-COM-ORD-002-04` | `ATS-COM-ORD-002-03` |
| `BR-CAP-COM-ORD-002-05` | `ATS-COM-ORD-002-09` |
| `BR-CAP-COM-ORD-002-06` | `ATS-COM-ORD-002-04` |
| `BR-CAP-COM-ORD-002-07` | `ATS-COM-ORD-002-05` |
| `BR-CAP-COM-ORD-002-08` | `ATS-COM-ORD-002-06`, `ATS-COM-ORD-002-11`, `ATS-COM-ORD-002-12` |
| `BR-CAP-COM-ORD-002-09` | `ATS-COM-ORD-002-07` |

## 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.

The sale preserves the policy selected during shopping. A cart uses an explicit policy with a known version. Place it, change the policy and read the order.

Payment follows the purchased policy after settings change. A card-enabled policy is frozen on a placed sale. Disable the card choice in the live policy and tender the earlier sale.

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