---
id: DOM-COM-ORD-003
title: Selling Application
realises: CON-COM-ORD-003
product_area: commerce
module: orders
revision: 1
status: draft
design_intent: proposed
implementation_evidence: observed
source_sha:
  services-commerce: c8b66a98e2490617aec38ba5c8165dd9bd0a8f9b
  macroservice-libraries: 54536a441935c6e09fdb7f96f0bec71c52ba4e03
owned_by: SVC-COM-ORD-participants
readable_by:
  - SVC-COM-ORD-checkout
  - SVC-COM-ORD-orders
  - SVC-COM-ORD-entitlements
lifecycle: STATE-COM-ORD-007
custom_fields: none
identity: >-
  The application key is global. Accounting product-type keys identify its declared types, each of which can
  have only one active owner.
attributes:
  - name: application identifier
    kind: text
    required: true
    computed: false
    notes: A shared application key independent of customer workspaces.
  - name: how Commerce reaches it
    kind: reference
    required: false
    computed: false
    notes: >-
      The manifest names the deployed commerce function; local plain-product and test participants need no
      remote address.
  - name: accepted contract versions
    kind: collection
    required: true
    computed: false
    notes: Supported major versions of the common participant protocol.
  - name: manifest
    kind: collection
    required: true
    computed: false
    notes: The complete most recently reconciled declaration.
  - name: registration instant and activity
    kind: date
    required: true
    computed: false
    notes: The latest registration time and active flag; historical registrations are retained.
  - name: declared product types
    kind: collection
    required: true
    computed: false
    notes: >-
      Types declare payload schemas, hold policy, claim mode and functions, reversal fences, delivery kinds
      and grain, acknowledgment timing, reporting kind and optional same-order audience defaults.
  - name: details schema versions
    kind: collection
    required: true
    computed: false
    notes: >-
      Payload schema versions retain their current or retired designation because past purchases still
      reference them.
relationships:
  - to: DOM-COM-ORD-001
    cardinality: A seller can assess and reserve many cart items of its declared types.
    ownership: 'Cart data belongs to Checkout, while advice and reservation records belong to the seller.'
    cross_service: false
  - to: DOM-COM-ORD-002
    cardinality: A seller can deliver many lines and protect their resources.
    ownership: Orders retains attestation while sellers retain domain delivery and claim data.
    cross_service: false
  - to: DOM-COM-ORD-004
    cardinality: Frozen item details can specify purchased benefits.
    ownership: Commerce interprets the specification and retains grant ownership.
    cross_service: false
invariants:
  - id: INV-DOM-COM-ORD-003-01
    statement: Only one active application may own a product type.
    enforced_at:
      - database
      - service
    provenance: observed
    source: >-
      services-commerce:modules/participants/db/participant-product-types.table.ts:participant_product_types_active_owner_uidx
  - id: INV-DOM-COM-ORD-003-02
    statement: Ordinary application database access can read the registry; registration is its write boundary.
    enforced_at:
      - database
    provenance: observed
    source: 'services-commerce:modules/participants/db/participants.table.ts'
  - id: INV-DOM-COM-ORD-003-03
    statement: >-
      Registration validates the manifest, supported version and the existence, signature and execution grants
      of its claim functions.
    enforced_at:
      - service
    provenance: observed
    source: >-
      services-commerce:modules/participants/services/registration/register-participant.ts;
      modules/participants/services/persistence/participants.ts:claimFunctionProblems
  - id: INV-DOM-COM-ORD-003-04
    statement: >-
      Re-registering reconciles the same declaration; removed types become inactive and returning types
      reactivate without deleting historical rows.
    enforced_at:
      - service
      - database
    provenance: observed
    source: 'services-commerce:modules/participants/services/registration/register-participant.ts'
  - id: INV-DOM-COM-ORD-003-05
    statement: >-
      Participant calls use the subject envelope, an operation timeout and response validation; invalid
      responses become unavailable outcomes.
    enforced_at:
      - service
    provenance: observed
    source: >-
      services-commerce:modules/participants/services/client/lambda-participant-client.ts;
      modules/participants/services/client/participant-invocation.ts
  - id: INV-DOM-COM-ORD-003-06
    statement: 'Placement orders claim work by application, resource and line to keep lock acquisition consistent.'
    enforced_at:
      - service
    provenance: observed
    source: 'services-commerce:modules/orders/services/placement/claims-at-placement.ts'
  - id: INV-DOM-COM-ORD-003-07
    statement: The deployed registration function permits only one concurrent invocation.
    enforced_at:
      - service
    provenance: observed
    source: 'services-commerce:modules/participants/aws/logic/participant-registration.lambda.ts'
physical:
  - participants
  - participant_product_types
  - participant_payload_schemas
evidence:
  - >-
    services-commerce at c8b66a98: modules/participants/db/*.table.ts;
    services/registration/register-participant.ts; services/persistence/participants.ts;
    services/registry/*.ts; services/client/*.ts; services/plain/plain-product-participant.ts;
    aws/logic/participant-registration.lambda.ts; modules/orders/services/persistence/claims.ts.
  - >-
    macroservice-libraries at 54536a44: packages/commerce-contracts/README.md, src/envelope.ts, operations.ts,
    claims.ts (contract version 1, package 0.3.0).
---

# Selling Application

## What It Models

A selling application supplies the rules and delivery behavior for its product types. Commerce coordinates purchases across these sellers, including its local plain-product participant, using advice, preparation, resource claims and delivery requests.

## Identity and Attributes

The registry is shared across workspaces and contains integration declarations rather than customer records. Types describe payload versions, availability protection, cancellation and change fences, delivery grain, acknowledgment deadlines and reporting classification. Optional same-order audience defaults are a Commerce extension to the manifest.

## Relationships

Checkout asks for advice and optional holds. Placement requests authoritative preparation and commits resources through application database functions. Fulfilment later dispatches delivery or reversal. Entitlement specifications in the frozen purchase are interpreted by Commerce's grant handler.

## Invariants

Registration validates declarations and claim-function execution grants before reconciling the registry. A partial unique index limits active product-type ownership, and retired declarations remain available for historical references. Calls enforce the shared envelope, response schemas and timeouts.

## How It Is Stored and Shared

Participants owns registration, registry reads and the invocation client. Remote sellers expose their own functions and claim boundaries; Commerce's local participants run in process. The common contract package defines the shared wire shapes, while Commerce separately validates its manifest extension.

## Open Design Questions

Long cart process references cannot pass through the narrower participant envelope. Donation ownership remains a product question. The type-level audience defaults still need alignment with the shared manifest contract.
