---
id: TST-ACC-TRX-017
title: Settlements suite
kind: api-lifecycle
product_area: accounting
module: transactions
revision: 1
status: draft
source_sha:
  services-accounting: f47cb263875bbc0c5640fba7dae6785ec32695f8
repository: services-accounting
files:
  - modules/transactions/tests/e2e/settlements.e2e.spec.js
implements:
  - ATS-ACC-TRX-009-01
  - ATS-ACC-TRX-014-08
implements_parts:
  - scenario: ATS-ACC-TRX-009-01
    assertion: >-
      it is refused the settle route as a reader and the settlement read as an
      outsider (403)
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/e2e/settlements.e2e.spec.js#it
      is refused the settle route as a reader and the settlement read as an
      outsider (403)
  - scenario: ATS-ACC-TRX-014-08
    assertion: >-
      it is refused the reversal routes without accounting.reversals.create,
      .preview and .read (403)
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/e2e/settlements.e2e.spec.js#it
      is refused the reversal routes without accounting.reversals.create,
      .preview and .read (403)
environment: local
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 3
isolation: >-
  Suite-marked records in the prepared local test database; fixture teardown
  removes owned records.
provenance: test
source: 'services-accounting:modules/transactions/tests/e2e/settlements.e2e.spec.js'
evidence:
  - provenance: test
    source: 'services-accounting:modules/transactions/tests/e2e/settlements.e2e.spec.js'
    assertion_titles:
      - the settlement and reversal routes (end to end)
      - a caller without the route’s permission
      - >-
        is refused the settle route as a reader and the settlement read as an
        outsider (403)
      - >-
        is refused the reversal routes without accounting.reversals.create,
        .preview and .read (403)
      - tenancy
      - >-
        answers another tenant’s settlement and reversal 404 exactly as ones
        that do not exist
      - 'a body the contract refuses, before any command runs'
      - >-
        refuses a settlement with no invoice lines and a reversal with no
        financial action (400)
      - the settlement
      - >-
        completed with a check of 10000 allocated to both lines, numbered from
        1,000,000
      - >-
        replays the same key and body as the same settlement, and reads it back
        with its payment
      - the reversal
      - >-
        previews reversing 1000 of the dues line without writing, then reverses
        it: the remainder credited, read back
    imports:
      - >-
        const { parseBody, proxyEvent } =
        require('@rhythmsoftware/macroservice-testing/signed-context');
      - 'const { stage } = require(''@rhythmsoftware/macroservice-testing/stage'');'
      - >-
        const { accountingApi, accountingGrant } =
        require('../../../books/tests/e2e/e2e-security');
      - >-
        const { PERMISSION_MISSING, accessRefusalOf, requireOk } =
        require('../../../books/tests/e2e/configuration-e2e-support');
      - '} = require(''../integration/payments-fixtures'');'
      - "\t\t\tctx: ctx ?? session.require().administrator,"
      - "\t\tconst { invoice } = session.require();"
      - "\t\tconst { foreignInvoice } = session.require();"
      - "\t\t\tconst { invoice, reader, outsider } = session.require();"
      - "\t\t\t\taccessRefusalOf(await call('GET', SETTLEMENT, { id: settled.require().settlement.id, ctx: outsider })),"
      - "\t\t\tconst { invoice, reader, outsider } = session.require();"
      - "\t\t\tconst { settlement, reversal } = foreign.require();"
      - "\t\t\tconst { invoice } = session.require();"
      - "\t\t\tconst outcome = settled.require();"
      - "\t\t\tconst { invoice } = session.require();"
      - "\t\t\tconst outcome = settled.require();"
      - "\t\t\tconst { invoice } = session.require();"
    test_double_declarations: []
---

# Settlements suite

## Verification Boundary

The suite exercises transaction commands and database protections in the local prepared test environment. Registration records the existing executable file; it does not report a run or establish product approval.

## What This Suite Proves

Its cited assertions contribute evidence for settlement access requires the combined authorities; preview authority is separate from creation. The structured assertion bindings identify which parts of combined scenarios it executes.

## What It Does Not Prove

Local commands and route invocations do not establish deployed routing, live processor guarantees or the complete staff browser experience. An unbound feature chain remains proposed, and this registration carries no execution result.

## Real Dependencies and Test Doubles

The suite uses the imported commands, route handlers or persistence code against the local test database. Fixture helpers supply accounting context; any stepped clock, dummy processor or substituted external client is retained in the evidence declarations.

## Must Not Be Doubled

The command or persistence behavior under assertion and its relevant database protections must remain real. Substituting the final financial result removes evidence of transactional effects.
