---
id: TST-ACC-TRX-016
title: Service functions 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/service-functions.e2e.spec.js
implements:
  - ATS-ACC-TRX-020-01
  - ATS-ACC-TRX-020-08
implements_parts:
  - scenario: ATS-ACC-TRX-020-01
    assertion: >-
      it deletes a draft through its delete route, and refuses a route it does
      not list with 404
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/e2e/service-functions.e2e.spec.js#it
      deletes a draft through its delete route, and refuses a route it does not
      list with 404
  - scenario: ATS-ACC-TRX-020-01
    assertion: >-
      it refuses a principal the registry does not know (403) and an event that
      is not a package (400)
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/e2e/service-functions.e2e.spec.js#it
      refuses a principal the registry does not know (403) and an event that is
      not a package (400)
  - scenario: ATS-ACC-TRX-020-01
    assertion: 'it serves the preview and the reversal, and nothing else'
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/e2e/service-functions.e2e.spec.js#it
      serves the preview and the reversal, and nothing else
  - scenario: ATS-ACC-TRX-020-08
    assertion: >-
      it refuses a principal that is not Platform, and a delivery that is not
      one
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/e2e/service-functions.e2e.spec.js#it
      refuses a principal that is not Platform, and a delivery that is not one
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/service-functions.e2e.spec.js
evidence:
  - provenance: test
    source: >-
      services-accounting:modules/transactions/tests/e2e/service-functions.e2e.spec.js
    assertion_titles:
      - the service functions (end to end)
      - accounting_billing_service
      - >-
        answers the issued invoice, whose rows name the service principal as
        their actor
      - reads the invoice back through its read route
      - >-
        deletes a draft through its delete route, and refuses a route it does
        not list with 404
      - >-
        refuses a principal the registry does not know (403) and an event that
        is not a package (400)
      - accounting_tender_service
      - receives a check against the invoice and reads the payment back
      - accounting_reversals_service
      - 'serves the preview and the reversal, and nothing else'
      - accounting_tax_service (M5)
      - >-
        serves the calculation as Commerce: a quote of a line with no address is
        zero with the warning, and nothing else is served
      - accounting_integration_events_service
      - >-
        consumes a delivery from Platform’s router, answering each event’s
        outcome: a payment of nobody’s is ignored, once
      - 'refuses a principal that is not Platform, and a delivery that is not one'
    imports:
      - 'const { stage } = require(''@rhythmsoftware/macroservice-testing/stage'');'
      - >-
        const { sendServicePackage } =
        require('@rhythmsoftware/macroservice-testing/service-invoke');
      - >-
        const { requireOk } =
        require('../../../books/tests/e2e/configuration-e2e-support');
      - >-
        const { ADA, ALPHA_BATCH, draftBody, expect, ready,
        removeTenantInvoices, testId } =
        require('../integration/invoices-fixtures');
      - >-
        const { createPaymentWorld, removeTenantPayments } =
        require('../integration/payments-fixtures');
      - >-
        const { dependencies } =
        require('../../../../aws/accounting.api-handler');
      - >-
        const { billing, integration_events: integrationEvents, tax, tender,
        reversals } = require('../../aws/lambda/SERVICE.handler');
      - "\t\t\tworld.require();"
      - "\t\t\tconst invoice = created.require();"
      - "\t\t\tconst invoice = created.require();"
      - "\t\t\tconst unknown = await invoke(billing, { principal: 'nobody', method: 'GET', path: `/invoices/${TENANT}/${created.require().id}` });"
      - "\t\t\tworld.require();"
    test_double_declarations: []
---

# Service functions 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 service functions restrict callers and operations; processor events are applied once by authorized routing. 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.
