---
id: TST-ACC-TRX-033
title: Credit memo allocations 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/change-memos/credit-memo-allocations.integration.spec.js
implements:
  - ATS-ACC-TRX-003-04
implements_parts:
  - scenario: ATS-ACC-TRX-003-04
    assertion: >-
      it frees 10.00 from the newest check alone, back on that check as
      unapplied cash, the older check untouched; the line credited 10.00 and
      owing nothing
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/change-memos/credit-memo-allocations.integration.spec.js#it
      frees 10.00 from the newest check alone, back on that check as unapplied
      cash, the older check untouched; the line credited 10.00 and owing nothing
  - scenario: ATS-ACC-TRX-003-04
    assertion: >-
      it answers the same memo to the same request again, freeing nothing twice
      (idempotent)
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/change-memos/credit-memo-allocations.integration.spec.js#it
      answers the same memo to the same request again, freeing nothing twice
      (idempotent)
  - scenario: ATS-ACC-TRX-003-04
    assertion: >-
      it frees the newest check’s remaining 15.00 first, then 15.00 of the older
      check, each holding what was freed from it
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/change-memos/credit-memo-allocations.integration.spec.js#it
      frees the newest check’s remaining 15.00 first, then 15.00 of the older
      check, each holding what was freed from it
  - scenario: ATS-ACC-TRX-003-04
    assertion: >-
      it is refused over_application and changes no allocation or balance
      (atomic)
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/change-memos/credit-memo-allocations.integration.spec.js#it
      is refused over_application and changes no allocation or balance (atomic)
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/change-memos/credit-memo-allocations.integration.spec.js
evidence:
  - provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/change-memos/credit-memo-allocations.integration.spec.js
    assertion_titles:
      - a credit memo adjusting allocations (integration)
      - >-
        starts paid in full: 35.00 and 25.00 allocated, nothing unapplied
        (premise)
      - a memo of 10.00 on the paid line
      - >-
        frees 10.00 from the newest check alone, back on that check as unapplied
        cash, the older check untouched; the line credited 10.00 and owing
        nothing
      - >-
        answers the same memo to the same request again, freeing nothing twice
        (idempotent)
      - a memo of more than the line’s total
      - >-
        is refused over_application and changes no allocation or balance
        (atomic)
      - 'a memo of 30.00 more, across both checks'
      - >-
        frees the newest check’s remaining 15.00 first, then 15.00 of the older
        check, each holding what was freed from it
    imports:
      - 'const { expect } = require(''chai'');'
      - >-
        const { systemClock } =
        require('@rhythmsoftware/macroservice-time/clock');
      - 'const { stage } = require(''@rhythmsoftware/macroservice-testing/stage'');'
      - >-
        const { createCreditMemo } =
        require('../../../../services/change-memos/memo-commands');
      - >-
        const { receivePayment } =
        require('../../../../services/payments/payment-receive');
      - '} = require(''../../payments-fixtures'');'
      - "\t\tconst { before } = world.require();"
      - "\t\t\tconst { invoice, first, second } = world.require();"
      - "\t\t\tconst { memo, after } = credited.require();"
      - "\t\t\tconst { invoice, first, second } = world.require();"
      - "\t\t\tconst { memo } = credited.require();"
      - "\t\t\texpect(await positionOf(invoice, first, second)).to.deep.equal(credited.require().after);"
      - "\t\t\tconst { invoice, first, second } = world.require();"
      - "\t\t\tconst { invoice, first, second } = world.require();"
    test_double_declarations: []
---

# Credit memo allocations 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 paid-value freeing follows receipt recency. 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.
