---
id: TST-ACC-TRX-049
title: Details terms due date 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/invoices/details-terms-due-date.integration.spec.js
implements:
  - ATS-ACC-TRX-002-05
  - ATS-ACC-TRX-002-06
implements_parts:
  - scenario: ATS-ACC-TRX-002-05
    assertion: 'it recomputes the due date from the terms: ten days after the invoice date'
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/invoices/details-terms-due-date.integration.spec.js#it
      recomputes the due date from the terms: ten days after the invoice date
  - scenario: ATS-ACC-TRX-002-05
    assertion: >-
      it answers the memo, the terms and the explicit due date, which wins over
      the terms’ own
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/invoices/details-terms-due-date.integration.spec.js#it
      answers the memo, the terms and the explicit due date, which wins over the
      terms’ own
  - scenario: ATS-ACC-TRX-002-05
    assertion: it is refused as an invalid request naming the due date
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/invoices/details-terms-due-date.integration.spec.js#it
      is refused as an invalid request naming the due date
  - scenario: ATS-ACC-TRX-002-06
    assertion: 'it leaves the memo, the terms, the due date and the version as they were'
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/invoices/details-terms-due-date.integration.spec.js#it
      leaves the memo, the terms, the due date and the version as they were
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/invoices/details-terms-due-date.integration.spec.js
evidence:
  - provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/invoices/details-terms-due-date.integration.spec.js
    assertion_titles:
      - updateDetails with payment terms and due date (integration)
      - 'the memo, the terms and a due date in one write'
      - >-
        answers the memo, the terms and the explicit due date, which wins over
        the terms’ own
      - raises the version once
      - >-
        appends one invoice_details_changed fact carrying the new terms and due
        date
      - records one update_details document event
      - the terms alone
      - 'recomputes the due date from the terms: ten days after the invoice date'
      - a refused due date
      - is refused as an invalid request naming the due date
      - 'leaves the memo, the terms, the due date and the version as they were'
      - appends no fact and no document event
      - terms the tenant has not
      - is refused not_found
      - leaves the memo as it was
      - a stale version
      - is refused stale
      - changes neither the memo nor the due date
    imports:
      - 'const { stage } = require(''@rhythmsoftware/macroservice-testing/stage'');'
      - >-
        const { createDraft } =
        require('../../../../services/invoices/invoice-drafts');
      - >-
        const { issueInvoice } =
        require('../../../../services/invoices/invoice-issue');
      - >-
        const { updateDetails } =
        require('../../../../services/invoices/invoice-changes');
      - >-
        const { getInvoice } =
        require('../../../../services/invoices/invoice-reads');
      - '} = require(''../../invoices-fixtures'');'
      - "\t\t\tworld.require();"
      - "\t\t\tconst { updated } = updating.require();"
      - "\t\t\tconst { invoice, updated } = updating.require();"
      - "\t\t\tconst facts = await receivableEventRowsOf(TENANT, updating.require().invoice.id);"
      - "\t\t\tconst events = await documentEventRowsOf(TENANT, updating.require().invoice.id);"
      - "\t\t\tworld.require();"
      - "\t\t\texpect([updating.require().payment_terms_id, updating.require().due_date]).to.deep.equal(['net_10', '2026-01-20']);"
      - "\t\t\tworld.require();"
      - "\t\t\tconst { refusal } = attempting.require();"
      - "\t\t\t\t`InvalidRequest: due_date 2025-12-31 is before invoice_date ${attempting.require().invoice.invoice_date}`,"
      - "\t\t\tconst { invoice, after } = attempting.require();"
      - "\t\t\tconst { invoice } = attempting.require();"
      - "\t\t\tworld.require();"
      - "\t\t\texpect([attempting.require().refusal.name, attempting.require().refusal.code]).to.deep.equal(['RecordNotFoundError', 'not_found']);"
      - "\t\t\texpect(attempting.require().after.memo).to.equal('Original');"
      - "\t\t\tworld.require();"
      - "\t\t\texpect(attempting.require().refusal.code).to.equal('stale');"
      - "\t\t\texpect([attempting.require().after.memo, attempting.require().after.due_date]).to.deep.equal(['First', '2026-02-09']);"
    test_double_declarations: []
---

# Details terms due date 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 terms and explicit dates use the right precedence; details update atomically. 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.
