---
id: ATS-ACC-TRX-009
scope: CAP-ACC-TRX-009
product_area: accounting
module: transactions
revision: 1
status: proposed
approved_by: null
approved_at: null
source_sha:
  services-accounting: f47cb263875bbc0c5640fba7dae6785ec32695f8
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
scenarios:
  - id: ATS-ACC-TRX-009-01
    title: Settlement access requires the combined authorities
    level: api
    proves:
      - BR-CAP-ACC-TRX-009-01
    preconditions: Reader and outsider identities exist.
    steps:
      - do: Create as the reader and inspect as the outsider.
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/e2e/settlements.e2e.spec.js#it
          is refused the settle route as a reader and the settlement read as an
          outsider (403)
    expected: Both operations deny access.
    negative: true
    data_needs: Distinct permission personas.
    bound_to:
      - >-
        services-accounting:modules/transactions/tests/e2e/settlements.e2e.spec.js#it
        is refused the settle route as a reader and the settlement read as an
        outsider (403)
      - TST-ACC-TRX-017
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/e2e/settlements.e2e.spec.js#it
      is refused the settle route as a reader and the settlement read as an
      outsider (403)
    category: permission
    test_bindings:
      - file: >-
          services-accounting:modules/transactions/tests/e2e/settlements.e2e.spec.js
        assertion: >-
          it is refused the settle route as a reader and the settlement read as
          an outsider (403)
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/e2e/settlements.e2e.spec.js#it
          is refused the settle route as a reader and the settlement read as an
          outsider (403)
    binding_review: []
  - id: ATS-ACC-TRX-009-02
    title: Empty debt cannot start settlement
    level: api
    proves:
      - BR-CAP-ACC-TRX-009-02
    preconditions: The selected invoice is fully settled.
    steps:
      - do: Request another settlement.
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          refuses settling an invoice that owes nothing (nothing_to_allocate)
    expected: No allocatable value is reported.
    negative: true
    data_needs: A paid invoice.
    bound_to:
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
        refuses settling an invoice that owes nothing (nothing_to_allocate)
      - TST-ACC-TRX-126
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      refuses settling an invoice that owes nothing (nothing_to_allocate)
    category: validation
    test_bindings:
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js
        assertion: it refuses settling an invoice that owes nothing (nothing_to_allocate)
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          refuses settling an invoice that owes nothing (nothing_to_allocate)
    binding_review: []
  - id: ATS-ACC-TRX-009-03
    title: Settlement retains customer boundaries
    level: api
    proves:
      - BR-CAP-ACC-TRX-009-02
    preconditions: >-
      The request is for a member while invoice and credit belong to an
      employer.
    steps:
      - do: Select the employer’s invoice and credit separately.
        provenance: proposed
        source: 'services-accounting:docs/accounting/settlements.md#Refusals'
    expected: Both fail before reservation or financial writes.
    negative: true
    data_needs: Two customers with incompatible resources.
    bound_to: []
    provenance: proposed
    source: 'services-accounting:docs/accounting/settlements.md#Refusals'
    category: boundary
    test_bindings: []
    binding_review: []
  - id: ATS-ACC-TRX-009-04
    title: Credit precedes the remainder tender
    level: api
    proves:
      - BR-CAP-ACC-TRX-009-03
    preconditions: Credit holds 5.00 against 85.00 debt over two lines.
    steps:
      - do: Settle using credit and a check.
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          applies the open credit’s 500 first and takes a check of 8000 for the
          rest: completed with its payment
    expected: Credit contributes first and the check supplies the remaining 80.00.
    negative: false
    data_needs: Eligible credit and invoice lines.
    bound_to:
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
        applies the open credit’s 500 first and takes a check of 8000 for the
        rest: completed with its payment
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
        allocated the check by the plan: 4000 to the first line (what the credit
        left) and 4000 to the second; the invoice paid
      - >-
        react-console:acceptance/accounting/playwright/journeys/payments/ACT-ACC-0301.spec.ts#ACT-ACC-0301
      - TST-ACC-TRX-126
      - TST-ACC-TRX-240
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      applies the open credit’s 500 first and takes a check of 8000 for the
      rest: completed with its payment
    category: interaction
    test_bindings:
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js
        assertion: >-
          it applies the open credit’s 500 first and takes a check of 8000 for
          the rest: completed with its payment
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          applies the open credit’s 500 first and takes a check of 8000 for the
          rest: completed with its payment
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js
        assertion: >-
          it allocated the check by the plan: 4000 to the first line (what the
          credit left) and 4000 to the second; the invoice paid
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          allocated the check by the plan: 4000 to the first line (what the
          credit left) and 4000 to the second; the invoice paid
      - file: >-
          react-console:acceptance/accounting/playwright/journeys/payments/ACT-ACC-0301.spec.ts
        assertion: ACT-ACC-0301
        provenance: test
        source: >-
          react-console:acceptance/accounting/playwright/journeys/payments/ACT-ACC-0301.spec.ts#ACT-ACC-0301
    binding_review:
      - binding: >-
          react-console:acceptance/accounting/playwright/journeys/payments/ACT-ACC-0301.spec.ts#ACT-ACC-0301
        completeness: not-verified
        provenance: observed
        source: >-
          react-console:acceptance/accounting/playwright/journeys/payments/ACT-ACC-0301.spec.ts#ACT-ACC-0301
        note: >-
          This citation remains component evidence. A browser request driven
          through an API helper does not establish direct database checks or
          every branch of the combined scenario.
  - id: ATS-ACC-TRX-009-05
    title: Definite failure releases value for retry
    level: api
    proves:
      - BR-CAP-ACC-TRX-009-04
      - BR-CAP-ACC-TRX-009-09
      - INV-DOM-ACC-TRX-003-16
    preconditions: A credit-backed settlement uses a declining card.
    steps:
      - do: 'Submit, then retry the key with an accepted card.'
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          refuses with the decline (processor_declined), the settlement failed
          with the code, the reservation released, nothing applied
    expected: >-
      Failure frees the reservation and a new attempt completes with one
      successful capture.
    negative: false
    data_needs: Declining and accepted processor scripts.
    bound_to:
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
        refuses with the decline (processor_declined), the settlement failed
        with the code, the reservation released, nothing applied
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/settlement-retry.integration.spec.js#it
        runs a new attempt under the key: a new settlement, completed with a
        payment, stored under the key with its attempt number
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/settlement-retry.integration.spec.js#it
        charged once: the invoice paid by the second attempt’s payment
      - >-
        react-console:acceptance/accounting/playwright/journeys/payments/ACT-ACC-0317.spec.ts#ACT-ACC-0317
      - TST-ACC-TRX-126
      - TST-ACC-TRX-124
      - TST-ACC-TRX-252
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      refuses with the decline (processor_declined), the settlement failed with
      the code, the reservation released, nothing applied
    category: failure
    test_bindings:
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js
        assertion: >-
          it refuses with the decline (processor_declined), the settlement
          failed with the code, the reservation released, nothing applied
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          refuses with the decline (processor_declined), the settlement failed
          with the code, the reservation released, nothing applied
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlement-retry.integration.spec.js
        assertion: >-
          it runs a new attempt under the key: a new settlement, completed with
          a payment, stored under the key with its attempt number
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlement-retry.integration.spec.js#it
          runs a new attempt under the key: a new settlement, completed with a
          payment, stored under the key with its attempt number
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlement-retry.integration.spec.js
        assertion: 'it charged once: the invoice paid by the second attempt’s payment'
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlement-retry.integration.spec.js#it
          charged once: the invoice paid by the second attempt’s payment
      - file: >-
          react-console:acceptance/accounting/playwright/journeys/payments/ACT-ACC-0317.spec.ts
        assertion: ACT-ACC-0317
        provenance: test
        source: >-
          react-console:acceptance/accounting/playwright/journeys/payments/ACT-ACC-0317.spec.ts#ACT-ACC-0317
    binding_review:
      - binding: >-
          react-console:acceptance/accounting/playwright/journeys/payments/ACT-ACC-0317.spec.ts#ACT-ACC-0317
        completeness: not-verified
        provenance: observed
        source: >-
          react-console:acceptance/accounting/playwright/journeys/payments/ACT-ACC-0317.spec.ts#ACT-ACC-0317
        note: >-
          This citation remains component evidence. A browser request driven
          through an API helper does not establish direct database checks or
          every branch of the combined scenario.
  - id: ATS-ACC-TRX-009-06
    title: Credit-only settlement explains extra money
    level: api
    proves:
      - BR-CAP-ACC-TRX-009-05
    preconditions: One case has enough credit and another also supplies a 50.00 check.
    steps:
      - do: >-
          Settle credit alone, submit zero payment and submit the credit-covered
          case with the check.
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlement-unapplied.integration.spec.js#it
          leaves the check’s whole 5000 unapplied and says so plainly in the
          answer
    expected: >-
      Credit-only completes, zero fails and the check remains fully available
      with an explicit notice.
    negative: false
    data_needs: Credits covering the target lines.
    bound_to:
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
        completes in the request’s transaction: numbered from 1,000,000, 1500 of
        credit, no payment, the resolve, reserve_credits and complete steps done
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
        refuses a payment of nothing: a settlement’s payment is greater than
        zero, and nothing is written
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/settlement-unapplied.integration.spec.js#it
        leaves the check’s whole 5000 unapplied and says so plainly in the
        answer
      - TST-ACC-TRX-126
      - TST-ACC-TRX-125
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlement-unapplied.integration.spec.js#it
      leaves the check’s whole 5000 unapplied and says so plainly in the answer
    category: edge
    test_bindings:
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js
        assertion: >-
          it completes in the request’s transaction: numbered from 1,000,000,
          1500 of credit, no payment, the resolve, reserve_credits and complete
          steps done
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          completes in the request’s transaction: numbered from 1,000,000, 1500
          of credit, no payment, the resolve, reserve_credits and complete steps
          done
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js
        assertion: >-
          it refuses a payment of nothing: a settlement’s payment is greater
          than zero, and nothing is written
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          refuses a payment of nothing: a settlement’s payment is greater than
          zero, and nothing is written
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlement-unapplied.integration.spec.js
        assertion: >-
          it leaves the check’s whole 5000 unapplied and says so plainly in the
          answer
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlement-unapplied.integration.spec.js#it
          leaves the check’s whole 5000 unapplied and says so plainly in the
          answer
    binding_review: []
  - id: ATS-ACC-TRX-009-07
    title: Overpayment treatment is explicit
    level: api
    proves:
      - BR-CAP-ACC-TRX-009-06
    preconditions: The invoice owes 90.00.
    steps:
      - do: 'Tender 100.00 using credit treatment, then try refusal treatment.'
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          completes with an overpayment credit of 1000 made from the payment,
          the payment’s unapplied money gone into it
    expected: The first creates 10.00 credit and the second leaves no writes.
    negative: false
    data_needs: An outstanding invoice.
    bound_to:
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
        completes with an overpayment credit of 1000 made from the payment, the
        payment’s unapplied money gone into it
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
        refuses more than the lines owe when the treatment is refuse
        (over_application), writing nothing
      - TST-ACC-TRX-126
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      completes with an overpayment credit of 1000 made from the payment, the
      payment’s unapplied money gone into it
    category: boundary
    test_bindings:
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js
        assertion: >-
          it completes with an overpayment credit of 1000 made from the payment,
          the payment’s unapplied money gone into it
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          completes with an overpayment credit of 1000 made from the payment,
          the payment’s unapplied money gone into it
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js
        assertion: >-
          it refuses more than the lines owe when the treatment is refuse
          (over_application), writing nothing
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          refuses more than the lines owe when the treatment is refuse
          (over_application), writing nothing
    binding_review: []
  - id: ATS-ACC-TRX-009-08
    title: One fee follows eligible card value
    level: api
    proves:
      - BR-CAP-ACC-TRX-009-07
    preconditions: 'Required, optional and fee-free invoices use 2.5 percent plus 0.30.'
    steps:
      - do: >-
          Tender single, paired, mixed-policy, accepted-optional and partial
          cases.
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
          charges 10280 in one tender: the invoice and the fee of 280 (2.5% +
          30) both paid, the step card_fee done, the fee invoice answered
    expected: >-
      The eligible value determines one proportionally shared fee, including the
      102.80 single-invoice total.
    negative: false
    data_needs: Fee product and unit calculation rule.
    bound_to:
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
        charges 10280 in one tender: the invoice and the fee of 280 (2.5% + 30)
        both paid, the step card_fee done, the fee invoice answered
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
        shares one fee over two required invoices in proportion, the fixed
        amount charged once: 20000 at 2.5% + 30 is 530
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
        charges the fee on the required invoice’s share alone: 20280 for a
        required and a none invoice of 10000 each
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
        is charged when the payer accepts it
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
        computes the fee on the 4000 tendered (130), charges 4130, and leaves
        the invoice owing 6000
      - TST-ACC-TRX-122
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
      charges 10280 in one tender: the invoice and the fee of 280 (2.5% + 30)
      both paid, the step card_fee done, the fee invoice answered
    category: rule
    test_bindings:
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js
        assertion: >-
          it charges 10280 in one tender: the invoice and the fee of 280 (2.5% +
          30) both paid, the step card_fee done, the fee invoice answered
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
          charges 10280 in one tender: the invoice and the fee of 280 (2.5% +
          30) both paid, the step card_fee done, the fee invoice answered
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js
        assertion: >-
          it shares one fee over two required invoices in proportion, the fixed
          amount charged once: 20000 at 2.5% + 30 is 530
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
          shares one fee over two required invoices in proportion, the fixed
          amount charged once: 20000 at 2.5% + 30 is 530
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js
        assertion: >-
          it charges the fee on the required invoice’s share alone: 20280 for a
          required and a none invoice of 10000 each
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
          charges the fee on the required invoice’s share alone: 20280 for a
          required and a none invoice of 10000 each
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js
        assertion: it is charged when the payer accepts it
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
          is charged when the payer accepts it
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js
        assertion: >-
          it computes the fee on the 4000 tendered (130), charges 4130, and
          leaves the invoice owing 6000
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
          computes the fee on the 4000 tendered (130), charges 4130, and leaves
          the invoice owing 6000
    binding_review: []
  - id: ATS-ACC-TRX-009-09
    title: Required fees block incompatible tenders
    level: api
    proves:
      - BR-CAP-ACC-TRX-009-08
    preconditions: An invoice requires a fee and another unit lacks its fee rule.
    steps:
      - do: >-
          Decline the fee, use missing configuration, then tender check and
          excluded bank debit.
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
          refuses the settlement with card_fee_required naming the invoice, and
          writes nothing
    expected: Required-fee failures write nothing and the nonfee methods add no charge.
    negative: true
    data_needs: Configured and absent fee policies.
    bound_to:
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
        refuses the settlement with card_fee_required naming the invoice, and
        writes nothing
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
        refuses a card paying a required invoice: card_fee_rule_missing names
        the unit and the invoice, nothing written
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
        charges no fee on a check paying a required invoice
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
        charges no fee on an electronic check unless the unit’s rule charges
        them, then the same fee as a card
      - TST-ACC-TRX-122
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
      refuses the settlement with card_fee_required naming the invoice, and
      writes nothing
    category: validation
    test_bindings:
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js
        assertion: >-
          it refuses the settlement with card_fee_required naming the invoice,
          and writes nothing
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
          refuses the settlement with card_fee_required naming the invoice, and
          writes nothing
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js
        assertion: >-
          it refuses a card paying a required invoice: card_fee_rule_missing
          names the unit and the invoice, nothing written
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
          refuses a card paying a required invoice: card_fee_rule_missing names
          the unit and the invoice, nothing written
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js
        assertion: it charges no fee on a check paying a required invoice
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
          charges no fee on a check paying a required invoice
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js
        assertion: >-
          it charges no fee on an electronic check unless the unit’s rule
          charges them, then the same fee as a card
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
          charges no fee on an electronic check unless the unit’s rule charges
          them, then the same fee as a card
    binding_review: []
  - id: ATS-ACC-TRX-009-10
    title: Failed tender compensates its fee document
    level: api
    proves:
      - BR-CAP-ACC-TRX-009-09
    preconditions: A required-fee invoice uses a declining card.
    steps:
      - do: Submit settlement.
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
          fails the settlement and voids the fee invoice it had issued, the
          invoice left owing
    expected: Failure voids the fee invoice and preserves the original outstanding debt.
    negative: true
    data_needs: A definite-decline script.
    bound_to:
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
        fails the settlement and voids the fee invoice it had issued, the
        invoice left owing
      - TST-ACC-TRX-122
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
      fails the settlement and voids the fee invoice it had issued, the invoice
      left owing
    category: failure
    test_bindings:
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js
        assertion: >-
          it fails the settlement and voids the fee invoice it had issued, the
          invoice left owing
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
          fails the settlement and voids the fee invoice it had issued, the
          invoice left owing
    binding_review: []
  - id: ATS-ACC-TRX-009-11
    title: Scheduled work resolves or abandons pending settlement
    level: api
    proves:
      - BR-CAP-ACC-TRX-009-10
    preconditions: One request has a lost capture answer and another never starts payment.
    steps:
      - do: Sweep for recovery and again after a day.
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          is failed abandoned by the sweeper a day later, the reservation
          released
    expected: >-
      Recovered payment completes its settlement; absent payment fails and
      releases reserved credit.
    negative: false
    data_needs: A controllable scheduler clock.
    bound_to:
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
        leaves a lost answer pending with its intent, and the sweeper completes
        it: the payment recorded, the credit applied (FC-22)
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
        is failed abandoned by the sweeper a day later, the reservation released
      - TST-ACC-TRX-126
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      is failed abandoned by the sweeper a day later, the reservation released
    category: transition
    test_bindings:
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js
        assertion: >-
          it leaves a lost answer pending with its intent, and the sweeper
          completes it: the payment recorded, the credit applied (FC-22)
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          leaves a lost answer pending with its intent, and the sweeper
          completes it: the payment recorded, the credit applied (FC-22)
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js
        assertion: >-
          it is failed abandoned by the sweeper a day later, the reservation
          released
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          is failed abandoned by the sweeper a day later, the reservation
          released
    binding_review: []
  - id: ATS-ACC-TRX-009-12
    title: Settlement recovery closes reservations and placement together
    category: interaction
    level: api
    proves:
      - BR-CAP-ACC-TRX-009-03
      - BR-CAP-ACC-TRX-009-04
      - BR-CAP-ACC-TRX-009-10
      - BR-CAP-ACC-TRX-009-11
      - BR-CAP-ACC-TRX-007-03
      - BR-CAP-ACC-TRX-007-06
      - BR-CAP-ACC-TRX-008-04
      - BR-CAP-ACC-TRX-011-03
      - BR-CAP-ACC-TRX-011-04
      - BR-CAP-ACC-TRX-012-09
      - BR-CAP-ACC-TRX-013-06
    exercises:
      - CAP-ACC-TRX-009
      - CAP-ACC-TRX-007
      - CAP-ACC-TRX-008
      - CAP-ACC-TRX-011
      - CAP-ACC-TRX-012
      - CAP-ACC-TRX-013
    preconditions: >-
      An isolated workspace has eligible customers, products, matching accounts,
      an open period and two open batches. Each branch owns separate financial
      records.
    steps:
      - do: >-
          Reserve 20.00 credit for an 80.00 bill and start a 60.00 card tender
          with a lost answer. Inspect the pending application, recover the
          capture and read invoice, credit and receipt balances. Repeat the
          settlement key. After recovery, request a processor refund and inspect
          its held money; in a separate uncertain-void branch retain the
          processing reversal until a definite lookup arrives.
        provenance: proposed
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          applies the open credit’s 500 first and takes a check of 8000 for the
          rest: completed with its payment;
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          refuses with the decline (processor_declined), the settlement failed
          with the code, the reservation released, nothing applied;
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          is failed abandoned by the sweeper a day later, the reservation
          released;
          services-accounting:modules/transactions/tests/integration/services/settlements/settlement-linkage.integration.spec.js#it
          names its settlement on the payment and on the intent it made;
          rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-007-resolve-lost-processor-answers-and-clear-bank-debits.md#WF-ACC-TRX-007;
          rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-008-settle-a-customer-s-invoices-with-credit-and-money.md#WF-ACC-TRX-008;
          rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-03;
          rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-04;
          rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-10;
          rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-11;
          rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-007-take-card-and-bank-payments-through-the-processor.md#BR-CAP-ACC-TRX-007-03;
          rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-007-take-card-and-bank-payments-through-the-processor.md#BR-CAP-ACC-TRX-007-06;
          rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-008-put-a-payment-s-money-on-the-right-invoices.md#BR-CAP-ACC-TRX-008-04;
          rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-011-give-a-customer-credit-and-apply-it.md#BR-CAP-ACC-TRX-011-03;
          rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-011-give-a-customer-credit-and-apply-it.md#BR-CAP-ACC-TRX-011-04;
          rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-012-pay-money-back-with-refunds.md#BR-CAP-ACC-TRX-012-09;
          rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-013-undo-a-payment-whose-money-did-not-stay.md#BR-CAP-ACC-TRX-013-06
    expected: >-
      Pending credit becomes applied once; the recovered receipt pays the
      remaining 60.00; the invoice is paid and the credit and receipt retain
      their settlement links without another charge.
    negative: false
    data_needs: >-
      Separate command keys, two customers, invoice lines, receipts and credit;
      controlled processor outcomes and a fixed calendar where the branch
      requires them.
    bound_to: []
    provenance: proposed
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      applies the open credit’s 500 first and takes a check of 8000 for the
      rest: completed with its payment;
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      refuses with the decline (processor_declined), the settlement failed with
      the code, the reservation released, nothing applied;
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      is failed abandoned by the sweeper a day later, the reservation released;
      services-accounting:modules/transactions/tests/integration/services/settlements/settlement-linkage.integration.spec.js#it
      names its settlement on the payment and on the intent it made;
      rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-007-resolve-lost-processor-answers-and-clear-bank-debits.md#WF-ACC-TRX-007;
      rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-008-settle-a-customer-s-invoices-with-credit-and-money.md#WF-ACC-TRX-008;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-03;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-04;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-10;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-11;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-007-take-card-and-bank-payments-through-the-processor.md#BR-CAP-ACC-TRX-007-03;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-007-take-card-and-bank-payments-through-the-processor.md#BR-CAP-ACC-TRX-007-06;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-008-put-a-payment-s-money-on-the-right-invoices.md#BR-CAP-ACC-TRX-008-04;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-011-give-a-customer-credit-and-apply-it.md#BR-CAP-ACC-TRX-011-03;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-011-give-a-customer-credit-and-apply-it.md#BR-CAP-ACC-TRX-011-04;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-012-pay-money-back-with-refunds.md#BR-CAP-ACC-TRX-012-09;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-013-undo-a-payment-whose-money-did-not-stay.md#BR-CAP-ACC-TRX-013-06
    test_bindings: []
    binding_review: []
  - id: ATS-ACC-TRX-009-13
    title: Pending settlement retains its credit until recovery
    category: invariant
    level: api
    proves:
      - BR-CAP-ACC-TRX-009-04
      - INV-DOM-ACC-TRX-004-03
    preconditions: >-
      A 100.00 invoice can use 3.00 credit and a 97.03 card payment whose
      capture answer is lost.
    steps:
      - do: >-
          Start settlement and inspect the credit while pending; advance the
          recovery clock and inspect the completed records.
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          leaves a lost answer pending with its intent, and the sweeper
          completes it: the payment recorded, the credit applied (FC-22)
    expected: >-
      Pending credit holds 3.00 with zero available; after recovery it has 3.00
      applied and zero reserved. The receipt allocates 97.00 and retains 0.03.
    negative: false
    data_needs: >-
      Branch-owned records in one configured workspace, valid accounting context
      and controlled requests at the stated boundary.
    bound_to:
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
        leaves a lost answer pending with its intent, and the sweeper completes
        it: the payment recorded, the credit applied (FC-22)
      - TST-ACC-TRX-126
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      leaves a lost answer pending with its intent, and the sweeper completes
      it: the payment recorded, the credit applied (FC-22)
    test_bindings:
      - file: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js
        assertion: >-
          it leaves a lost answer pending with its intent, and the sweeper
          completes it: the payment recorded, the credit applied (FC-22)
        provenance: test
        source: >-
          services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
          leaves a lost answer pending with its intent, and the sweeper
          completes it: the payment recorded, the credit applied (FC-22)
    binding_review: []
evidence:
  - >-
    services-accounting at f47cb263875bbc0c5640fba7dae6785ec32695f8: the test
    files named in bound_to.
  - >-
    react-console at baf6dae382d6f41dce976c7f848667ccc37e076f: the Playwright
    journeys ACT-ACC-0301, 0317.
  - >-
    rhythm-v2-docs:specs/accounting/transactions/design: related workflows,
    domain invariants and state transitions examined for the back-fill.
coverage:
  rule: covered
  transition: 'gap: FND-ACC-TRX-074'
  validation: covered
  permission: covered
  edge: covered
  failure: covered
  boundary: covered
  concurrency: 'gap: FND-ACC-TRX-074'
  invariant: covered
  interaction: covered
coverage_notes:
  concurrency: >-
    No dedicated concurrency scenario covers the applicable conditions; the
    finding identifies the remaining specification work.
  transition: >-
    Selected transition scenarios exist, but the listed state paths still need
    explicit guard, effect and actor mappings.
interaction_coverage:
  - to: CAP-ACC-TRX-007
    scenarios:
      - ATS-ACC-TRX-009-12
    provenance: proposed
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      applies the open credit’s 500 first and takes a check of 8000 for the
      rest: completed with its payment;
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      refuses with the decline (processor_declined), the settlement failed with
      the code, the reservation released, nothing applied;
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      is failed abandoned by the sweeper a day later, the reservation released;
      services-accounting:modules/transactions/tests/integration/services/settlements/settlement-linkage.integration.spec.js#it
      names its settlement on the payment and on the intent it made;
      rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-007-resolve-lost-processor-answers-and-clear-bank-debits.md#WF-ACC-TRX-007;
      rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-008-settle-a-customer-s-invoices-with-credit-and-money.md#WF-ACC-TRX-008;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-03;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-04;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-10;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-11;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-007-take-card-and-bank-payments-through-the-processor.md#BR-CAP-ACC-TRX-007-03;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-007-take-card-and-bank-payments-through-the-processor.md#BR-CAP-ACC-TRX-007-06;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-008-put-a-payment-s-money-on-the-right-invoices.md#BR-CAP-ACC-TRX-008-04;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-011-give-a-customer-credit-and-apply-it.md#BR-CAP-ACC-TRX-011-03;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-011-give-a-customer-credit-and-apply-it.md#BR-CAP-ACC-TRX-011-04;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-012-pay-money-back-with-refunds.md#BR-CAP-ACC-TRX-012-09;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-013-undo-a-payment-whose-money-did-not-stay.md#BR-CAP-ACC-TRX-013-06
  - to: CAP-ACC-TRX-008
    scenarios:
      - ATS-ACC-TRX-009-12
    provenance: proposed
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      applies the open credit’s 500 first and takes a check of 8000 for the
      rest: completed with its payment;
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      refuses with the decline (processor_declined), the settlement failed with
      the code, the reservation released, nothing applied;
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      is failed abandoned by the sweeper a day later, the reservation released;
      services-accounting:modules/transactions/tests/integration/services/settlements/settlement-linkage.integration.spec.js#it
      names its settlement on the payment and on the intent it made;
      rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-007-resolve-lost-processor-answers-and-clear-bank-debits.md#WF-ACC-TRX-007;
      rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-008-settle-a-customer-s-invoices-with-credit-and-money.md#WF-ACC-TRX-008;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-03;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-04;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-10;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-11;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-007-take-card-and-bank-payments-through-the-processor.md#BR-CAP-ACC-TRX-007-03;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-007-take-card-and-bank-payments-through-the-processor.md#BR-CAP-ACC-TRX-007-06;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-008-put-a-payment-s-money-on-the-right-invoices.md#BR-CAP-ACC-TRX-008-04;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-011-give-a-customer-credit-and-apply-it.md#BR-CAP-ACC-TRX-011-03;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-011-give-a-customer-credit-and-apply-it.md#BR-CAP-ACC-TRX-011-04;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-012-pay-money-back-with-refunds.md#BR-CAP-ACC-TRX-012-09;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-013-undo-a-payment-whose-money-did-not-stay.md#BR-CAP-ACC-TRX-013-06
  - to: CAP-ACC-TRX-011
    scenarios:
      - ATS-ACC-TRX-009-12
    provenance: proposed
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      applies the open credit’s 500 first and takes a check of 8000 for the
      rest: completed with its payment;
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      refuses with the decline (processor_declined), the settlement failed with
      the code, the reservation released, nothing applied;
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      is failed abandoned by the sweeper a day later, the reservation released;
      services-accounting:modules/transactions/tests/integration/services/settlements/settlement-linkage.integration.spec.js#it
      names its settlement on the payment and on the intent it made;
      rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-007-resolve-lost-processor-answers-and-clear-bank-debits.md#WF-ACC-TRX-007;
      rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-008-settle-a-customer-s-invoices-with-credit-and-money.md#WF-ACC-TRX-008;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-03;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-04;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-10;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-11;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-007-take-card-and-bank-payments-through-the-processor.md#BR-CAP-ACC-TRX-007-03;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-007-take-card-and-bank-payments-through-the-processor.md#BR-CAP-ACC-TRX-007-06;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-008-put-a-payment-s-money-on-the-right-invoices.md#BR-CAP-ACC-TRX-008-04;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-011-give-a-customer-credit-and-apply-it.md#BR-CAP-ACC-TRX-011-03;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-011-give-a-customer-credit-and-apply-it.md#BR-CAP-ACC-TRX-011-04;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-012-pay-money-back-with-refunds.md#BR-CAP-ACC-TRX-012-09;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-013-undo-a-payment-whose-money-did-not-stay.md#BR-CAP-ACC-TRX-013-06
  - to: CAP-ACC-TRX-012
    scenarios:
      - ATS-ACC-TRX-009-12
    provenance: proposed
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      applies the open credit’s 500 first and takes a check of 8000 for the
      rest: completed with its payment;
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      refuses with the decline (processor_declined), the settlement failed with
      the code, the reservation released, nothing applied;
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      is failed abandoned by the sweeper a day later, the reservation released;
      services-accounting:modules/transactions/tests/integration/services/settlements/settlement-linkage.integration.spec.js#it
      names its settlement on the payment and on the intent it made;
      rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-007-resolve-lost-processor-answers-and-clear-bank-debits.md#WF-ACC-TRX-007;
      rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-008-settle-a-customer-s-invoices-with-credit-and-money.md#WF-ACC-TRX-008;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-03;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-04;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-10;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-11;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-007-take-card-and-bank-payments-through-the-processor.md#BR-CAP-ACC-TRX-007-03;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-007-take-card-and-bank-payments-through-the-processor.md#BR-CAP-ACC-TRX-007-06;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-008-put-a-payment-s-money-on-the-right-invoices.md#BR-CAP-ACC-TRX-008-04;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-011-give-a-customer-credit-and-apply-it.md#BR-CAP-ACC-TRX-011-03;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-011-give-a-customer-credit-and-apply-it.md#BR-CAP-ACC-TRX-011-04;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-012-pay-money-back-with-refunds.md#BR-CAP-ACC-TRX-012-09;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-013-undo-a-payment-whose-money-did-not-stay.md#BR-CAP-ACC-TRX-013-06
  - to: CAP-ACC-TRX-013
    scenarios:
      - ATS-ACC-TRX-009-12
    provenance: proposed
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      applies the open credit’s 500 first and takes a check of 8000 for the
      rest: completed with its payment;
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      refuses with the decline (processor_declined), the settlement failed with
      the code, the reservation released, nothing applied;
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      is failed abandoned by the sweeper a day later, the reservation released;
      services-accounting:modules/transactions/tests/integration/services/settlements/settlement-linkage.integration.spec.js#it
      names its settlement on the payment and on the intent it made;
      rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-007-resolve-lost-processor-answers-and-clear-bank-debits.md#WF-ACC-TRX-007;
      rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-008-settle-a-customer-s-invoices-with-credit-and-money.md#WF-ACC-TRX-008;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-03;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-04;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-10;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#BR-CAP-ACC-TRX-009-11;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-007-take-card-and-bank-payments-through-the-processor.md#BR-CAP-ACC-TRX-007-03;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-007-take-card-and-bank-payments-through-the-processor.md#BR-CAP-ACC-TRX-007-06;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-008-put-a-payment-s-money-on-the-right-invoices.md#BR-CAP-ACC-TRX-008-04;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-011-give-a-customer-credit-and-apply-it.md#BR-CAP-ACC-TRX-011-03;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-011-give-a-customer-credit-and-apply-it.md#BR-CAP-ACC-TRX-011-04;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-012-pay-money-back-with-refunds.md#BR-CAP-ACC-TRX-012-09;
      rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-013-undo-a-payment-whose-money-did-not-stay.md#BR-CAP-ACC-TRX-013-06
transition_coverage:
  - state_model: STATE-ACC-TRX-008
    transition: 1
    gap: FND-ACC-TRX-074
    provenance: unknown
    source: FND-ACC-TRX-074
    note: >-
      Existing scenarios establish selected paths; this exact guard, side-effect
      and actor combination still needs an explicit scenario mapping.
    evidence:
      - >-
        services-accounting:modules/transactions/services/settlements/settlement-commands.ts;
        services-accounting:modules/transactions/db/settlements.table.ts;
        services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
        applies the open credit’s 500 first and takes a check of 8000 for the
        rest: completed with its payment
  - state_model: STATE-ACC-TRX-008
    transition: 2
    gap: FND-ACC-TRX-074
    provenance: unknown
    source: FND-ACC-TRX-074
    note: >-
      Existing scenarios establish selected paths; this exact guard, side-effect
      and actor combination still needs an explicit scenario mapping.
    evidence:
      - >-
        services-accounting:modules/transactions/services/settlements/settlement-commands.ts;
        services-accounting:modules/transactions/db/settlements.table.ts;
        services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
        is failed abandoned by the sweeper a day later, the reservation released
  - state_model: STATE-ACC-TRX-008
    transition: 3
    gap: FND-ACC-TRX-074
    provenance: unknown
    source: FND-ACC-TRX-074
    note: >-
      Existing scenarios establish selected paths; this exact guard, side-effect
      and actor combination still needs an explicit scenario mapping.
    evidence:
      - >-
        services-accounting:modules/transactions/services/settlements/settlement-commands.ts;
        services-accounting:modules/transactions/db/settlements.table.ts;
        services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
        applies the open credit’s 500 first and takes a check of 8000 for the
        rest: completed with its payment
  - state_model: STATE-ACC-TRX-008
    transition: 4
    gap: FND-ACC-TRX-074
    provenance: unknown
    source: FND-ACC-TRX-074
    note: >-
      Existing scenarios establish selected paths; this exact guard, side-effect
      and actor combination still needs an explicit scenario mapping.
    evidence:
      - >-
        services-accounting:modules/transactions/services/settlements/settlement-commands.ts;
        services-accounting:modules/transactions/db/settlements.table.ts;
        services-accounting:modules/transactions/tests/integration/services/settlements/settlement-retry.integration.spec.js#it
        runs a new attempt under the key: a new settlement, completed with a
        payment, stored under the key with its attempt number
  - state_model: STATE-ACC-TRX-008
    transition: 5
    gap: FND-ACC-TRX-074
    provenance: unknown
    source: FND-ACC-TRX-074
    note: >-
      Existing scenarios establish selected paths; this exact guard, side-effect
      and actor combination still needs an explicit scenario mapping.
    evidence:
      - >-
        services-accounting:modules/transactions/services/settlements/settlement-commands.ts:completeSettlement
  - state_model: STATE-ACC-TRX-012
    transition: 1
    gap: FND-ACC-TRX-074
    provenance: unknown
    source: FND-ACC-TRX-074
    note: >-
      Existing scenarios establish selected paths; this exact guard, side-effect
      and actor combination still needs an explicit scenario mapping.
    evidence:
      - >-
        services-accounting:modules/transactions/services/credits/credit-commands.ts;
        services-accounting:modules/transactions/services/settlements/settlement-commands.ts;
        services-accounting:modules/transactions/db/credit-applications.table.ts;
        services-accounting:modules/transactions/tests/integration/services/credits/credits.integration.spec.js#it
        raises the line’s amount_paid: a line settled by store credit reads open
        until fully paid, then paid
  - state_model: STATE-ACC-TRX-012
    transition: 2
    gap: FND-ACC-TRX-074
    provenance: unknown
    source: FND-ACC-TRX-074
    note: >-
      Existing scenarios establish selected paths; this exact guard, side-effect
      and actor combination still needs an explicit scenario mapping.
    evidence:
      - >-
        services-accounting:modules/transactions/services/credits/credit-commands.ts;
        services-accounting:modules/transactions/services/settlements/settlement-commands.ts;
        services-accounting:modules/transactions/db/credit-applications.table.ts;
        services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
        refuses with the decline (processor_declined), the settlement failed
        with the code, the reservation released, nothing applied
  - state_model: STATE-ACC-TRX-012
    transition: 3
    gap: FND-ACC-TRX-074
    provenance: unknown
    source: FND-ACC-TRX-074
    note: >-
      Existing scenarios establish selected paths; this exact guard, side-effect
      and actor combination still needs an explicit scenario mapping.
    evidence:
      - >-
        services-accounting:modules/transactions/services/credits/credit-commands.ts;
        services-accounting:modules/transactions/services/settlements/settlement-commands.ts;
        services-accounting:modules/transactions/db/credit-applications.table.ts;
        services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
        applies the open credit’s 500 first and takes a check of 8000 for the
        rest: completed with its payment
  - state_model: STATE-ACC-TRX-012
    transition: 4
    gap: FND-ACC-TRX-074
    provenance: unknown
    source: FND-ACC-TRX-074
    note: >-
      Existing scenarios establish selected paths; this exact guard, side-effect
      and actor combination still needs an explicit scenario mapping.
    evidence:
      - >-
        services-accounting:modules/transactions/services/credits/credit-commands.ts;
        services-accounting:modules/transactions/services/settlements/settlement-commands.ts;
        services-accounting:modules/transactions/db/credit-applications.table.ts;
        services-accounting:modules/transactions/tests/integration/services/settlements/settlement-retry.integration.spec.js#it
        runs a new attempt under the key: a new settlement, completed with a
        payment, stored under the key with its attempt number
  - state_model: STATE-ACC-TRX-012
    transition: 5
    gap: FND-ACC-TRX-074
    provenance: unknown
    source: FND-ACC-TRX-074
    note: >-
      Existing scenarios establish selected paths; this exact guard, side-effect
      and actor combination still needs an explicit scenario mapping.
    evidence:
      - >-
        services-accounting:modules/transactions/services/credits/credit-commands.ts;
        services-accounting:modules/transactions/services/settlements/settlement-commands.ts;
        services-accounting:modules/transactions/db/credit-applications.table.ts;
        services-accounting:modules/transactions/tests/integration/services/credits/credits.integration.spec.js#it
        marks the first reversed and gives the money back to the credit, which
        is open again
permission_coverage:
  - key: accounting.settlements.create
    where_checked: api
    gap: FND-ACC-TRX-074
    provenance: unknown
    source: FND-ACC-TRX-074
    note: >-
      Existing permission scenarios are retained; assertion-level coverage of
      this grant at every declared surface remains unverified.
    evidence:
      - >-
        rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#CAP-ACC-TRX-009
  - key: accounting.settlements.read
    where_checked: api
    gap: FND-ACC-TRX-074
    provenance: unknown
    source: FND-ACC-TRX-074
    note: >-
      Existing permission scenarios are retained; assertion-level coverage of
      this grant at every declared surface remains unverified.
    evidence:
      - >-
        rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#CAP-ACC-TRX-009
  - key: accounting.payments.create
    where_checked: api
    gap: FND-ACC-TRX-074
    provenance: unknown
    source: FND-ACC-TRX-074
    note: >-
      Existing permission scenarios are retained; assertion-level coverage of
      this grant at every declared surface remains unverified.
    evidence:
      - >-
        rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#CAP-ACC-TRX-009
  - key: accounting.credit-applications.create
    where_checked: api
    gap: FND-ACC-TRX-074
    provenance: unknown
    source: FND-ACC-TRX-074
    note: >-
      Existing permission scenarios are retained; assertion-level coverage of
      this grant at every declared surface remains unverified.
    evidence:
      - >-
        rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-009-settle-a-customer-s-invoices-in-one-step.md#CAP-ACC-TRX-009
rule_coverage:
  - rule: BR-CAP-ACC-TRX-009-01
    scenarios:
      - ATS-ACC-TRX-009-01
    provenance: proposed
    source: >-
      services-accounting:modules/transactions/tests/e2e/settlements.e2e.spec.js#it
      is refused the settle route as a reader and the settlement read as an
      outsider (403)
  - rule: BR-CAP-ACC-TRX-009-02
    scenarios:
      - ATS-ACC-TRX-009-02
      - ATS-ACC-TRX-009-03
    provenance: proposed
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      refuses settling an invoice that owes nothing (nothing_to_allocate)
  - rule: BR-CAP-ACC-TRX-009-03
    scenarios:
      - ATS-ACC-TRX-009-04
      - ATS-ACC-TRX-009-12
    provenance: proposed
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      applies the open credit’s 500 first and takes a check of 8000 for the
      rest: completed with its payment
  - rule: BR-CAP-ACC-TRX-009-04
    scenarios:
      - ATS-ACC-TRX-009-05
      - ATS-ACC-TRX-009-12
    provenance: proposed
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      refuses with the decline (processor_declined), the settlement failed with
      the code, the reservation released, nothing applied
  - rule: BR-CAP-ACC-TRX-009-05
    scenarios:
      - ATS-ACC-TRX-009-06
    provenance: proposed
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlement-unapplied.integration.spec.js#it
      leaves the check’s whole 5000 unapplied and says so plainly in the answer
  - rule: BR-CAP-ACC-TRX-009-06
    scenarios:
      - ATS-ACC-TRX-009-07
    provenance: proposed
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      completes with an overpayment credit of 1000 made from the payment, the
      payment’s unapplied money gone into it
  - rule: BR-CAP-ACC-TRX-009-07
    scenarios:
      - ATS-ACC-TRX-009-08
    provenance: proposed
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
      shares one fee over two required invoices in proportion, the fixed amount
      charged once: 20000 at 2.5% + 30 is 530
  - rule: BR-CAP-ACC-TRX-009-08
    scenarios:
      - ATS-ACC-TRX-009-09
    provenance: proposed
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it
      refuses the settlement with card_fee_required naming the invoice, and
      writes nothing
  - rule: BR-CAP-ACC-TRX-009-09
    scenarios:
      - ATS-ACC-TRX-009-05
      - ATS-ACC-TRX-009-10
    provenance: proposed
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlement-retry.integration.spec.js#it
      runs a new attempt under the key: a new settlement, completed with a
      payment, stored under the key with its attempt number
  - rule: BR-CAP-ACC-TRX-009-10
    scenarios:
      - ATS-ACC-TRX-009-11
      - ATS-ACC-TRX-009-12
    provenance: proposed
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      is failed abandoned by the sweeper a day later, the reservation released
executable_gaps:
  - scenario: ATS-ACC-TRX-009-03
    gap: FND-ACC-TRX-074
    provenance: unknown
    source: FND-ACC-TRX-074
    evidence:
      - 'services-accounting:docs/accounting/settlements.md#Refusals'
  - scenario: ATS-ACC-TRX-009-12
    gap: FND-ACC-TRX-074
    provenance: unknown
    source: FND-ACC-TRX-074
    evidence:
      - >-
        services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
        applies the open credit’s 500 first and takes a check of 8000 for the
        rest: completed with its payment;
        services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
        refuses with the decline (processor_declined), the settlement failed
        with the code, the reservation released, nothing applied;
        services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
        is failed abandoned by the sweeper a day later, the reservation
        released;
        services-accounting:modules/transactions/tests/integration/services/settlements/settlement-linkage.integration.spec.js#it
        names its settlement on the payment and on the intent it made;
        rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-007-resolve-lost-processor-answers-and-clear-bank-debits.md#WF-ACC-TRX-007;
        rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-008-settle-a-customer-s-invoices-with-credit-and-money.md#WF-ACC-TRX-008
invariant_coverage:
  - invariant: INV-DOM-ACC-TRX-003-16
    scenarios:
      - ATS-ACC-TRX-009-05
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it
      refuses with the decline (processor_declined), the settlement failed with
      the code, the reservation released, nothing applied
    note: >-
      The cited scenario and its constituent test assertions are the proof
      boundary.
---

# Complete invoice settlement with credit and money: Capability Test Specification

## Coverage

The category map separates specified examples from recorded gaps. The table lists a scenario or finding for each rule requiring proof; a listed scenario may still be proposed. Executable bindings cover their cited assertions, while the transition, permission and invariant registers identify combinations that need further proof.

| Required rule | Scenario or finding |
|---|---|
| `BR-CAP-ACC-TRX-009-01` | `ATS-ACC-TRX-009-01` |
| `BR-CAP-ACC-TRX-009-02` | `ATS-ACC-TRX-009-02`, `ATS-ACC-TRX-009-03` |
| `BR-CAP-ACC-TRX-009-03` | `ATS-ACC-TRX-009-04`, `ATS-ACC-TRX-009-12` |
| `BR-CAP-ACC-TRX-009-04` | `ATS-ACC-TRX-009-05`, `ATS-ACC-TRX-009-12`, `ATS-ACC-TRX-009-13` |
| `BR-CAP-ACC-TRX-009-05` | `ATS-ACC-TRX-009-06` |
| `BR-CAP-ACC-TRX-009-06` | `ATS-ACC-TRX-009-07` |
| `BR-CAP-ACC-TRX-009-07` | `ATS-ACC-TRX-009-08` |
| `BR-CAP-ACC-TRX-009-08` | `ATS-ACC-TRX-009-09` |
| `BR-CAP-ACC-TRX-009-09` | `ATS-ACC-TRX-009-05`, `ATS-ACC-TRX-009-10` |
| `BR-CAP-ACC-TRX-009-10` | `ATS-ACC-TRX-009-11`, `ATS-ACC-TRX-009-12` |

## Interactions With Related Capabilities

Reserve 20.00 credit for an 80.00 bill and start a 60.00 card tender with a lost answer. Inspect the pending application, recover the capture and read invoice, credit and receipt balances. Repeat the settlement key. After recovery, request a processor refund and inspect its held money; in a separate uncertain-void branch retain the processing reversal until a definite lookup arrives.

Pending credit becomes applied once; the recovered receipt pays the remaining 60.00; the invoice is paid and the credit and receipt retain their settlement links without another charge. The complete chain remains proposed until one executable run proves its combined outcomes.
