Skip to content

CAP-COM-FUL-006Handle financial reversals after delivery

Markdown

CAP-COM-FUL-006

Handle financial reversals after delivery

Markdown
  • DocumentDraft
  • Product intentProposed
  • ImplementationObserved

KindCapabilityProduct areaCommerceModuleFulfillment, Shipping and InventoryRevision1

Read atservices-commerce c8b66a98

The Formal Contract

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

Outcomes
Reversal of a delivered purchase has a recorded response.Withdrawal of delivery follows the policy or an authorized human decision.
Surfaces
jobapi
Intent sources
services-commerce:docs/migrations/operations/README.md#Section 5 walkthrough (decisions E and F, Andrew 2026-10-18)

Controls

30 controls apply, from the corpus control catalogue.

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

Permissions

KeyChecked atScope
commerce.enforcements.readapitenant
commerce.enforcements.resolveapitenant

Business Rules

11 rules, 9 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
Payment reversal or refund, dispute or chargeback opening and invoice reopening affect only the identified lines' delivered or in-progress obligations, leaving waiting obligations untouched.
origin: D-P5-01 (build decision, not a product ruling): services-commerce:docs/migrations/operations/README.md#D-P5-01
no proof recorded yet
policyservicetest
services-commerce:modules/fulfillment/tests/integration/services/enforcement/enforcement-handler.integration.spec.js#creates four enforcements: three dispatched (suspend, cancel_line, notify), one for a person (review); the none policy and the pending obligation get nothing
02must prove
Proposed
The default review response records enforcement and raises a staff-review exception without instructing the delivering application.
origin: Decision E, Andrew 2026-10-18 (review by a person, as built): services-commerce:docs/migrations/operations/README.md#Section 5 walkthrough
no proof recorded yet
policyservicetest
services-commerce:modules/fulfillment/tests/integration/services/enforcement/enforcement-handler.integration.spec.js#leaves the review enforcement pending with an enforcement_review exception and no obligation, and the cancel_line one dispatched with a review for the request
03must prove
Proposed
Notify and suspend responses immediately authorize and queue an unconditional enforcement obligation while retaining the original completed obligation.
no proof recorded yet
lifecycleservicetest
services-commerce:modules/fulfillment/tests/integration/services/enforcement/enforcement-handler.integration.spec.js#writes the suspend enforcement dispatched, with its enforce obligation authorized, queued and nudged, keyed on the fact
04must prove
Proposed
A cancel-line response sends the enforcement instruction and also raises a review for staff to complete cancellation and its financial consequences.
origin: Decision F, Andrew 2026-10-18 (staff finish the money side, as built): services-commerce:docs/migrations/operations/README.md#Section 5 walkthrough; D-P5-02
no proof recorded yet
policyservicetest
services-commerce:modules/fulfillment/tests/integration/services/enforcement/enforcement-handler.integration.spec.js#leaves the review enforcement pending with an enforcement_review exception and no obligation, and the cancel_line one dispatched with a review for the request
05
Proposed
The none reversal response leaves the delivered line unchanged.
policyservicetest
services-commerce:modules/fulfillment/tests/integration/services/enforcement/enforcement-handler.integration.spec.js#creates four enforcements: three dispatched (suspend, cancel_line, notify), one for a person (review); the none policy and the pending obligation get nothing
06must prove
Proposed
A reversal without an explaining cancellation raises one informational refund-without-cancellation exception for each delivered order.
no proof recorded yet
policyservicetest
services-commerce:modules/fulfillment/tests/integration/services/enforcement/enforcement-handler.integration.spec.js#raises refund_without_cancellation once per delivered order, and the enforcement_created line on each history
07must prove
Proposed
The same obligation and financial event produce at most one enforcement, including when the event is redelivered.
no proof recorded yet
invariantservice, databasetest
services-commerce:modules/fulfillment/tests/integration/services/enforcement/enforcement-handler.integration.spec.js#creates nothing when the same fact is enforced again (idempotent on the event id)
08must prove
Proposed
Restored funds produce one restoration for each enforcement that acted, dispatching it where the application supports restoration and otherwise leaving it for staff.
no proof recorded yet
lifecycleservicetest
services-commerce:modules/fulfillment/tests/integration/services/enforcement/enforcement-handler.integration.spec.js#dispatches a restore for the suspended and the notified deliveries (the unlimited product declares one) and leaves the capacity product’s with staff
09must prove
Proposed
Enforcement accepts only its defined transitions through pending, dispatched, completed, restored, failed and resolved states.
no proof recorded yet
lifecycleservicetest
services-commerce:modules/fulfillment/tests/integration/services/persistence/enforcements.queries.integration.spec.js#moves an enforcement along its lifecycle (pending -> dispatched -> completed -> restored) and refuses a move it does not allow
10must prove
Proposed
Staff resolution requires a reason and resolution, closes the enforcement-review exception, and rejects readers and repeated resolution.
no proof recorded yet
permissionapi, servicetest
services-commerce:modules/fulfillment/tests/e2e/enforcement.e2e.spec.js#resolves the seat’s review on its route with the reason and the resolution, refusing a reader and a repeat
11
Proposed
Enforcement read authority permits lists by order or state and inspection of an individual enforcement.
permissionapiobserved

Scenarios

IdGivenWhenThenProvenance
01An order's delivered membership, seat and shirt have different reversal settings.Apply the chargeback events.Membership suspension is dispatched while seat review and shirt-cancellation follow-up remain with staff.test
services-commerce:modules/fulfillment/tests/e2e/enforcement.e2e.spec.js#answers succeeded for each event and enforces each: two dispatched (suspend, cancel_line), one for a person (review), the receipt saying so
02Funds return after membership suspension.Apply Accounting's restored-funds event.The application restores membership and the enforcement reaches restored state.test
services-commerce:modules/fulfillment/tests/e2e/enforcement.e2e.spec.js#restores the membership through a dispatched restore and closes the suspension as restored; the T-shirt’s restore stays with staff (no restore declared)

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.