---
id: WF-COM-CAT-002
title: Resolve which checkout policy a sale follows
trigger: >-
  Checkout chooses one policy for its selling context, prevents conflicting item choices and retains the
  processing settings on the placed order.
product_area: commerce
module: catalog
revision: 1
status: draft
design_intent: confirmed
implementation_evidence: observed
inference: []
source_sha:
  services-commerce: c8b66a98e2490617aec38ba5c8165dd9bd0a8f9b
implements:
  - CAP-COM-CAT-002
crosses:
  - SVC-COM-CAT-configuration
idempotency: >-
  Resolution only reads configuration. Repeating it uses current saved defaults and has no write to
  deduplicate.
concurrency: >-
  Default resolution uses current reads without a retained lock. The checkout stores its chosen policy;
  placement captures its current policy settings rather than reselecting a moved default.
hops:
  - 'n': 1
    actor_or_service: Checkout module
    action: 'Checkout selects explicit, store or first-item context policy before calling shared fallback resolution.'
    anchor: 'services-commerce:modules/checkout/services/checkout/ordering-profile-resolution.ts'
    seam: sync
    on_failure: Reject an item whose policy conflicts with the checkout’s selected policy.
    left_inconsistent: The conflicting item is not retained.
    observer: The requesting person or service receives the result and any returned refusal.
    provenance: documented
    source: 'services-commerce:docs/milestones/COMM-M1-set-up-what-you-sell.md#D9'
  - 'n': 2
    actor_or_service: Configuration service
    action: 'Resolve explicit selection, application default or workspace default and identify the selected source.'
    anchor: 'services-commerce:modules/configuration/services/persistence/ordering-profiles.ts:resolveOrderingProfile'
    seam: sync
    on_failure: Reject an unknown explicit policy; return an empty resolution when no policy exists.
    left_inconsistent: Resolution changes no records.
    observer: The requesting person or service receives the result and any returned refusal.
    provenance: test
    source: >-
      services-commerce:modules/configuration/tests/e2e/ordering-profiles.e2e.spec.js#resolves a context: the
      profile it names (explicit), else its application’s default, else the tenant default
  - 'n': 3
    actor_or_service: Checkout module
    action: Check that a newly resolved checkout policy is active.
    anchor: 'services-commerce:modules/checkout/services/checkout/ordering-profile-resolution.ts'
    seam: sync
    on_failure: Refuse new checkout processing under an inactive policy.
    left_inconsistent: No checkout is created under that policy.
    observer: The requesting person or service receives the result and any returned refusal.
    provenance: documented
    source: 'services-commerce:modules/configuration/services/persistence/ordering-profiles.ts'
  - 'n': 4
    actor_or_service: Order placement
    action: 'Capture settlement, card, invoice and charge-product settings on the placed order.'
    anchor: 'services-commerce:modules/configuration/services/persistence/ordering-profiles.ts:snapshotOf'
    seam: sync
    on_failure: Fail placement and roll back its transaction.
    left_inconsistent: Order and policy snapshot commit together or neither remains.
    observer: The requesting person or service receives the result and any returned refusal.
    provenance: test
    source: >-
      services-commerce:modules/configuration/tests/integration/services/persistence/ordering-profiles.queries.integration.spec.js#snapshotOf
      freezes the settlement, card, invoicing, fee-product and quote rules an order carries (22 §9), nothing
      else
branches:
  - >-
    The console resolution endpoint covers explicit and default choices; store and item-context choices are
    performed by checkout.
waits: []
evidence:
  - >-
    services-commerce at c8b66a98: modules/configuration/services/persistence/ordering-profiles.ts
    (resolveOrderingProfile, snapshotOf); modules/checkout/services/checkout/ordering-profile-resolution.ts;
    modules/orders/services/placement/place-order.ts (the callers);
    docs/milestones/COMM-M1-set-up-what-you-sell.md (D9).
controls: [TC-AZ-001, TC-AZ-002, TC-AZ-003, TC-AZ-004, TC-AZ-005, TC-AZ-006, TC-TEN-001, TC-TEN-002, TC-TEN-003, TC-CRY-001, TC-CRY-004, TC-DAT-001, TC-DAT-002, TC-DAT-003, TC-LOG-004, TC-LOG-005, TC-PI-001, TC-PI-002, TC-PI-003, TC-PI-005, TC-PRV-001, TC-PRV-002]
---

# Resolve which checkout policy a sale follows

## What It Does

Checkout chooses one policy for its selling context, prevents conflicting item choices and retains the processing settings on the placed order.

## The Flow

```mermaid
sequenceDiagram
  participant K as Checkout module
  participant C as Configuration service
  participant O as Order placement
  K->>K: explicit, store, selling context
  K->>C: resolve(explicit?, application key)
  C-->>K: policy and winning source, or nothing
  K->>K: refuse inactive or conflicting policy
  O->>C: snapshot of the policy's rules
  C-->>O: frozen rules on the order
```

## When Something Fails

Reject an item whose policy conflicts with the checkout’s selected policy. The conflicting item is not retained. Reject an unknown explicit policy; return an empty resolution when no policy exists. Resolution changes no records. Refuse new checkout processing under an inactive policy. No checkout is created under that policy. Fail placement and roll back its transaction. Order and policy snapshot commit together or neither remains.

## Open Design Questions

The implemented recovery and concurrency behaviour above defines the current boundary. Any change to transaction scope or product authority requires a recorded decision.
