---
id: TST-COM-ORD-076
title: Cancellations
kind: api-lifecycle
product_area: commerce
module: orders
revision: 1
status: draft
source_sha:
  services-commerce: c8b66a98e2490617aec38ba5c8165dd9bd0a8f9b
repository: services-commerce
files:
  - modules/orders/tests/e2e/cancellations.e2e.spec.js
implements:
  - ATS-COM-ORD-014-01
  - ATS-COM-ORD-014-02
  - ATS-COM-ORD-014-03
  - ATS-COM-ORD-014-04
  - ATS-COM-ORD-014-05
  - ATS-COM-ORD-014-06
  - ATS-COM-ORD-014-07
  - ATS-COM-ORD-014-08
  - ATS-COM-ORD-014-09
  - ATS-COM-ORD-014-10
  - ATS-COM-ORD-014-11
  - ATS-COM-ORD-014-13
  - ATS-COM-ORD-014-14
  - ATS-COM-ORD-014-15
environment: local
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 2
isolation: The suite creates its own test workspace records and removes them using the fixture cleanup.
evidence:
  - provenance: test
    source: 'services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js'
    test_cases:
      - >-
        answers 200 with the document completed in the one request: allowed, executed, the money moved, the
        customer status cancelled
      - >-
        cancels the line’s waiting fulfil obligation itself, grows quantity_cancelled and closes the line; the
        mug untouched, the order still accepted
      - >-
        ran the adjustment at once (nothing stands between the fence and the money): the memo on the sale
        invoice line, the refund of what was paid
      - 'shows the cancellation’s credit on the order’s money mirror at once, read right after the cancel'
      - >-
        tells the story on the order’s history: requested, evaluated, executed, the adjustment requested,
        completed
      - lists the order’s cancellations and reads one; cancelling the mug too closes the order cancelled (B5)
      - had the fulfilment completed by the participant before the request
      - >-
        answers executing: a cancel obligation stands open at once (nothing to fence: the type claims
        nothing), the line executed, the domain action shown
      - >-
        is delivered by the worker to the participant’s cancel, which settles the document completed and runs
        the refund after the domain (ADR-13)
      - >-
        releases the claim through the participant’s function: one seat committed before, none after, the
        ledger released for cancellation
      - >-
        fences a DELIVERED seat through the participant’s commerce_claim_cancellation, and the participant’s
        cancel gives the capacity back
      - >-
        rejects the member’s request with after_cancellation_deadline, the customer status declined; nothing
        moved on the order
      - >-
        holds staff’s request for approval (participant_requires_approval) and refuses a second request on the
        line 409 line_already_cancelling (B38)
      - 'lets the approver approve it with a reason, and staff execute it; the intervention on the history'
      - >-
        allows an administrator’s override at once with its reason, and refuses a clerk’s override 403
        override_not_permitted
      - 'raises the fee invoice, applies the freed money to it and refunds the remainder'
      - >-
        credits no more than the invoice line still owes, so Accounting does not refuse the memo as an
        over-application
      - answers must_return with shipment_handed_off once the shipping fence says the unit shipped
      - >-
        lets the member withdraw an approved, unexecuted request (a second request refused meanwhile), then
        request again
      - >-
        refuses a placed order 409 order_not_cancellable, another member 403 not_your_party, a reader 403
        permission_missing, another tenant 404
      - 'refuses a member on the console approve route 403, and a clerk approving 403 permission_missing'
scenario_coverage:
  - scenario: ATS-COM-ORD-014-01
    test_cases:
      - >-
        refuses a placed order 409 order_not_cancellable, another member 403 not_your_party, a reader 403
        permission_missing, another tenant 404
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
  - scenario: ATS-COM-ORD-014-02
    test_cases:
      - >-
        answers 200 with the document completed in the one request: allowed, executed, the money moved, the
        customer status cancelled
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
  - scenario: ATS-COM-ORD-014-03
    test_cases:
      - >-
        cancels the line’s waiting fulfil obligation itself, grows quantity_cancelled and closes the line; the
        mug untouched, the order still accepted
      - lists the order’s cancellations and reads one; cancelling the mug too closes the order cancelled (B5)
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
  - scenario: ATS-COM-ORD-014-04
    test_cases:
      - >-
        answers executing: a cancel obligation stands open at once (nothing to fence: the type claims
        nothing), the line executed, the domain action shown
      - >-
        is delivered by the worker to the participant’s cancel, which settles the document completed and runs
        the refund after the domain (ADR-13)
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
  - scenario: ATS-COM-ORD-014-05
    test_cases:
      - >-
        credits no more than the invoice line still owes, so Accounting does not refuse the memo as an
        over-application
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
  - scenario: ATS-COM-ORD-014-06
    test_cases:
      - 'raises the fee invoice, applies the freed money to it and refunds the remainder'
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
  - scenario: ATS-COM-ORD-014-07
    test_cases:
      - >-
        holds staff’s request for approval (participant_requires_approval) and refuses a second request on the
        line 409 line_already_cancelling (B38)
      - 'lets the approver approve it with a reason, and staff execute it; the intervention on the history'
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
  - scenario: ATS-COM-ORD-014-08
    test_cases:
      - >-
        rejects the member’s request with after_cancellation_deadline, the customer status declined; nothing
        moved on the order
      - >-
        allows an administrator’s override at once with its reason, and refuses a clerk’s override 403
        override_not_permitted
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
  - scenario: ATS-COM-ORD-014-09
    test_cases:
      - answers must_return with shipment_handed_off once the shipping fence says the unit shipped
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
  - scenario: ATS-COM-ORD-014-10
    test_cases:
      - 'refuses a member on the console approve route 403, and a clerk approving 403 permission_missing'
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
  - scenario: ATS-COM-ORD-014-11
    test_cases:
      - >-
        cancels the line’s waiting fulfil obligation itself, grows quantity_cancelled and closes the line; the
        mug untouched, the order still accepted
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
  - scenario: ATS-COM-ORD-014-13
    test_cases:
      - >-
        lets the member withdraw an approved, unexecuted request (a second request refused meanwhile), then
        request again
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
  - scenario: ATS-COM-ORD-014-14
    test_cases:
      - >-
        releases the claim through the participant’s function: one seat committed before, none after, the
        ledger released for cancellation
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
  - scenario: ATS-COM-ORD-014-15
    test_cases:
      - 'shows the cancellation’s credit on the order’s money mirror at once, read right after the cancel'
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
dependency_evidence:
  provenance: test
  source: 'services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js'
  declared_by_test: >-
    the composed handler, the routes, the cancellation workflow, the register, the participants over their own
    pools, the adjustment worker, the persistence services and PostgreSQL. Doubled: the signing key pair, the
    other services' tables (local stand-ins), Accounting (the fixture transport and the fixture adjustment
    commands), the facts port and the shipping fence (the fixtures the running macroservice carries), the
    queue publisher (recording).
---

# Cancellations

## Verification Boundary

The suite drives the composed local API dispatcher and its registered routes.

## What This Suite Proves

The registered cases check cancellations with their fixture records and assertions. Scenario bindings name only the examples those cases exercise.

## What It Does Not Prove

A registered file supplies no run result or verified conformance by itself. Local fixtures do not establish deployed cross-service behavior or complete browser journeys.

## Real Dependencies and Test Doubles

PostgreSQL and the exercised Commerce persistence or workflow code are real. Remote service records, clocks and transports follow the suite’s fixtures.

## Must Not Be Doubled

The database constraints, role restrictions, locks and transactions exercised by this suite must use PostgreSQL.
