---
id: TST-ACC-TRX-078
title: Payment methods 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/payments/payment-methods.integration.spec.js
implements:
  - ATS-ACC-TRX-006-02
  - ATS-ACC-TRX-006-09
  - ATS-ACC-TRX-013-02
implements_parts:
  - scenario: ATS-ACC-TRX-006-02
    assertion: >-
      it refuses a method the tenant does not have, 404
      payment_method_not_found, writing nothing
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/payments/payment-methods.integration.spec.js#it
      refuses a method the tenant does not have, 404 payment_method_not_found,
      writing nothing
  - scenario: ATS-ACC-TRX-006-02
    assertion: >-
      it refuses an inactive method, 409 payment_method_inactive, writing
      nothing
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/payments/payment-methods.integration.spec.js#it
      refuses an inactive method, 409 payment_method_inactive, writing nothing
  - scenario: ATS-ACC-TRX-006-02
    assertion: >-
      it refuses an offline method in the portal, 409
      payment_method_unavailable, writing nothing
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/payments/payment-methods.integration.spec.js#it
      refuses an offline method in the portal, 409 payment_method_unavailable,
      writing nothing
  - scenario: ATS-ACC-TRX-006-02
    assertion: >-
      it refuses a paper check named by id without its number, 400
      payment_reference_required, writing nothing
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/payments/payment-methods.integration.spec.js#it
      refuses a paper check named by id without its number, 400
      payment_reference_required, writing nothing
  - scenario: ATS-ACC-TRX-006-09
    assertion: >-
      it gives the application no UPDATE of a payment’s method or behaviour at
      all (42501)
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/payments/payment-methods.integration.spec.js#it
      gives the application no UPDATE of a payment’s method or behaviour at all
      (42501)
  - scenario: ATS-ACC-TRX-006-09
    assertion: >-
      it refuses any other writer a change of a payment’s method (the write-once
      trigger, RHF01)
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/payments/payment-methods.integration.spec.js#it
      refuses any other writer a change of a payment’s method (the write-once
      trigger, RHF01)
  - scenario: ATS-ACC-TRX-013-02
    assertion: >-
      it refuses a bounced check of cash, whose method may not bounce
      (reversal_kind_mismatch)
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/payments/payment-methods.integration.spec.js#it
      refuses a bounced check of cash, whose method may not bounce
      (reversal_kind_mismatch)
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/payments/payment-methods.integration.spec.js
evidence:
  - provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/payments/payment-methods.integration.spec.js
    assertion_titles:
      - a payment’s method and behaviour through the commands (integration)
      - an offline payment by payment_method_id
      - 'answers the method id, its offline behaviour and the method alias'
      - 'stores the method and its behaviour on the payment, in the bank account'
      - >-
        records no settlement item: offline money is not reconciled against a
        payout
      - a card by payment_method_id
      - answers the card method and its card behaviour
      - >-
        carries the method and behaviour on the intent, and from it onto the
        payment
      - records the capture’s settlement item as a card’s
      - a bank debit by payment_method_id
      - 'answers the ACH method and its bank_debit behaviour, pending settlement'
      - >-
        records the capture’s settlement item as an electronic check’s, not yet
        eligible
      - 'a method of the tenant’s own, and the alias'
      - records a money order on the tenant’s method
      - records a payment on the retired check value as the paper check method
      - records a payment on the electronic_check value as the ACH method
      - the refusals
      - >-
        refuses a method the tenant does not have, 404 payment_method_not_found,
        writing nothing
      - 'refuses an inactive method, 409 payment_method_inactive, writing nothing'
      - >-
        refuses an offline method in the portal, 409 payment_method_unavailable,
        writing nothing
      - >-
        refuses a card method a tenant restricted to the console, in a public
        link
      - >-
        refuses a paper check named by id without its number, 400
        payment_reference_required, writing nothing
      - >-
        refuses a bounced check of cash, whose method may not bounce
        (reversal_kind_mismatch)
      - the settlement’s payment
      - takes the method by id onto the settlement’s payment
      - refuses an unknown method before anything is reserved
      - what the database holds
      - >-
        refuses a payment whose behaviour is not its method’s
        (payments_payment_method_fk)
      - >-
        gives the application no UPDATE of a payment’s method or behaviour at
        all (42501)
      - >-
        refuses any other writer a change of a payment’s method (the write-once
        trigger, RHF01)
    imports:
      - 'const { sql } = require(''drizzle-orm'');'
      - >-
        const { fixtureId } =
        require('../../../../../../db/test-support/fixture-ids');
      - 'const { stage } = require(''@rhythmsoftware/macroservice-testing/stage'');'
      - >-
        const { expectConstraintViolation } =
        require('@rhythmsoftware/macroservice-testing/refusals');
      - >-
        const { createPaymentMethod, getPaymentMethod, updatePaymentMethod } =
        require('../../../../../books/services/persistence/payment-methods');
      - >-
        const { fixtureDb } =
        require('../../../../../books/tests/integration/support');
      - >-
        const { receivePayment } =
        require('../../../../services/payments/payment-receive');
      - >-
        const { reversePayment } =
        require('../../../../services/payments/payment-reverse');
      - >-
        const { settle } =
        require('../../../../services/settlements/settlement-commands');
      - '} = require(''../../payments-fixtures'');'
      - "\t\t\tworld.require();"
      - "\t\t\texpect(methodOf(paid.require())).to.deep.equal({ payment_method_id: 'cash', behaviour: 'offline', method: 'cash' });"
      - "\t\t\texpect(await paymentRowOf(TENANT, paid.require().id)).to.include({"
      - "\t\t\texpect(await settlementItemRowsOf(TENANT, paid.require().id)).to.deep.equal([]);"
      - "\t\t\tworld.require();"
      - "\t\t\texpect(methodOf(paid.require().payment)).to.deep.equal({"
      - "\t\t\tconst { payment, intent } = paid.require();"
      - "\t\t\tconst items = await settlementItemRowsOf(TENANT, paid.require().payment.id);"
      - "\t\t\tworld.require();"
      - "\t\t\tconst payment = paid.require();"
      - "\t\t\tconst items = await settlementItemRowsOf(TENANT, paid.require().id);"
      - "\t\t\tworld.require();"
      - "\t\t\tworld.require();"
      - "\t\t\tworld.require();"
      - "\t\t\tworld.require();"
      - "\t\t\tworld.require();"
      - "\t\t\tworld.require();"
      - "\t\t\tworld.require();"
      - "\t\t\tworld.require();"
      - "\t\t\tworld.require();"
      - "\t\t\tconst { invoice } = world.require();"
      - "\t\t\tconst { invoice } = world.require();"
      - "\t\t\tworld.require();"
      - "\t\t\tworld.require();"
      - "\t\t\t\tawait updateRefusal((statement) => ctx().withTransaction((tx) => tx.db.execute(statement)), frozen.require().id),"
      - "\t\t\texpect(await updateRefusal((statement) => fixtureDb().execute(statement), frozen.require().id)).to.deep.equal(["
    test_double_declarations: []
---

# Payment methods 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 unavailable methods prevent receipt entry; method identity cannot change after recording; reversal type follows instrument behavior. 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.
