---
id: TST-ACC-TRX-029
title: Transactions views d7 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/db/transactions-views-d7.integration.spec.js
implements:
  - ATS-ACC-TRX-016-05
implements_parts:
  - scenario: ATS-ACC-TRX-016-05
    assertion: >-
      it answers the same invoice as credited in transactions_v, the list of
      every kind
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/db/transactions-views-d7.integration.spec.js#it
      answers the same invoice as credited in transactions_v, the list of every
      kind
  - scenario: ATS-ACC-TRX-016-05
    assertion: >-
      it keeps an invoice still owing its own display status: 6000.00 applied to
      10000.00 reads partially paid, 40.00 open
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/db/transactions-views-d7.integration.spec.js#it
      keeps an invoice still owing its own display status: 6000.00 applied to
      10000.00 reads partially paid, 40.00 open
  - scenario: ATS-ACC-TRX-016-05
    assertion: it answers the same payment in transactions_v with the same open amount
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/db/transactions-views-d7.integration.spec.js#it
      answers the same payment in transactions_v with the same open amount
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/db/transactions-views-d7.integration.spec.js
evidence:
  - provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/db/transactions-views-d7.integration.spec.js
    assertion_titles:
      - the Transactions and Credit Applications views (integration)
      - the derived "Credited" display status (D7(c))
      - >-
        answers the credited invoice as credited in invoices_v, its stored
        status cancelled and nothing open
      - >-
        answers the same invoice as credited in transactions_v, the list of
        every kind
      - >-
        keeps an invoice still owing its own display status: 6000.00 applied to
        10000.00 reads partially paid, 40.00 open
      - a refunded payment’s open amount (D7(a))
      - >-
        answers the held payment in payments_v as its unapplied money less the
        requested refund: 60.00 open
      - answers the same payment in transactions_v with the same open amount
      - >-
        leaves the stored money as it is: 10000 unapplied, 4000 reserved by the
        requested refund
      - a credit application’s invoice (D7(f))
      - >-
        names the invoice the credit was applied to: its id, its number and its
        bill-to’s name, on the application that pays one
      - >-
        names no invoice on the application whose lines pay several: its id,
        number and name are empty
      - 'answers one row per application, the two of this world'
      - answers a query reader in no tenant no application at all
    imports:
      - 'const { expect } = require(''chai'');'
      - 'const { sql } = require(''drizzle-orm'');'
      - 'const { stage } = require(''@rhythmsoftware/macroservice-testing/stage'');'
      - >-
        const { fixtureDb, testId } =
        require('../../../../books/tests/integration/support');
      - '} = require(''../payments-fixtures'');'
      - >-
        const { createCreditMemo } =
        require('../../../services/change-memos/memo-commands');
      - >-
        const { applyCredit, createCredit } =
        require('../../../services/credits/credit-commands');
      - >-
        const { receivePayment } =
        require('../../../services/payments/payment-receive');
      - >-
        const { requestRefund } =
        require('../../../services/refunds/refund-commands');
      - "\t\t\tworld.require();"
      - "\t\t\tconst { credited } = world.require();"
      - "\t\t\tconst row = read.require().invoices.find((candidate) => candidate.id === credited.id);"
      - "\t\t\tconst { credited } = world.require();"
      - "\t\t\tconst row = read.require().union.find((candidate) => candidate.id === `invoice:${credited.id}`);"
      - "\t\t\tconst { applied } = world.require();"
      - "\t\t\tconst row = read.require().invoices.find((candidate) => candidate.id === applied.id);"
      - "\t\t\tworld.require();"
      - "\t\t\t\t  FROM accounting.payments WHERE tenant_id = ${TENANT} AND id = ${world.require().held.id}`);"
      - "\t\t\tconst { held } = world.require();"
      - "\t\t\tconst row = read.require().payments.find((candidate) => candidate.id === held.id);"
      - "\t\t\tconst { held } = world.require();"
      - "\t\t\tconst row = read.require().union.find((candidate) => candidate.id === `payment:${held.id}`);"
      - "\t\t\tconst { stored } = read.require();"
      - "\t\t\tworld.require();"
      - "\t\t\tconst { applied, application, credit } = world.require();"
      - "\t\t\tconst row = read.require().find((candidate) => candidate.id === application.id);"
      - "\t\t\tconst { several, pair } = world.require();"
      - "\t\t\tconst row = read.require().find((candidate) => candidate.id === several.id);"
      - "\t\t\t\t\t.require()"
      - "\t\t\t).to.deep.equal([world.require().application.id, world.require().several.id].sort());"
      - "\t\t\tworld.require();"
    test_double_declarations:
      - ' * Real: PostgreSQL, the migration''s views and grants, row-level security, the commands. Doubled: CRM''s stand-in (the payment'
---

# Transactions views d7 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 transaction display reflects current money. 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.
