Skip to content

ATS-COM-ORD-018Receive inventory and retain its cost: Capability Test Specification

Markdown

ATS-COM-ORD-018

Receive inventory and retain its cost: Capability Test Specification

Markdown
  • DocumentProposed

Planning

Proves capability
CAP-COM-ORD-018

Design

Executed by
TST-COM-ORD-155, TST-COM-ORD-160, TST-COM-ORD-161

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-075
  • Validation covered
  • Permission gap: FND-COM-ORD-075
  • Edge gap: FND-COM-ORD-075
  • Failure covered
  • Boundary covered
  • Concurrency gap: FND-COM-ORD-075
  • Invariant gap: FND-COM-ORD-075
  • Interaction covered

Test Scenarios

18 scenarios proving CAP-COM-ORD-018; 15 bound to an existing test.

01 Receipt replay retains the first delivery recordinvariantapitest
Proves
BR-CAP-COM-ORD-018-01
Preconditions
A keyed receipt is accepted against an issued purchase order.
Steps
[ { "do": "Submit the same receipt key again.", "provenance": "test", "source": "services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#answers the retried receipt as found under its key, writing nothing twice" } ]
Expected
The response identifies the existing receipt without duplicate stock or cost writes.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#answers the retried receipt as found under its key, writing nothing twice
services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#answers the retried first receipt as the same receipt, lists the receipts by order and reads one with its lines
Source
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#answers the retried receipt as found under its key, writing nothing twice
02 Receipt validation prevents excess or unexplained costvalidationapinegativetest
Proves
BR-CAP-COM-ORD-018-02
Preconditions
The open line has forty units left and a separate order is already received.
Steps
[ { "do": "Attempt excess quantity, another receipt on the completed order and changed cost without and with a reason.", "provenance": "test", "source": "services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#refuses a receipt beyond what the line has open (over_receipt) and a receipt against a received order, writing nothing" } ]
Expected
Invalid receipt cases write nothing and only the explained cost variance proceeds.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#refuses a receipt beyond what the line has open (over_receipt) and a receipt against a received order, writing nothing
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#refuses a receipt line whose cost differs from the order line’s without a reason, and takes one with a reason
Source
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#refuses a receipt beyond what the line has open (over_receipt) and a receipt against a received order, writing nothing
03 Receiving commits quantity and capitalization togetherinvariantapitest
Proves
BR-CAP-COM-ORD-018-03
Preconditions
Two backorders wait for a sixty-unit delivery at ten dollars per unit.
Steps
[ { "do": "Record the delivery and inspect stock, layers, posting facts and claims.", "provenance": "test", "source": "services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#writes, in the receipt’s transaction, the receipt movement naming the line, the layer of 60 @ 1000 and the capitalize_receipt fact of 60000" } ]
Expected
The fixture creates sixty units at cost, a six-hundred-dollar capitalization fact and ordered backorder fill with fifty-eight units available.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#writes, in the receipt’s transaction, the receipt movement naming the line, the layer of 60 @ 1000 and the capitalize_receipt fact of 60000
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#fills the two backorders at the first receipt, oldest first, converting them to committed; the shelf shows 58 available after
Source
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#writes, in the receipt’s transaction, the receipt movement naming the line, the layer of 60 @ 1000 and the capitalize_receipt fact of 60000
04 Landed-cost allocation retains the minor-unit totalboundaryunittest
Proves
BR-CAP-COM-ORD-018-04
Preconditions
Receipt lines have different quantities and values.
Steps
[ { "do": "Allocate freight by each supported basis and derive layer unit cost.", "provenance": "test", "source": "services-commerce:modules/purchasing/tests/unit/cost/cost-rules.spec.js#shares by quantity to the minor unit, the last line taking the rounding remainder" } ]
Expected
Shares preserve the total through the final-line remainder and unit cost includes the allocated portion.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/purchasing/tests/unit/cost/cost-rules.spec.js#shares by quantity to the minor unit, the last line taking the rounding remainder
services-commerce:modules/purchasing/tests/unit/cost/cost-rules.spec.js#shares by value: a line worth three times another takes three times the landed cost
services-commerce:modules/purchasing/tests/unit/cost/cost-rules.spec.js#is the line’s cost plus its landed share per unit, to the nearest minor unit
Source
services-commerce:modules/purchasing/tests/unit/cost/cost-rules.spec.js#shares by quantity to the minor unit, the last line taking the rounding remainder
05 Method switching leaves earlier cost history intactruleapitest
Proves
BR-CAP-COM-ORD-018-05
Preconditions
Two layers have different dates and costs with no initial business-unit setting.
Steps
[ { "do": "Relieve under default FIFO, switch to LIFO and relieve again.", "provenance": "test", "source": "services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#relieves under FIFO while the business unit has no setting: 4 @ 1000 from the older layer, recorded fifo" } ]
Expected
FIFO uses earlier units, LIFO uses later units and the earlier relief records remain unchanged.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#relieves under FIFO while the business unit has no setting: 4 @ 1000 from the older layer, recorded fifo
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#relieves a LIFO business unit’s 12 over two layers newer first: 10 @ 1200 from the newer, then 2 @ 1000 from the older, recorded lifo
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#rewrites nothing made before the switch: the FIFO relief rows read back unchanged, the receipt layers still record fifo
Source
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#relieves under FIFO while the business unit has no setting: 4 @ 1000 from the older layer, recorded fifo
06 Costing settings require current version and allowed methodvalidationapitest
Proves
BR-CAP-COM-ORD-018-06
Preconditions
The business unit has no configured setting.
Steps
[ { "do": "Read defaults, write LIFO, try stale replacement and invalid method or unit inputs.", "provenance": "test", "source": "services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#reads a business unit with no settings at the defaults: FIFO at version 0, not configured" } ]
Expected
Defaults expose version zero, the valid write succeeds and stale or malformed requests fail.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#reads a business unit with no settings at the defaults: FIFO at version 0, not configured
services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#writes LIFO at version 0, replaces it with the record read sent back, and refuses the stale version 409
services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#refuses a method that is neither FIFO nor LIFO 400, and a body naming another business unit 400
Source
services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#reads a business unit with no settings at the defaults: FIFO at version 0, not configured
07 Uncovered relief is explicitly flaggedfailureapinegativetest
Proves
BR-CAP-COM-ORD-018-07
Preconditions
The shipped quantity exceeds available cost-layer coverage.
Steps
[ { "do": "Relieve the shipped units.", "provenance": "test", "source": "services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#relieves units no layer covers at cost zero under no layer and raises uncosted_relief, so the books say so" } ]
Expected
Uncovered units carry zero cost with an uncosted_relief exception.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#relieves units no layer covers at cost zero under no layer and raises uncosted_relief, so the books say so
Source
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#relieves units no layer covers at cost zero under no layer and raises uncosted_relief, so the books say so
08 Return cost reverses the shipment basisinteractionapitest
Proves
BR-CAP-COM-ORD-018-08
Preconditions
Shipment relief used identified layers at retained costs.
Steps
[ { "do": "Restore five returned units.", "provenance": "test", "source": "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
Restore rows identify their reliefs and original-cost layers with a matching cost-restoration fact.
Data
Use the controlled records and transports established by the cited tests.
Bound to
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
Source
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
09 Cost corrections preserve the consumed recordtransitionapitest
Proves
BR-CAP-COM-ORD-018-09
Preconditions
A costed layer has remaining units and needs a lower unit cost.
Steps
[ { "do": "Correct its remaining cost basis.", "provenance": "test", "source": "services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#moves the unconsumed remainder to a layer at the corrected cost, leaves the original consumed, and writes the cost_adjustment of the difference" } ]
Expected
The remainder moves into a successor layer, the original is consumed and the value difference becomes a cost-adjustment fact.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#moves the unconsumed remainder to a layer at the corrected cost, leaves the original consumed, and writes the cost_adjustment of the difference
services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#corrects the second layer’s cost to 1100: the remainder on a correction layer, the original consumed, a cost_adjustment of 10 × 150, the valuation reconciled
Source
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#moves the unconsumed remainder to a layer at the corrected cost, leaves the original consumed, and writes the cost_adjustment of the difference
10 Valuation reconciles quantities beside their assigned costruleapitest
Proves
BR-CAP-COM-ORD-018-10
Preconditions
The fixture layers contain three zero-cost units and two ten-unit priced layers.
Steps
[ { "do": "Read valuation and business-unit summaries.", "provenance": "test", "source": "services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#values the shirt L item at Σ the layers (3 at zero from the movement route, 10 × 1000, 10 × 1250 = 22500), reconciled with 23 on hand" } ]
Expected
The item reports twenty-three units and 225 dollars with reconciliation and its costing setting.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#values the shirt L item at Σ the layers (3 at zero from the movement route, 10 × 1000, 10 × 1250 = 22500), reconciled with 23 on hand
services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#shows the products’ business unit and its method beside the valuation’s totals: faa, FIFO, not configured
Source
services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#values the shirt L item at Σ the layers (3 at zero from the movement route, 10 × 1000, 10 × 1250 = 22500), reconciled with 23 on hand
11 Posting acknowledgement is stable by referenceinvariantapitest
Proves
BR-CAP-COM-ORD-018-11
Preconditions
Two receipt facts remain unposted.
Steps
[ { "do": "List them, acknowledge a reference, replay it and attempt another reference.", "provenance": "test", "source": "services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#lists the unposted facts by date, stamps them posted once under Accounting’s reference, and refuses another reference on a posted fact" } ]
Expected
The same reference replays without changing history, another reference fails and acknowledged facts leave intake.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#lists the unposted facts by date, stamps them posted once under Accounting’s reference, and refuses another reference on a posted fact
services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#lists the facts unposted (the two receipts’), stamps them posted under Accounting’s reference, and lists none unposted after
Source
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#lists the unposted facts by date, stamps them posted once under Accounting’s reference, and refuses another reference on a posted fact
12 Posting kinds expose their debit and credit purposesruleunittest
Proves
BR-CAP-COM-ORD-018-12
Preconditions
Inputs cover receipt, shipment, restore, loss, scrap and gain.
Steps
[ { "do": "Resolve account purposes for each fact kind.", "provenance": "test", "source": "services-commerce:modules/purchasing/tests/unit/cost/cost-rules.spec.js#debits inventory and credits GRNI for a receipt, debits COGS and credits inventory for a handoff, the reverse for a restore" } ]
Expected
The returned inventory, clearing, cost-of-goods and adjustment directions match the supplied fact kind.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/purchasing/tests/unit/cost/cost-rules.spec.js#debits inventory and credits GRNI for a receipt, debits COGS and credits inventory for a handoff, the reverse for a restore
services-commerce:modules/purchasing/tests/unit/cost/cost-rules.spec.js#debits the adjustment account for a loss or a write-off and credits it for a gain
Source
services-commerce:modules/purchasing/tests/unit/cost/cost-rules.spec.js#debits inventory and credits GRNI for a receipt, debits COGS and credits inventory for a handoff, the reverse for a restore
13 Supply flow connects waiting orders, valuation and postinginteractionapitest
Proves
AS-JNY-COM-ORD-006-01 AS-JNY-COM-ORD-006-02 AS-JNY-COM-ORD-006-03
Preconditions
A vendor supplies stock with existing backorders.
Steps
[ { "do": "Issue the commitment, receive deliveries and inspect valuation and posting acknowledgement.", "provenance": "test", "source": "services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#fills the two backorders at the first receipt, oldest first, converting them to committed; the shelf shows 58 available after" } ]
Expected
The demonstrated components fill waiting claims, reconcile layer value and acknowledge each fact once.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#fills the two backorders at the first receipt, oldest first, converting them to committed; the shelf shows 58 available after
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#values the item after at 30 × 1200 = 36000, reconciled with the ledger’s on-hand of 30
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#lists the unposted facts by date, stamps them posted once under Accounting’s reference, and refuses another reference on a posted fact
Source
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#fills the two backorders at the first receipt, oldest first, converting them to committed; the shelf shows 58 available after
14 Transfers preserve value without inventing uncovered costboundaryapiproposed
Proves
BR-CAP-COM-ORD-018-14
Preconditions
A transfer contains covered stock whose total cost has a rounding remainder and additional stock without an acquisition layer.
Steps
[ { "do": "Transfer the units and inspect source relief, destination layers and posting facts.", "provenance": "proposed", "source": "services-commerce:modules/purchasing/services/cost/transfer-cost.ts:costTransfer" } ]
Expected
Covered value is preserved exactly across weighted destination layers, uncovered units create no destination cost layer, and the transfer creates no financial posting fact.
Data
Use the controlled records and transports established by the cited tests.
Source
services-commerce:modules/purchasing/services/cost/transfer-cost.ts:costTransfer
15 Count and staff movements retain the proper cost factsruleapitest
Proves
BR-CAP-COM-ORD-018-15
Preconditions
Inventory has receipt cost history and count or staff changes.
Steps
[ { "do": "Record gains, losses and scrap in the fixture flows.", "provenance": "test", "source": "services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#relieves a scrap FIFO with a write_off fact, and a negative adjustment with an adjustment_loss fact" } ]
Expected
Gains create receipt-based cost, losses consume layers and each movement records its demonstrated adjustment or write-off purpose.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#relieves a scrap FIFO with a write_off fact, and a negative adjustment with an adjustment_loss fact
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#values a count gain at the last receipt cost (adjustment_gain) and relieves a count loss (adjustment_loss), each fact naming the count line
Source
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#relieves a scrap FIFO with a write_off fact, and a negative adjustment with an adjustment_loss fact
16 Valuation reports missing cost evidence without repairing stockfailureapinegativetest
Proves
BR-CAP-COM-ORD-018-13
Preconditions
The fixture has uncovered stock and a shipment movement without relief beside reconciled items.
Steps
[ { "do": "Run valuation findings and inspect those records.", "provenance": "test", "source": "services-commerce:modules/purchasing/services/valuation/inventory-valuation.ts:raiseCostFindings" } ]
Expected
The discrepancies raise valuation and missing-relief exceptions; reconciled items raise neither.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Bound to
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#raises valuation_mismatch on stock no layer costs, relief_missing on a shipment movement no relief followed, and nothing on the reconciled items
Source
services-commerce:modules/purchasing/services/valuation/inventory-valuation.ts:raiseCostFindings
17 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
18 Partial receipts retain the vendor commitment and acquisition trailinteractionapiproposed
Proves
BR-CAP-COM-ORD-018-01 BR-CAP-COM-ORD-017-01
Preconditions
An issued vendor purchase covers one hundred units with waiting backorders.
Steps
[ { "do": "Receive sixty and then forty; inspect purchase progress, stock, cost and posting intake.", "provenance": "proposed", "source": [ "services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#refuses a receipt line whose cost differs from the order line’s without a reason, and takes one with a reason", "services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#fills the two backorders at the first receipt, oldest first, converting them to committed; the shelf shows 58 available after", "services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#lists the facts unposted (the two receipts’), stamps them posted under Accounting’s reference, and lists none unposted after" ] } ]
Expected
The first receipt is partial and the second completes the order, with one acquisition trail per receipt.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Source
services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#refuses a receipt line whose cost differs from the order line’s without a reason, and takes one with a reason,services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#fills the two backorders at the first receipt, oldest first, converting them to committed; the shelf shows 58 available after,services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#lists the facts unposted (the two receipts’), stamps them posted under Accounting’s reference, and lists none unposted after

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.