Skip to content

ATS-ACC-TRX-012Return customer money with accountable refunds: Capability Test Specification

Markdown

ATS-ACC-TRX-012

Return customer money with accountable refunds: Capability Test Specification

Markdown
  • DocumentProposed

KindAcceptance test setProduct areaAccountingModuleTransactionsRevision2

Read atservices-accounting f47cb263react-console baf6dae3

Coverage

  • Rule covered
  • Transition gap: FND-ACC-TRX-077
  • Validation covered
  • Permission covered
  • Edge covered
  • Failure covered
  • Boundary covered
  • Concurrency covered
  • Invariant gap: FND-ACC-TRX-077
  • Interaction covered

Test Scenarios

12 scenarios proving CAP-ACC-TRX-012; 11 bound to an existing test.

01 Refund requests cannot exceed their sourcevalidationapinegativetest
Proves
BR-CAP-ACC-TRX-012-01
Preconditions
Receipt money, line allocation and credit are available.
Steps
[ { "do": "Ask above each source and submit a value-free request.", "provenance": "test", "source": "services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it refuses more than an allocation holds (over_refund) and more than the unapplied money (over_refund)" } ]
Expected
Each invalid request fails.
Data
Refundable source variants.
Bound to
services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it refuses more than an allocation holds (over_refund) and more than the unapplied money (over_refund)
services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it refuses a credit refund beyond the balance (over_refund) and one through a processor the credit did not come from (cash_account_mismatch)
Source
services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it refuses more than an allocation holds (over_refund) and more than the unapplied money (over_refund)
02 Requested value cannot be spent a second timeconcurrencyapitest
Proves
BR-CAP-ACC-TRX-012-02 INV-DOM-ACC-TRX-003-13
Preconditions
A receipt holds 50.00 available.
Steps
[ { "do": "Reserve 40.00, attempt reuse through allocation, credit and refund, cancel, then execute a fresh request.", "provenance": "test", "source": "services-accounting:modules/transactions/tests/integration/services/refunds/refund-reservation.integration.spec.js#it refuses allocating the reserved money (over_application) but allocates money beyond it" } ]
Expected
Reserved value stays unavailable while excess remains usable; cancellation releases it and execution records return.
Data
A payment with unapplied value.
Bound to
services-accounting:modules/transactions/tests/integration/services/refunds/refund-reservation.integration.spec.js#it refuses allocating the reserved money (over_application) but allocates money beyond it
services-accounting:modules/transactions/tests/integration/services/refunds/refund-reservation.integration.spec.js#it refuses a credit of the reserved money, and a second refund of it (over_refund)
services-accounting:modules/transactions/tests/integration/services/refunds/refund-reservation.integration.spec.js#it turns the reservation into the refunded amount when the refund is paid offline
Source
services-accounting:modules/transactions/tests/integration/services/refunds/refund-reservation.integration.spec.js#it refuses allocating the reserved money (over_application) but allocates money beyond it
03 Processor return precedes offline fallbackboundaryapitest
Proves
BR-CAP-ACC-TRX-012-03
Preconditions
A card receipt holds available money.
Steps
[ { "do": "Request a check return, request card return, then retry offline after processor decline.", "provenance": "test", "source": "services-accounting:modules/transactions/tests/integration/services/refunds/refund-card-original-method.integration.spec.js#it refuses a check refund of the card’s unapplied money, saying the money goes back to the card" } ]
Expected
Initial offline choice fails, card request succeeds and definite processor failure permits fallback.
Data
A processor-declined refund response.
Bound to
services-accounting:modules/transactions/tests/integration/services/refunds/refund-card-original-method.integration.spec.js#it refuses a check refund of the card’s unapplied money, saying the money goes back to the card
Source
services-accounting:modules/transactions/tests/integration/services/refunds/refund-card-original-method.integration.spec.js#it refuses a check refund of the card’s unapplied money, saying the money goes back to the card
04 Line return distinguishes credit from reopened debtinteractionapitest
Proves
BR-CAP-ACC-TRX-012-04
Preconditions
A check paid 50.00 on one line.
Steps
[ { "do": "Return 30.00, crediting 20.00 and reopening 10.00.", "provenance": "test", "source": "services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it keeps the invoice settled for the credited 2000 (a credit memo line) and reopens the 1000: the line owes 1000" } ]
Expected
Opposite allocations release 30.00, the memo preserves 20.00 settlement and 10.00 becomes owed.
Data
An applied check receipt.
Bound to
services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it takes the money back from the allocation: a reversing row per refund, the original reversed by 3000
services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it keeps the invoice settled for the credited 2000 (a credit memo line) and reopens the 1000: the line owes 1000
Source
services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it keeps the invoice settled for the credited 2000 (a credit memo line) and reopens the 1000: the line owes 1000
05 Another person approves before paymentpermissionapitest
Proves
BR-CAP-ACC-TRX-012-05 INV-DOM-ACC-TRX-003-14
Preconditions
Workspace approval is enabled.
Steps
[ { "do": "Request, execute early, self-approve, approve independently and execute.", "provenance": "test", "source": "services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it requests it pending_approval, refusing to execute it (refund_not_requested) or to let the requester approve it (self_approval)" } ]
Expected
The flow waits, rejects early and self actions, then allows the approved payment.
Data
Requester and independent approver.
Bound to
services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it requests it pending_approval, refusing to execute it (refund_not_requested) or to let the requester approve it (self_approval)
services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it is approved by another person (requested, approved_by_id theirs), then executed
Source
services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it requests it pending_approval, refusing to execute it (refund_not_requested) or to let the requester approve it (self_approval)
06 Completed return is finaltransitionapitest
Proves
BR-CAP-ACC-TRX-012-06 INV-DOM-ACC-TRX-003-15
Preconditions
One refund is paid and another merely requested.
Steps
[ { "do": "Re-execute and cancel the paid record, then cancel the pending request with a reason.", "provenance": "test", "source": "services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it refuses executing it again (refund_not_requested) and cancelling it (refund_not_cancellable)" } ]
Expected
Completed record rejects change and pending cancellation moves no money.
Data
Refunds at different lifecycle points.
Bound to
services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it refuses executing it again (refund_not_requested) and cancelling it (refund_not_cancellable)
Source
services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it refuses executing it again (refund_not_requested) and cancelling it (refund_not_cancellable)
07 Offline return updates receipt standingtransitionapitest
Proves
BR-CAP-ACC-TRX-012-07
Preconditions
A check holds 50.00.
Steps
[ { "do": "Request and execute a 10.00 check refund.", "provenance": "test", "source": "services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it records it offline: executed, the payment partially_refunded with 1000 refunded (FC-11, FC-14)" } ]
Expected
Offline completion retains its events and makes the payment partly refunded.
Data
Available check money.
Bound to
services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it records it offline: executed, the payment partially_refunded with 1000 refunded (FC-11, FC-14)
Source
services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it records it offline: executed, the payment partially_refunded with 1000 refunded (FC-11, FC-14)
08 Definite processor failure restores local positionfailureapinegativetest
Proves
BR-CAP-ACC-TRX-012-08
Preconditions
A card allocation supplies refundable value.
Steps
[ { "do": "Execute a declined line return and a timeout known to precede sending.", "provenance": "test", "source": "services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it leaves the payment as it was: nothing unapplied, refunded or pending, its facts unchanged" } ]
Expected
Both fail with restored applications and released reserved value.
Data
Definite-decline and unsent-timeout scripts.
Bound to
services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it leaves the invoice lines as they were: nothing owed again, no credit memo kept
services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it leaves the payment as it was: nothing unapplied, refunded or pending, its facts unchanged
services-accounting:modules/transactions/tests/integration/services/refunds/refund-timeout-before-send.integration.spec.js#it is failed processor_unavailable at once, the pending money released, nothing refunded
Source
services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it leaves the payment as it was: nothing unapplied, refunded or pending, its facts unchanged
09 Uncertain refund waits for a definite outcomeedgeapitest
Proves
BR-CAP-ACC-TRX-012-09
Preconditions
One answer is lost and another reports pending.
Steps
[ { "do": "Sweep beyond a day and deliver repeated confirmation by processor reference.", "provenance": "test", "source": "services-accounting:modules/transactions/tests/integration/services/refunds/refund-timeout-before-send.integration.spec.js#it leaves the refund processing a day on, never failed as never received and never abandoned" } ]
Expected
Money remains held until one successful completion; neither abandonment nor duplicate execution occurs.
Data
Clock control and signed gateway events.
Bound to
services-accounting:modules/transactions/tests/integration/services/refunds/refund-timeout-before-send.integration.spec.js#it leaves the refund processing a day on, never failed as never received and never abandoned
services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it leaves a lost answer processing (refund_uncertain, the money pending) and the sweeper finishes it with one refund
services-accounting:modules/transactions/tests/integration/services/integrations/refund-confirmation-by-reference.integration.spec.js#it completes the processing refund and its pending reversal from an event naming only provider_ref, and a redelivery is ignored
Source
services-accounting:modules/transactions/tests/integration/services/refunds/refund-timeout-before-send.integration.spec.js#it leaves the refund processing a day on, never failed as never received and never abandoned
10 Return includes its processing-fee shareruleapitest
Proves
BR-CAP-ACC-TRX-012-11
Preconditions
The card paid 40.00 and the required associated fee.
Steps
[ { "do": "Refund 20.00 of billed value and reopen another 10.00.", "provenance": "test", "source": "services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it takes the fee’s share back with the line: 2000 of 4000 refunded is 2065, the fee invoice credited 65" } ]
Expected
The first returns 20.65 and credits 0.65 of fee; reopening also credits its fee share.
Data
A required fee rule.
Bound to
services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it takes the fee’s share back with the line: 2000 of 4000 refunded is 2065, the fee invoice credited 65
services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it credits the fee’s share even when the line is reopened: 1000 more is 1032, the fee invoice credited 97 in all, the line owing 1000
Source
services-accounting:modules/transactions/tests/integration/services/settlements/card-fees.integration.spec.js#it takes the fee’s share back with the line: 2000 of 4000 refunded is 2065, the fee invoice credited 65
11 Refund roles separate sensitive actionspermissionapinegativetest
Proves
BR-CAP-ACC-TRX-012-12
Preconditions
The caller has reader authority only.
Steps
[ { "do": "Attempt request, approval, execution and cancellation.", "provenance": "test", "source": "services-accounting:modules/transactions/tests/e2e/refunds.e2e.spec.js#it is refused approve without .approve, execute without .execute and cancel without .create, as a reader (403)" } ]
Expected
Each mutation denies access.
Data
A refund reader identity.
Bound to
services-accounting:modules/transactions/tests/e2e/refunds.e2e.spec.js#it is refused POST /refunds/{tenantId} without accounting.refunds.create (403)
services-accounting:modules/transactions/tests/e2e/refunds.e2e.spec.js#it is refused approve without .approve, execute without .execute and cancel without .create, as a reader (403)
Source
services-accounting:modules/transactions/tests/e2e/refunds.e2e.spec.js#it is refused approve without .approve, execute without .execute and cancel without .create, as a reader (403)
12 Returned money resolves the enclosing cancellationinteractionapiproposed
Proves
BR-CAP-ACC-TRX-012-02 BR-CAP-ACC-TRX-012-08 BR-CAP-ACC-TRX-012-09 BR-CAP-ACC-TRX-007-06 BR-CAP-ACC-TRX-013-06 BR-CAP-ACC-TRX-014-05 BR-CAP-ACC-TRX-014-07 BR-CAP-ACC-TRX-020-08 BR-CAP-ACC-TRX-003-04 BR-CAP-ACC-TRX-009-10 BR-CAP-ACC-TRX-011-03
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": "Cancel 40.00 of a card-paid bill with refund treatment, retain the processing return, deliver a success event twice and inspect the cancellation and source receipt. In separate branches use recovery lookup, a definite decline and processor void. Include an uncertain credit-and-card settlement in a separate branch and inspect its pending credit application before recovery.", "provenance": "proposed", "source": "services-accounting:modules/transactions/tests/integration/services/refunds/refund-reservation.integration.spec.js#it refuses allocating the reserved money (over_application) but allocates money beyond it; services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it leaves the payment as it was: nothing unapplied, refunded or pending, its facts unchanged; services-accounting:modules/transactions/tests/integration/services/refunds/refund-timeout-before-send.integration.spec.js#it leaves the refund processing a day on, never failed as never received and never abandoned; 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-009-request-approve-and-pay-a-refund.md#WF-ACC-TRX-009; rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-010-reverse-billing-in-one-operation.md#WF-ACC-TRX-010; rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-013-apply-payment-events-from-the-integration-platform.md#WF-ACC-TRX-013; rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-012-pay-money-back-with-refunds.md#BR-CAP-ACC-TRX-012-02; rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-012-pay-money-back-with-refunds.md#BR-CAP-ACC-TRX-012-08; 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-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-013-undo-a-payment-whose-money-did-not-stay.md#BR-CAP-ACC-TRX-013-06; rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-014-reverse-billing-in-one-operation.md#BR-CAP-ACC-TRX-014-05; rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-014-reverse-billing-in-one-operation.md#BR-CAP-ACC-TRX-014-07; rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-020-let-commerce-and-the-processor-work-with-accounting-safely.md#BR-CAP-ACC-TRX-020-08; rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-003-reduce-or-add-to-an-issued-invoice-with-credit-and-debit.md#BR-CAP-ACC-TRX-003-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-011-give-a-customer-credit-and-apply-it.md#BR-CAP-ACC-TRX-011-03" } ]
Expected
One confirmation completes the return and its cancellation; duplicate delivery changes nothing; decline restores held value and leaves a cancellation exception; recovery and void retain their distinct outcomes.
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/refunds/refund-reservation.integration.spec.js#it refuses allocating the reserved money (over_application) but allocates money beyond it; services-accounting:modules/transactions/tests/integration/services/refunds/refunds.integration.spec.js#it leaves the payment as it was: nothing unapplied, refunded or pending, its facts unchanged; services-accounting:modules/transactions/tests/integration/services/refunds/refund-timeout-before-send.integration.spec.js#it leaves the refund processing a day on, never failed as never received and never abandoned; 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-009-request-approve-and-pay-a-refund.md#WF-ACC-TRX-009; rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-010-reverse-billing-in-one-operation.md#WF-ACC-TRX-010; rhythm-v2-docs:specs/accounting/transactions/design/workflows/WF-ACC-TRX-013-apply-payment-events-from-the-integration-platform.md#WF-ACC-TRX-013; rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-012-pay-money-back-with-refunds.md#BR-CAP-ACC-TRX-012-02; rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-012-pay-money-back-with-refunds.md#BR-CAP-ACC-TRX-012-08; 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-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-013-undo-a-payment-whose-money-did-not-stay.md#BR-CAP-ACC-TRX-013-06; rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-014-reverse-billing-in-one-operation.md#BR-CAP-ACC-TRX-014-05; rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-014-reverse-billing-in-one-operation.md#BR-CAP-ACC-TRX-014-07; rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-020-let-commerce-and-the-processor-work-with-accounting-safely.md#BR-CAP-ACC-TRX-020-08; rhythm-v2-docs:specs/accounting/transactions/planning/capabilities/CAP-ACC-TRX-003-reduce-or-add-to-an-issued-invoice-with-credit-and-debit.md#BR-CAP-ACC-TRX-003-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-011-give-a-customer-credit-and-apply-it.md#BR-CAP-ACC-TRX-011-03

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.