---
id: TST-ACC-TRX-107
title: Refund reservation suite
kind: integration
product_area: accounting
module: transactions
revision: 1
status: draft
source_sha:
  services-accounting: f47cb263875bbc0c5640fba7dae6785ec32695f8
repository: services-accounting
files:
  - >-
    modules/transactions/tests/integration/services/refunds/refund-reservation.integration.spec.js
implements:
  - ATS-ACC-TRX-012-02
implements_parts:
  - scenario: ATS-ACC-TRX-012-02
    assertion: 'it holds the 4000 as pending from the request, nothing refunded yet'
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/refunds/refund-reservation.integration.spec.js#it
      holds the 4000 as pending from the request, nothing refunded yet
  - scenario: ATS-ACC-TRX-012-02
    assertion: >-
      it refuses allocating the reserved money (over_application) but allocates
      money beyond it
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/refunds/refund-reservation.integration.spec.js#it
      refuses allocating the reserved money (over_application) but allocates
      money beyond it
  - scenario: ATS-ACC-TRX-012-02
    assertion: >-
      it refuses a credit of the reserved money, and a second refund of it
      (over_refund)
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/refunds/refund-reservation.integration.spec.js#it
      refuses a credit of the reserved money, and a second refund of it
      (over_refund)
  - scenario: ATS-ACC-TRX-012-02
    assertion: it releases the money when the refund is cancelled
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/refunds/refund-reservation.integration.spec.js#it
      releases the money when the refund is cancelled
  - scenario: ATS-ACC-TRX-012-02
    assertion: >-
      it turns the reservation into the refunded amount when the refund is paid
      offline
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/refunds/refund-reservation.integration.spec.js#it
      turns the reservation into the refunded amount when the refund is paid
      offline
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/integration/services/refunds/refund-reservation.integration.spec.js
evidence:
  - provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/refunds/refund-reservation.integration.spec.js
    assertion_titles:
      - a requested refund reserves its money (integration)
      - 'holds the 4000 as pending from the request, nothing refunded yet'
      - >-
        refuses allocating the reserved money (over_application) but allocates
        money beyond it
      - >-
        refuses a credit of the reserved money, and a second refund of it
        (over_refund)
      - releases the money when the refund is cancelled
      - >-
        turns the reservation into the refunded amount when the refund is paid
        offline
      - 'awaiting approval, and by line'
      - >-
        reserves the money from pending_approval, and a refund by line reserves
        only its unapplied part
    imports:
      - 'const { sql } = require(''drizzle-orm'');'
      - 'const { stage } = require(''@rhythmsoftware/macroservice-testing/stage'');'
      - >-
        const { updateSettings } =
        require('../../../../../books/services/persistence/settings');
      - >-
        const { createCredit } =
        require('../../../../services/credits/credit-commands');
      - >-
        const { allocatePayment } =
        require('../../../../services/payments/payment-allocate');
      - >-
        const { receivePayment } =
        require('../../../../services/payments/payment-receive');
      - >-
        const { cancelRefund, executeRefund, requestRefund } =
        require('../../../../services/refunds/refund-commands');
      - '} = require(''../../payments-fixtures'');'
      - "\t\tconst { held } = world.require();"
      - "\t\tconst { held } = world.require();"
      - "\t\tconst { held, invoice } = world.require();"
      - "\t\tconst { held } = world.require();"
      - "\t\tconst { cancelled } = world.require();"
      - "\t\tconst { paid } = world.require();"
      - "\t\t\tawait updateSettings(ctx(), { default_statement_template_id: null, refunds_require_approval: false }, approval.require().sys_version);"
      - "\t\t\tworld.require();"
    test_double_declarations: []
---

# Refund reservation 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 requested value cannot be spent a second time. 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.
