Skip to content

CAP-ACC-TRX-012Return customer money with accountable refunds

Markdown

CAP-ACC-TRX-012

Return customer money with accountable refunds

Markdown
  • DocumentDraft
  • Product intentProposed
  • ImplementationPartially observed

KindCapabilityProduct areaAccountingModuleTransactionsRevision1

Read atservices-accounting f47cb263react-console baf6dae3

The Formal Contract

The narrative above explains; the sections below are authoritative — the rules, scenarios and tests this document binds.

Outcomes
Staff return eligible value while keeping its source, approval and outcome inspectable.Failed refunds restore the local position and uncertain ones continue holding money. Returning applied value either credits the original charge or reopens its debt according to the chosen treatment.
Surfaces
consoleapijob
Intent sources
services-accounting:docs/milestones/plans/ACCT-M2-plan.md#D6services-accounting:docs/milestones/plans/ACCT-M2-plan.md#D7services-accounting:docs/milestones/plans/ACCT-M2-plan.md#D8services-accounting:docs/architecture/accounting-2.0/02-decisions.md#M2-5services-accounting:docs/architecture/accounting-2.0/02-decisions.md#A-5

Controls

31 controls apply, from the corpus control catalogue.

TC-IAM-001 TC-IAM-002 TC-IAM-004 TC-IAM-005 TC-IAM-006 TC-AZ-001 TC-AZ-002 TC-AZ-003 TC-AZ-004 TC-AZ-006 TC-TEN-001 TC-TEN-002 TC-TEN-003 TC-TEN-004 TC-CRY-001 TC-DAT-001 TC-DAT-002 TC-DAT-003 TC-LOG-002 TC-LOG-003 TC-LOG-004 TC-LOG-005 TC-PI-001 TC-PI-003 TC-PI-005 TC-AI-005 TC-VEN-001 TC-VEN-002 TC-VEN-003 TC-PRV-001 TC-PRV-002

Permissions

KeyChecked atScope
accounting.refunds.createapitenant
accounting.refunds.readapitenant
accounting.refunds.approveapitenant
accounting.refunds.executeapitenant

Business Rules

13 rules, 11 to be proved before approval. A rule's product intent is derived from its origin: 0 confirmed by a product decision, the rest inheriting this capability's proposed.

IdRuleKindEnforced atProvenance
01must prove
Proposed
Refund requests identify positive refundable value and cannot exceed available unapplied money, remaining application value or credit balance.
validationservice, databasetest
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)
02must prove
Proposed
A request reserves its unapplied source money until success, cancellation or failure, preventing concurrent application, credit creation or another refund from using it.
invariantservice, databasetest
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
03must prove
Proposed
Processor money returns through its original merchant account unless the source lacks a processor reference or a processor refund has already been declined.
policyservicetest
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
04must prove
Proposed
Refunding an application removes its paid value; a default credit memo preserves settlement, while an explicit reopen choice restores the debt.
calculationservicetest
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
05must prove
Proposed
Where workspace approval is enabled, requests wait and only a different person can approve them.
permissionservicetest
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)
06must prove
Proposed
Execution requires requested status, cancellation requires an unpaid refund and a reason, and paid or cancelled refunds are final.
lifecycleservice, databasetest
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)
07must prove
Proposed
Offline execution moves money immediately and derives partially refunded or refunded payment status from the accumulated amount.
calculationservice, databasetest
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)
08must prove
Proposed
Processor refunds are recorded before the external call; definite rejection or nonreceipt fails the refund and restores applications and reservations.
lifecycleservicetest
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
09must prove
Proposed
Unknown or pending processor outcomes keep the refund processing with money held until confirmed by lookup, event or human resolution, without abandonment.
lifecycleservicetest
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
Proposed
Only check refunds can carry a check number.
validationservice, databasetest
11must prove
Proposed
Refunding card-paid value also returns its proportional processing fee rounded downward and credits the fee invoice.
calculationservicetest
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
12must prove
Proposed
Request and cancellation require create authority, approval and execution require their distinct sensitive authorities, and immediate execution requires both create and execute.
permissionapitest
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)
13
Proposed
The product should expose the workspace’s refund-approval setting in the console; only the service currently provides it.
policyconsoleunknown

Scenarios

IdGivenWhenThenProvenance
01A check overpayment is available and the member requests part back.Request a check refund and record its execution.Offline refund completion reduces available money and derives partially refunded payment standing.test
02A payment has allocations on two lines.Refund both, choosing credit treatment for one and reopening for the other.A memo maintains the first line’s settlement while the second regains its debt.test
03The requested card refund concerns an allocated invoice line.Execute a refund that the processor definitely declines.Failure leaves the source application and money at their original position.test

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.