---
id: TST-COM-FUL-027
title: Enforcement handler
kind: integration
product_area: commerce
module: fulfillment
revision: 1
status: draft
source_sha:
  services-commerce: c8b66a98e2490617aec38ba5c8165dd9bd0a8f9b
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
repository: services-commerce
files:
  - >-
    modules/fulfillment/tests/integration/services/enforcement/enforcement-handler.integration.spec.js
implements:
  - ATS-COM-FUL-006-01
  - ATS-COM-FUL-006-02
  - ATS-COM-FUL-006-03
  - ATS-COM-FUL-006-04
environment: local
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 3
isolation: >-
  Run-created workspace identifiers and fixture records in the prepared test database; concurrency
  cases own their extra connections.
evidence:
  - repository: services-commerce
    path: >-
      modules/fulfillment/tests/integration/services/enforcement/enforcement-handler.integration.spec.js
    test_titles:
      - >-
        creates four enforcements: three dispatched (suspend, cancel_line, notify), one for a person
        (review); the none policy and the pending obligation get nothing
      - >-
        writes the suspend enforcement dispatched, with its enforce obligation authorized, queued
        and nudged, keyed on the fact
      - >-
        leaves the review enforcement pending with an enforcement_review exception and no
        obligation, and the cancel_line one dispatched with a review for the request
      - >-
        raises refund_without_cancellation once per delivered order, and the enforcement_created
        line on each history
      - creates nothing when the same fact is enforced again (idempotent on the event id)
      - >-
        completes the three enforce obligations and their enforcements, and the participant
        suspended, cancelled and noted the deliveries
      - >-
        acknowledges a redelivery of the enforce item as stale, and the original obligation is still
        completed
      - >-
        dispatches a restore for the suspended and the notified deliveries (the unlimited product
        declares one) and leaves the capacity product’s with staff
      - >-
        restores the suspended delivery through the participant and closes the suspension as
        restored
      - creates nothing on a second restore fact for an enforcement already restored
    scenario_anchors:
      - >-
        services-commerce:modules/fulfillment/tests/integration/services/enforcement/enforcement-handler.integration.spec.js#creates
        four enforcements: three dispatched (suspend, cancel_line, notify), one for a person
        (review); the none policy and the pending obligation get nothing
      - >-
        services-commerce:modules/fulfillment/tests/integration/services/enforcement/enforcement-handler.integration.spec.js#writes
        the suspend enforcement dispatched, with its enforce obligation authorized, queued and
        nudged, keyed on the fact
      - >-
        services-commerce:modules/fulfillment/tests/integration/services/enforcement/enforcement-handler.integration.spec.js#leaves
        the review enforcement pending with an enforcement_review exception and no obligation, and
        the cancel_line one dispatched with a review for the request
      - >-
        services-commerce:modules/fulfillment/tests/integration/services/enforcement/enforcement-handler.integration.spec.js#raises
        refund_without_cancellation once per delivered order, and the enforcement_created line on
        each history
      - >-
        services-commerce:modules/fulfillment/tests/integration/services/enforcement/enforcement-handler.integration.spec.js#creates
        nothing when the same fact is enforced again (idempotent on the event id)
      - >-
        services-commerce:modules/fulfillment/tests/integration/services/enforcement/enforcement-handler.integration.spec.js#dispatches
        a restore for the suspended and the notified deliveries (the unlimited product declares one)
        and leaves the capacity product’s with staff
      - >-
        services-commerce:modules/fulfillment/tests/integration/services/enforcement/enforcement-handler.integration.spec.js#restores
        the suspended delivery through the participant and closes the suspension as restored
      - >-
        services-commerce:modules/fulfillment/tests/integration/services/enforcement/enforcement-handler.integration.spec.js#creates
        nothing on a second restore fact for an enforcement already restored
---

# Enforcement handler

## Verification Boundary

This suite checks enforcement handler against the prepared PostgreSQL database. Its entry points are the persistence and service functions used by the tests.

## What This Suite Proves

The bound scenarios identify the assertions this suite contributes. Source anchors retain the exact test cases; where a capability scenario has several contributing suites, a single binding does not imply that every branch runs here.

## What It Does Not Prove

Direct service and persistence calls do not establish the full HTTP permission contract, deployed scheduling or browser behavior. No execution result is claimed by this register.

## Real Dependencies and Test Doubles

The database and imported Commerce persistence services are real. Fixtures create the records owned by this run. Financial facts are supplied by a local fixture provider. Queue publication uses the suite’s recording or scripted publisher. Accounting command responses use the suite’s fixture port. Time-sensitive cases use a controlled clock where the source fixture supplies one.

## Must Not Be Doubled

Keep the database constraints, row visibility and persistence writes real when claiming this integration coverage. A canned repository response cannot replace the boundary being checked.
