Skip to content

ATS-ACC-TRX-009Complete invoice settlement with credit and money: Capability Test Specification

Markdown

ATS-ACC-TRX-009

Complete invoice settlement with credit and money: Capability Test Specification

Markdown
  • DocumentProposed

KindAcceptance test setProduct areaAccountingModuleTransactionsRevision1

Read atservices-accounting f47cb263react-console baf6dae3

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

Test Scenarios

13 scenarios proving CAP-ACC-TRX-009; 11 bound to an existing test.

01 Settlement access requires the combined authoritiespermissionapinegativetest
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.
Data
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)
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)
02 Empty debt cannot start settlementvalidationapinegativetest
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.
Data
A paid invoice.
Bound to
Source
services-accounting:modules/transactions/tests/integration/services/settlements/settlements.integration.spec.js#it refuses settling an invoice that owes nothing (nothing_to_allocate)
03 Settlement retains customer boundariesboundaryapinegativeproposed
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.
Data
Two customers with incompatible resources.
Source
services-accounting:docs/accounting/settlements.md#Refusals
04 Credit precedes the remainder tenderinteractionapitest
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.
Data
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
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
05 Definite failure releases value for retryfailureapitest
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.
Data
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
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
06 Credit-only settlement explains extra moneyedgeapitest
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.
Data
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
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
07 Overpayment treatment is explicitboundaryapitest
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.
Data
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
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
08 One fee follows eligible card valueruleapitest
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.
Data
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 computes the fee on the 4000 tendered (130), charges 4130, and leaves the invoice owing 6000
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
09 Required fees block incompatible tendersvalidationapinegativetest
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.
Data
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 an electronic check unless the unit’s rule charges them, then the same fee as a card
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
10 Failed tender compensates its fee documentfailureapinegativetest
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.
Data
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
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
11 Scheduled work resolves or abandons pending settlementtransitionapitest
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.
Data
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
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
12 Settlement recovery closes reservations and placement togetherinteractionapiproposed
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
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.
Data
Separate command keys, two customers, invoice lines, receipts and credit; controlled processor outcomes and a fixed calendar where the branch requires them.
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
13 Pending settlement retains its credit until recoveryinvariantapitest
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.
Data
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)
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)

The Markdown files under specs/ in rhythmsoftware/rhythm-v2-docs are the canonical source of truth. This reader is a generated, read-only projection of them.