Skip to content

ATS-COM-ORD-016Authorize returns and settle received goods: Capability Test Specification

Markdown

ATS-COM-ORD-016

Authorize returns and settle received goods: Capability Test Specification

Markdown
  • DocumentProposed

Planning

Proves capability
CAP-COM-ORD-016

Design

Executed by
TST-COM-ORD-084, TST-COM-ORD-142

KindAcceptance test setProduct areaCommerceModuleCustomer purchases, purchased benefits and vendor stockRevision2

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

Coverage

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

Test Scenarios

13 scenarios proving CAP-COM-ORD-016; 11 bound to an existing test.

01 Return access requires an accepted permitted purchasepermissionapinegativetest
Proves
BR-CAP-COM-ORD-016-01
Preconditions
The fixtures include a placed order, excessive requested quantity and unauthorized contexts.
Steps
[ { "do": "Request returns for the cases.", "provenance": "test", "source": "services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#refuses a placed order 409 order_not_returnable, more units than the line has (rejected), another member 403, a reader 403, another tenant 404" } ]
Expected
The placed order and unauthorized calls fail, and excessive quantity produces a rejected plan.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#refuses a placed order 409 order_not_returnable, more units than the line has (rejected), another member 403, a reader 403, another tenant 404
Source
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#refuses a placed order 409 order_not_returnable, more units than the line has (rejected), another member 403, a reader 403, another tenant 404
02 Return terms choose specificity and preserve promisesruleunittest
Proves
BR-CAP-COM-ORD-016-02
Preconditions
Product, store and default policies coexist with more generous frozen terms.
Steps
[ { "do": "Resolve and merge the policy facts.", "provenance": "test", "source": "services-commerce:modules/orders/tests/unit/returns/return-policy.spec.js#defaults to 30 days from delivery, approval outside the window, refund on receipt, no fee, restock, quarantine and scrap" } ]
Expected
The applicable specific policy or built-in defaults apply without reducing the frozen promise.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/orders/tests/unit/returns/return-policy.spec.js#defaults to 30 days from delivery, approval outside the window, refund on receipt, no fee, restock, quarantine and scrap
services-commerce:modules/orders/tests/unit/returns/return-policy.spec.js#picks the most specific configured policy, else the built-in default, and loosens it by the frozen terms
Source
services-commerce:modules/orders/tests/unit/returns/return-policy.spec.js#defaults to 30 days from delivery, approval outside the window, refund on receipt, no fee, restock, quarantine and scrap
03 In-window return supplies receiving authoritytransitionapitest
Proves
BR-CAP-COM-ORD-016-03
Preconditions
The accepted shirt purchase is inside the allowed window.
Steps
[ { "do": "Request its return.", "provenance": "test", "source": "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
A numbered authorization records the deadline and permitted line with instructions to return it.
Data
Use the controlled records and transports established by the cited tests.
Bound to
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
Source
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
04 Late returns wait for an authorized decisionpermissionapitest
Proves
BR-CAP-COM-ORD-016-04
Preconditions
The fixture purchase is outside the policy window.
Steps
[ { "do": "Request, authorize and reject the review cases and test unauthorized approval access.", "provenance": "test", "source": "services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#holds the member’s request for approval; the approver authorizes it and the RMA is issued" } ]
Expected
The request waits, an authorized decision issues an authorization or reasoned rejection and unauthorized calls fail.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#holds the member’s request for approval; the approver authorizes it and the RMA is issued
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#lets the approver reject one with a reason; a member on the console route and a clerk are refused
Source
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#holds the member’s request for approval; the approver authorizes it and the RMA is issued
05 Final-sale exceptions need an administratorpermissionapitest
Proves
BR-CAP-COM-ORD-016-05
Preconditions
The product policy declares final sale.
Steps
[ { "do": "Request as a member and repeat with an administrator override.", "provenance": "test", "source": "services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#rejects the member with final_sale; the administrator’s override authorizes it" } ]
Expected
The ordinary plan rejects final_sale and the recorded override authorizes the return.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#rejects the member with final_sale; the administrator’s override authorizes it
Source
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#rejects the member with final_sale; the administrator’s override authorizes it
06 Partial receipt keeps authorization opentransitionapitest
Proves
BR-CAP-COM-ORD-016-06
Preconditions
Two returned units use receipt-based settlement.
Steps
[ { "do": "Receive one unit and then the second.", "provenance": "test", "source": "services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#takes the warehouse’s receipt: the goods back on the line, the memo and the refund run, the document completed and the RMA closed" } ]
Expected
The first receipt remains partial; completed receipt and settlement close the document and authorization.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#takes the warehouse’s receipt: the goods back on the line, the memo and the refund run, the document completed and the RMA closed
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#leaves the document partially received with the RMA open after one of two units, and completes it after the second
Source
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#takes the warehouse’s receipt: the goods back on the line, the memo and the refund run, the document completed and the RMA closed
07 Restocking settlement deducts its feeruleapitest
Proves
BR-CAP-COM-ORD-016-07
Preconditions
The return policy imposes a ten-percent restocking fee.
Steps
[ { "do": "Receive the goods and test staff and member financial-action selection.", "provenance": "test", "source": "services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#charges the policy’s 10% restocking fee as an invoice paid from the freed money, and refunds the rest" } ]
Expected
The fee is invoiced from freed money and the remainder settles; only staff can choose credit treatment.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#charges the policy’s 10% restocking fee as an invoice paid from the freed money, and refunds the rest
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#lets staff ask for a credit, and refuses a member the money action
Source
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#charges the policy’s 10% restocking fee as an invoice paid from the freed money, and refunds the rest
08 Return-label deduction stays within refundable moneyboundaryapitest
Proves
BR-CAP-COM-ORD-016-08
Preconditions
Customer-paid and organization-paid bought labels coexist with a no-purchase case.
Steps
[ { "do": "Settle the return and evaluate the fee cap.", "provenance": "test", "source": "services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#expects the deduction on the RMA and tells the customer the refund is less the return label (USD 8.40)" } ]
Expected
A bought customer label contributes 8.40 in the fixture, other cases deduct nothing and the cap leaves no negative refund.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#expects the deduction on the RMA and tells the customer the refund is less the return label (USD 8.40)
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#invoices the label on the return label fee product, pays it from the freed money and refunds the rest
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#deducts nothing when the tenant pays the label, though the carrier sold one
services-commerce:modules/orders/tests/unit/returns/return-policy.spec.js#never deducts more than the refund has left after the other fees: the refund’s floor is zero (D-P7-32)
Source
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#expects the deduction on the RMA and tells the customer the refund is less the return label (USD 8.40)
09 Policy scope prevents duplicate administrationvalidationapinegativetest
Proves
BR-CAP-COM-ORD-016-09
Preconditions
A scoped policy already exists.
Steps
[ { "do": "Create a duplicate, create a malformed default, attempt portal listing and delete the original.", "provenance": "test", "source": "services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#lists, reads and deletes the policy; refuses a member the policies, a second policy at the scope 400, a tenant default with a scope id 400" } ]
Expected
The malformed creations and portal read fail while authorized deletion succeeds.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#lists, reads and deletes the policy; refuses a member the policies, a second policy at the scope 400, a tenant default with a scope id 400
Source
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#lists, reads and deletes the policy; refuses a member the policies, a second policy at the scope 400, a tenant default with a scope id 400
10 Withdrawal closes return receiving authoritytransitionapitest
Proves
BR-CAP-COM-ORD-016-10
Preconditions
An authorized return occupies a purchased line.
Steps
[ { "do": "Attempt a duplicate, withdraw the first and inspect the receiving notification.", "provenance": "test", "source": "services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#lets the member withdraw an authorized return: the RMA closed and the streams told; a line already under a return refused meanwhile" } ]
Expected
The duplicate is refused and the first authorization closes with receiving informed.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Bound to
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#lets the member withdraw an authorized return: the RMA closed and the streams told; a line already under a return refused meanwhile
Source
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#lets the member withdraw an authorized return: the RMA closed and the streams told; a line already under a return refused meanwhile
11 Later policy cannot charge a promised organization-paid labelinvariantunittest
Proves
BR-CAP-COM-ORD-016-11
Preconditions
Frozen terms promise an organization-paid label and the later policy charges the customer.
Steps
[ { "do": "Resolve the return label terms.", "provenance": "test", "source": "services-commerce:modules/orders/tests/unit/returns/return-policy.spec.js#keeps a label the frozen terms promised at the tenant’s cost from being charged to the customer later" } ]
Expected
The resulting label remains at the organization’s expense.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Bound to
services-commerce:modules/orders/tests/unit/returns/return-policy.spec.js#keeps a label the frozen terms promised at the tenant’s cost from being charged to the customer later
Source
services-commerce:modules/orders/tests/unit/returns/return-policy.spec.js#keeps a label the frozen terms promised at the tenant’s cost from being charged to the customer later
12 Returned goods restore their original acquisition costinteractionapiproposed
Proves
BR-CAP-COM-ORD-016-06 BR-CAP-COM-ORD-018-08
Preconditions
A shipped line has identified layer relief and a receipt-based return authorization.
Steps
[ { "do": "Receive part of the goods and then the remainder; inspect cost restoration and settlement.", "provenance": "proposed", "source": [ "services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#takes the warehouse’s receipt: the goods back on the line, the memo and the refund run, the document completed and the RMA closed", "services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#restores 5 returned units at the relieved cost and place: a restore row naming the relief it reverses, a layer at that cost dated with the original layer, a restore_cogs fact of 5 × that cost" ] } ]
Expected
Partial receiving leaves the authorization open and cost restoration reverses the original relief as the completed return settles.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Source
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#takes the warehouse’s receipt: the goods back on the line, the memo and the refund run, the document completed and the RMA closed,services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#restores 5 returned units at the relieved cost and place: a restore row naming the relief it reverses, a layer at that cost dated with the original layer, a restore_cogs fact of 5 × that cost
13 Return receipt and original-cost restoration commit togetherinteractionapiproposed
Proves
BR-CAP-COM-ORD-016-01 BR-CAP-COM-ORD-018-01
Preconditions
A delivered product has recorded shipment cost relief and a receipt-based return.
Steps
[ { "do": "Authorize and receive its goods, then inspect quantities, restored layers and settlement.", "provenance": "proposed", "source": [ "services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js", "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", "services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#lets the approver reject one with a reason; a member on the console route and a clerk are refused", "services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#takes the warehouse’s receipt: the goods back on the line, the memo and the refund run, the document completed and the RMA closed", "services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#charges the policy’s 10% restocking fee as an invoice paid from the freed money, and refunds the rest", "services-commerce:modules/operations/services/reconciler/reconciler.ts" ] } ]
Expected
Received quantities and original-cost restoration share the receiving outcome; settlement uses the authorized goods.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Source
services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js,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,services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#lets the approver reject one with a reason; a member on the console route and a clerk are refused,services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#takes the warehouse’s receipt: the goods back on the line, the memo and the refund run, the document completed and the RMA closed,services-commerce:modules/orders/tests/e2e/returns.e2e.spec.js#charges the policy’s 10% restocking fee as an invoice paid from the freed money, and refunds the rest,services-commerce:modules/operations/services/reconciler/reconciler.ts

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.