---
id: TST-ACC-TRX-011
title: Payment reversals 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/payment-reversals.e2e.spec.js
implements:
  - ATS-ACC-TRX-007-10
  - ATS-ACC-TRX-013-01
  - ATS-ACC-TRX-013-08
implements_parts:
  - scenario: ATS-ACC-TRX-007-10
    assertion: >-
      it is refused the settled route as a console administrator: it is a system
      route (403)
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/e2e/payment-reversals.e2e.spec.js#it
      is refused the settled route as a console administrator: it is a system
      route (403)
  - scenario: ATS-ACC-TRX-013-01
    assertion: >-
      it is refused the reverse route without accounting.payments.reverse and
      the reversals read without .read (403)
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/e2e/payment-reversals.e2e.spec.js#it
      is refused the reverse route without accounting.payments.reverse and the
      reversals read without .read (403)
  - scenario: ATS-ACC-TRX-013-01
    assertion: it refuses a kind the contract does not know and a missing reason (400)
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/e2e/payment-reversals.e2e.spec.js#it
      refuses a kind the contract does not know and a missing reason (400)
  - scenario: ATS-ACC-TRX-013-08
    assertion: >-
      it opens a dispute on the card, reads it, lists it by payment and closes
      it lost, charging the payment back
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/e2e/payment-reversals.e2e.spec.js#it
      opens a dispute on the card, reads it, lists it by payment and closes it
      lost, charging the payment back
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/payment-reversals.e2e.spec.js
evidence:
  - provenance: test
    source: >-
      services-accounting:modules/transactions/tests/e2e/payment-reversals.e2e.spec.js
    assertion_titles:
      - 'the payment reversal, settlement and dispute routes (end to end)'
      - a caller without the route’s permission
      - >-
        is refused the reverse route without accounting.payments.reverse and the
        reversals read without .read (403)
      - >-
        is refused the settled route as a console administrator: it is a system
        route (403)
      - >-
        is refused the dispute routes without accounting.disputes.create, .read
        and .update (403)
      - tenancy
      - answers another tenant’s dispute 404 exactly as one that does not exist
      - reversing a payment
      - refuses a kind the contract does not know and a missing reason (400)
      - >-
        records a bounced check through the route: the reversal completed, the
        payment returned; the reversals read lists it
      - records a bounced check through the bounce action with a reason
      - >-
        settles an electronic check through the system route as a platform
        caller, then refuses a second settle (409)
      - disputes
      - >-
        opens a dispute on the card, reads it, lists it by payment and closes it
        lost, charging the payment back
    imports:
      - >-
        const { everythingAtPlatform, parseBody, proxyEvent } =
        require('@rhythmsoftware/macroservice-testing/signed-context');
      - 'const { stage } = require(''@rhythmsoftware/macroservice-testing/stage'');'
      - >-
        const { accountingApi, accountingGrant } =
        require('../../../books/tests/e2e/e2e-security');
      - >-
        const { PERMISSION_MISSING, accessRefusalOf, requireOk } =
        require('../../../books/tests/e2e/configuration-e2e-support');
      - >-
        const { receivePayment } =
        require('../../services/payments/payment-receive');
      - '} = require(''../integration/payments-fixtures'');'
      - "\t\t\tctx: ctx ?? session.require().administrator,"
      - "\t\tconst { foreignCard } = session.require();"
      - "\t\t\tconst { check, reader, outsider } = session.require();"
      - "\t\t\tconst { echeck } = session.require();"
      - "\t\t\tconst { card, reader, outsider } = session.require();"
      - "\t\t\t\tawait call('GET', DISPUTE, { id: foreignDispute.require().id }),"
      - "\t\t\tconst { check } = session.require();"
      - "\t\t\tconst { check } = session.require();"
      - "\t\t\tconst { another } = session.require();"
      - "\t\t\tconst { echeck, platform } = session.require();"
      - "\t\t\tconst { card } = session.require();"
    test_double_declarations: []
---

# Payment reversals 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 customer administration cannot mark system clearing; reversal needs authority and valid input; lost inquiry differs from lost chargeback. 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.
