Skip to content

CAP-COM-ORD-014Cancel accepted purchases and settle the result

Markdown

CAP-COM-ORD-014

Cancel accepted purchases and settle the result

Markdown
  • DocumentDraft
  • Product intentProposed
  • ImplementationObserved

KindCapabilityProduct areaCommerceModuleCustomer purchases, purchased benefits and vendor stockRevision1

Read atservices-commerce c8b66a98react-console baf6dae3

The Formal Contract

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

Outcomes
Cancellation settles the affected purchase line while retaining the rest of the sale.Required domain cancellation completes before its financial adjustment.
Surfaces
consoleportalapi
Intent sources
services-commerce:docs/milestones/COMM-M1-set-up-what-you-sell.md#D13

Controls

30 controls apply, from the corpus control catalogue.

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-TEN-004 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-002 TC-PI-001 TC-PI-003 TC-PI-004 TC-PI-005 TC-VEN-001 TC-VEN-002 TC-VEN-003 TC-PRV-001 TC-PRV-002

Permissions

KeyChecked atScope
commerce.cancellations.readapitenant
commerce.cancellations.createapitenant
commerce.cancellations.updateapitenant
commerce.cancellations.approveapitenant
commerce.cancellations.overrideservicetenant

Business Rules

15 rules, 15 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
Cancellation requires an accepted order and authorized parties, rejecting placed orders, unauthorized members, readers and records in another workspace.
validationapi, servicetest
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#refuses a placed order 409 order_not_cancellable, another member 403 not_your_party, a reader 403 permission_missing, another tenant 404
02must prove
Proposed
The request immediately combines application cancellation advice with money and approval facts into a plan, and can execute that plan in the request when no approval is needed.
lifecycleservicetest
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#answers 200 with the document completed in the one request: allowed, executed, the money moved, the customer status cancelled
03must prove
Proposed
Cancelling waiting delivery closes the affected line and increases its cancelled quantity, with the order becoming cancelled when every line is cancelled.
lifecycleservice, databasetest
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#cancels the line’s waiting fulfil obligation itself, grows quantity_cancelled and closes the line; the mug untouched, the order still accepted
04must prove
Proposed
The application undoes delivered work through a cancellation obligation, and the financial action waits for that domain cancellation when required.
policyservicetest
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#is delivered by the worker to the participant’s cancel, which settles the document completed and runs the refund after the domain (ADR-13)
05must prove
Proposed
Credit uses cancelled units’ discounted value and tax within the remaining invoice cap, while the refund estimate separately applies funding, refundable fraction, non-refundable amounts and fees.
calculationservicetest
services-commerce:modules/orders/tests/unit/cancellations/cancellation-plan.spec.js#credits 2 of 5 units at the discounted amount with the tax share, estimates the refund from the funded part, and approves the document
06must prove
Proposed
Fee calculation prefers application advice, then frozen line terms, using the order’s fee product as a fallback and waiving an unbillable fee with a warning before refunding the remaining freed money.
calculationservicetest
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#raises the fee invoice, applies the freed money to it and refunds the remainder
07must prove
Proposed
Application approval requirements or a refund exceeding the configured threshold hold the request for review and block overlapping line requests until approval and execution.
policyservicetest
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#holds staff’s request for approval (participant_requires_approval) and refuses a second request on the line 409 line_already_cancelling (B38)
08must prove
Proposed
A cancellation deadline blocks customer requests, but a reasoned administrator override can proceed subject to remaining approval requirements; ordinary clerks cannot override.
permissionservicetest
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#allows an administrator’s override at once with its reason, and refuses a clerk’s override 403 override_not_permitted
09must prove
Proposed
Goods handed to the carrier require a return instead of cancellation.
policyservicetest
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#answers must_return with shipment_handed_off once the shipping fence says the unit shipped
10must prove
Proposed
Cancellation approval and rejection require console access and approval authority, which a portal buyer or an ordinary clerk lacks.
permissionapitest
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#refuses a member on the console approve route 403, and a clerk approving 403 permission_missing
11must prove
Proposed
The requester can withdraw an approved cancellation before execution, freeing the line for a later request.
lifecycleservicetest
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#lets the member withdraw an approved, unexecuted request (a second request refused meanwhile), then request again
12must prove
Proposed
Cancellation releases an application’s committed capacity claim and its reservation so another purchase can use the capacity.
lifecycleservicetest
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#releases the claim through the participant’s function: one seat committed before, none after, the ledger released for cancellation
13must prove
Proposed
The order’s money summary refreshes to show cancellation credits immediately after cancellation.
policyservicetest
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#shows the cancellation’s credit on the order’s money mirror at once, read right after the cancel
14must prove
Proposed
The recorded product decision restores a personal single-use code by default when its purchased line is cancelled.
no proof recorded yet
policyservicedocumented
15must prove
Proposed
A delivery that operates on a whole waiting line refuses cancellation of fewer units than the remaining quantity.
validationserviceobserved

Scenarios

IdGivenWhenThenProvenance
01A member no longer wants one of two purchased shirts.Staff cancel the unwanted line.The illustrative refund concerns that shirt alone while the remainder continues.unknown

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.