Skip to content

ATS-COM-ORD-014Cancel accepted purchases and settle the result: Capability Test Specification

Markdown

ATS-COM-ORD-014

Cancel accepted purchases and settle the result: Capability Test Specification

Markdown
  • DocumentProposed

Planning

Proves capability
CAP-COM-ORD-014

Design

Executed by
TST-COM-ORD-076, TST-COM-ORD-080, TST-COM-ORD-131

KindAcceptance test setProduct areaCommerceModuleCustomer purchases, purchased benefits and vendor stockRevision2

Read atservices-commerce c8b66a98macroservice-libraries 54536a44react-console baf6dae3

Coverage

  • Rule gap: FND-COM-ORD-071
  • Transition gap: FND-COM-ORD-071
  • Validation covered
  • Permission gap: FND-COM-ORD-071
  • Edge covered
  • Failure gap: FND-COM-ORD-071
  • Boundary covered
  • Concurrency covered
  • Invariant gap: FND-COM-ORD-071
  • Interaction covered

Test Scenarios

19 scenarios proving CAP-COM-ORD-014; 15 bound to an existing test.

01 Cancellation refuses invalid order or access contextpermissionapinegativetest
Proves
BR-CAP-COM-ORD-014-01
Preconditions
A placed order is accessed by another member, reader or workspace.
Steps
[ { "do": "Request cancellation in the refusal cases.", "provenance": "test", "source": "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" } ]
Expected
The results identify order_not_cancellable, not_your_party, permission_missing or not found.
Data
Use the controlled records and transports established by the cited tests.
Bound to
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
Source
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
02 An uncomplicated cancellation completes from its plantransitionapitest
Proves
BR-CAP-COM-ORD-014-02
Preconditions
An accepted order has an undelivered shirt and an unaffected mug.
Steps
[ { "do": "Cancel the shirt using the request’s execution path.", "provenance": "test", "source": "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" } ]
Expected
The document records allowed and executed quantity, completed money work and cancellation status.
Data
Use the controlled records and transports established by the cited tests.
Bound to
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
Source
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
03 Remaining lines determine the order’s cancellation statetransitionapitest
Proves
BR-CAP-COM-ORD-014-03
Preconditions
An accepted order has two separate item lines.
Steps
[ { "do": "Cancel the shirt and then the mug.", "provenance": "test", "source": "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" } ]
Expected
The first closure preserves the other line and the last closure makes the order cancelled.
Data
Use the controlled records and transports established by the cited tests.
Bound to
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
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#lists the order’s cancellations and reads one; cancelling the mug too closes the order cancelled (B5)
Source
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
04 Domain cancellation precedes its refundinteractionapitest
Proves
BR-CAP-COM-ORD-014-04
Preconditions
An application has already delivered the purchased membership fixture.
Steps
[ { "do": "Request cancellation and process the queued cancellation obligation.", "provenance": "test", "source": "services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#answers executing: a cancel obligation stands open at once (nothing to fence: the type claims nothing), the line executed, the domain action shown" } ]
Expected
Application cancellation completes before the recorded money adjustment and document completion.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#answers executing: a cancel obligation stands open at once (nothing to fence: the type claims nothing), the line executed, the domain action shown
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)
Source
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#answers executing: a cancel obligation stands open at once (nothing to fence: the type claims nothing), the line executed, the domain action shown
05 Invoice credit differs from refundable fundingboundaryunittest
Proves
BR-CAP-COM-ORD-014-05
Preconditions
The fixtures cancel two of five discounted units with tax, limited funding and refundable fractions.
Steps
[ { "do": "Assemble the plans and apply the invoice cap helper.", "provenance": "test", "source": "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" } ]
Expected
Unit value and tax form the credit; funding and deductions limit only the estimated refund.
Data
Use the controlled records and transports established by the cited tests.
Bound to
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
services-commerce:modules/orders/tests/unit/cancellations/cancellation-plan.spec.js#reduces the estimate by the refundable fraction and the non-refundable part, and caps it at what was funded
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#credits no more than the invoice line still owes, so Accounting does not refuse the memo as an over-application
Source
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
06 Fee planning includes a billable fallbackedgeunittest
Proves
BR-CAP-COM-ORD-014-06
Preconditions
Frozen terms or application advice include a fee, with a case lacking any fee product.
Steps
[ { "do": "Assemble cancellation fee and settlement cases.", "provenance": "test", "source": "services-commerce:modules/orders/tests/unit/cancellations/cancellation-plan.spec.js#takes the participant’s fee, else the frozen terms’, else none, and waives an amount with no product with a warning" } ]
Expected
Billable fees use their product and freed money, while an unbillable fee becomes a warning and is waived.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/orders/tests/unit/cancellations/cancellation-plan.spec.js#takes the participant’s fee, else the frozen terms’, else none, and waives an amount with no product with a warning
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#raises the fee invoice, applies the freed money to it and refunds the remainder
Source
services-commerce:modules/orders/tests/unit/cancellations/cancellation-plan.spec.js#takes the participant’s fee, else the frozen terms’, else none, and waives an amount with no product with a warning
07 Approval blocks overlapping executionconcurrencyapitest
Proves
BR-CAP-COM-ORD-014-07
Preconditions
Application advice requires review and another case exceeds a threshold.
Steps
[ { "do": "Request cancellation, try a duplicate, approve with a reason and execute.", "provenance": "test", "source": "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)" } ]
Expected
The held request blocks the duplicate and proceeds through recorded approval before execution.
Data
Use the controlled records and transports established by the cited tests.
Bound to
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)
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#lets the approver approve it with a reason, and staff execute it; the intervention on the history
services-commerce:modules/orders/tests/unit/cancellations/cancellation-plan.spec.js#waits for a person when the participant requires approval, and when the refund is above the order type’s threshold
Source
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)
08 Deadline overrides retain authorization checkspermissionapitest
Proves
BR-CAP-COM-ORD-014-08
Preconditions
A line is past its cancellation deadline.
Steps
[ { "do": "Request as a customer and attempt clerk and administrator overrides.", "provenance": "test", "source": "services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#rejects the member’s request with after_cancellation_deadline, the customer status declined; nothing moved on the order" } ]
Expected
The customer is declined, the clerk cannot override and the administrator’s reason permits evaluation subject to approval.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#rejects the member’s request with after_cancellation_deadline, the customer status declined; nothing moved on the order
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
Source
services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#rejects the member’s request with after_cancellation_deadline, the customer status declined; nothing moved on the order
09 Carrier handoff redirects cancellation to returnedgeapinegativetest
Proves
BR-CAP-COM-ORD-014-09
Preconditions
The shipping fence reports goods already handed off.
Steps
[ { "do": "Request cancellation of that line.", "provenance": "test", "source": "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" } ]
Expected
The result is must_return with shipment_handed_off.
Data
Use the controlled records and transports established by the cited tests.
Bound to
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
Source
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
10 Approval is unavailable to ordinary purchaserspermissionapinegativetest
Proves
BR-CAP-COM-ORD-014-10
Preconditions
A cancellation waits for an approver.
Steps
[ { "do": "Try its approval action as a portal member and an ordinary clerk.", "provenance": "test", "source": "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" } ]
Expected
Both requests return 403.
Data
Use the controlled records and transports established by the cited tests.
Bound to
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
Source
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
11 Partial-order cancellation preserves the other purchaseinteractionapitest
Proves
AS-JNY-COM-ORD-005-01 AS-JNY-COM-ORD-005-02
Preconditions
A paid order contains separate shirt and mug purchases.
Steps
[ { "do": "Cancel the affected shirt line.", "provenance": "test", "source": "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" } ]
Expected
Only the affected value and tax are credited while the remaining sale stays accepted.
Data
Use the controlled records and transports established by the cited tests.
Bound to
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
services-commerce:modules/orders/tests/e2e/order-discount-tax.e2e.spec.js#credits the Book’s net on its invoice line and its tax on the tax line, then refunds the whole $44.74 (COMM-M1 R7-1)
Source
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
12 Waiting line-grain delivery refuses a partial requestvalidationunitnegativetest
Proves
BR-CAP-COM-ORD-014-15
Preconditions
A waiting delivery treats all remaining units as one line.
Steps
[ { "do": "Plan a cancellation of fewer units than remain.", "provenance": "test", "source": "services-commerce:modules/orders/tests/unit/cancellations/cancellation-plan.spec.js#refuses more than the line has left, and a part of a waiting line-grain line (whole_line_only, D-P7-05)" } ]
Expected
The plan reports whole_line_only and permits zero units.
Data
A controlled workspace with the parties, commercial setup and application responses described above.
Bound to
services-commerce:modules/orders/tests/unit/cancellations/cancellation-plan.spec.js#refuses more than the line has left, and a part of a waiting line-grain line (whole_line_only, D-P7-05)
Source
services-commerce:modules/orders/tests/unit/cancellations/cancellation-plan.spec.js#refuses more than the line has left, and a part of a waiting line-grain line (whole_line_only, D-P7-05)
13 Withdrawal frees a cancellation’s occupied linetransitionapitest
Proves
BR-CAP-COM-ORD-014-11
Preconditions
A member has an approved unexecuted cancellation.
Steps
[ { "do": "Try a duplicate, withdraw the original and request again.", "provenance": "test", "source": "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" } ]
Expected
The duplicate is refused before withdrawal and a later request is accepted.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Bound to
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
Source
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
14 Cancellation returns capacity to the selling applicationinteractionapitest
Proves
BR-CAP-COM-ORD-014-12
Preconditions
An accepted line has one committed seat and a reservation.
Steps
[ { "do": "Execute cancellation and inspect the owner’s claim and reservation.", "provenance": "test", "source": "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" } ]
Expected
No seat claim remains and the reservation records release for cancellation.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Bound to
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
Source
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
15 Cancellation credit is visible on the immediate order readinteractionapitest
Proves
BR-CAP-COM-ORD-014-13
Preconditions
The fixture paid order has a cancellable line.
Steps
[ { "do": "Cancel the line and immediately read the order.", "provenance": "test", "source": "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" } ]
Expected
The money summary includes that cancellation’s credit.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Bound to
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
Source
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
16 Plan cancellation updates both future collection and current moneyinteractionapiproposed
Proves
BR-CAP-COM-ORD-009-06 BR-CAP-COM-ORD-014-13
Preconditions
A deposit sale has a paid installment and future unpaid shares.
Steps
[ { "do": "Cancel one line and inspect the schedule and order money.", "provenance": "proposed", "source": [ "services-commerce:modules/orders/tests/e2e/installments.e2e.spec.js#reduced the remaining installments: the mug’s part gone from the two scheduled ones, the paid one untouched, on the history", "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" ] } ]
Expected
The paid installment is unchanged, future shares shrink and the cancellation credit appears on the order.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Source
services-commerce:modules/orders/tests/e2e/installments.e2e.spec.js#reduced the remaining installments: the mug’s part gone from the two scheduled ones, the paid one untouched, on the history,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
17 Cancellation revokes the purchased right without removing use historyinteractionapinegativeproposed
Proves
BR-CAP-COM-ORD-013-08 BR-CAP-COM-ORD-014-04
Preconditions
A completed purchased grant has one recorded use.
Steps
[ { "do": "Cancel its line and retry the buyer’s download.", "provenance": "proposed", "source": [ "services-commerce:modules/entitlements/tests/e2e/entitlements.e2e.spec.js#revokes the line’s grant with the reason, refuses the download 409 entitlement_not_active, and writes the history", "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)" ] } ]
Expected
The grant is revoked, the original use remains and the download is refused.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Source
services-commerce:modules/entitlements/tests/e2e/entitlements.e2e.spec.js#revokes the line’s grant with the reason, refuses the download 409 entitlement_not_active, and writes the history,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)
18 Carrier handoff redirects the buyer to a returninteractionapiproposed
Proves
BR-CAP-COM-ORD-014-09 BR-CAP-COM-ORD-016-03
Preconditions
The purchased goods have been handed to the carrier and are within their return window.
Steps
[ { "do": "Request cancellation, then request a return.", "provenance": "proposed", "source": [ "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", "services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#authorizes at once under the built-in policy: the RMA numbered with its deadline, the lines authorized, the customer told to send it back" ] } ]
Expected
Cancellation directs the buyer to return; the eligible return receives receiving authority.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Source
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,services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#authorizes at once under the built-in policy: the RMA numbered with its deadline, the lines authorized, the customer told to send it back
19 Plan-line cancellation releases rights and offer use alongside moneyinteractionapiproposed
Proves
BR-CAP-COM-ORD-014-01 BR-CAP-COM-ORD-013-01 BR-CAP-COM-ORD-009-01 BR-CAP-COM-ORD-004-01
Preconditions
An accepted installment line has a grant and a personal single-use promotion.
Steps
[ { "do": "Cancel the line, run required domain reversal and inspect rights, redemption, credit and future schedule.", "provenance": "proposed", "source": [ "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", "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", "services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#fences a DELIVERED seat through the participant’s commerce_claim_cancellation, and the participant’s cancel gives the capacity back", "services-commerce:modules/orders/services/cancellations/cancellation-workflow.ts", "services-commerce:modules/orders/services/cancellations/cancellation-settlement.ts:settleCancellationAfterObligation", "services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#raises the fee invoice, applies the freed money to it and refunds the remainder", "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" ] } ]
Expected
The linked resources and future collection reflect the cancellation; the personal-code restoration expectation remains a product-versus-implementation gap.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Source
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,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,services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#fences a DELIVERED seat through the participant’s commerce_claim_cancellation, and the participant’s cancel gives the capacity back,services-commerce:modules/orders/services/cancellations/cancellation-workflow.ts,services-commerce:modules/orders/services/cancellations/cancellation-settlement.ts:settleCancellationAfterObligation,services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#raises the fee invoice, applies the freed money to it and refunds the remainder,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

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.