---
id: ATS-COM-ORD-018
scope: CAP-COM-ORD-018
product_area: commerce
module: orders
revision: 2
status: proposed
approved_by: null
approved_at: null
source_sha:
  services-commerce: c8b66a98e2490617aec38ba5c8165dd9bd0a8f9b
  macroservice-libraries: 54536a441935c6e09fdb7f96f0bec71c52ba4e03
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
scenarios:
  - id: ATS-COM-ORD-018-01
    title: Receipt replay retains the first delivery record
    level: api
    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.
    negative: false
    data_needs: 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
      - TST-COM-ORD-160
      - TST-COM-ORD-155
    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
    category: invariant
    expected_provenance: test
    expected_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
  - id: ATS-COM-ORD-018-02
    title: Receipt validation prevents excess or unexplained cost
    level: api
    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.
    negative: true
    data_needs: 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
      - TST-COM-ORD-160
    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
    category: validation
    expected_provenance: test
    expected_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
  - id: ATS-COM-ORD-018-03
    title: Receiving commits quantity and capitalization together
    level: api
    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.
    negative: false
    data_needs: 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
      - TST-COM-ORD-160
    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
    category: invariant
    expected_provenance: test
    expected_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
  - id: ATS-COM-ORD-018-04
    title: Landed-cost allocation retains the minor-unit total
    level: unit
    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.
    negative: false
    data_needs: 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
      - TST-COM-ORD-161
    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
    category: boundary
    expected_provenance: test
    expected_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
  - id: ATS-COM-ORD-018-05
    title: Method switching leaves earlier cost history intact
    level: api
    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.'
    negative: false
    data_needs: 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
      - TST-COM-ORD-160
    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
    category: rule
    expected_provenance: test
    expected_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
  - id: ATS-COM-ORD-018-06
    title: Costing settings require current version and allowed method
    level: api
    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.'
    negative: false
    data_needs: 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
      - TST-COM-ORD-155
    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
    category: validation
    expected_provenance: test
    expected_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
  - id: ATS-COM-ORD-018-07
    title: Uncovered relief is explicitly flagged
    level: api
    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.
    negative: true
    data_needs: 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
      - TST-COM-ORD-160
    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
    category: failure
    expected_provenance: test
    expected_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
  - id: ATS-COM-ORD-018-08
    title: Return cost reverses the shipment basis
    level: api
    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.
    negative: false
    data_needs: 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
      - TST-COM-ORD-160
    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
    category: interaction
    expected_provenance: test
    expected_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
  - id: ATS-COM-ORD-018-09
    title: Cost corrections preserve the consumed record
    level: api
    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.
    negative: false
    data_needs: 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
      - TST-COM-ORD-160
      - TST-COM-ORD-155
    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
    category: transition
    expected_provenance: test
    expected_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
  - id: ATS-COM-ORD-018-10
    title: Valuation reconciles quantities beside their assigned cost
    level: api
    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.
    negative: false
    data_needs: 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
      - TST-COM-ORD-155
    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
    category: rule
    expected_provenance: test
    expected_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
  - id: ATS-COM-ORD-018-11
    title: Posting acknowledgement is stable by reference
    level: api
    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.
    negative: false
    data_needs: 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
      - TST-COM-ORD-160
      - TST-COM-ORD-155
    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
    category: invariant
    expected_provenance: test
    expected_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
  - id: ATS-COM-ORD-018-12
    title: Posting kinds expose their debit and credit purposes
    level: unit
    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.'
    negative: false
    data_needs: 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
      - TST-COM-ORD-161
    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
    category: rule
    expected_provenance: test
    expected_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
  - id: ATS-COM-ORD-018-13
    title: 'Supply flow connects waiting orders, valuation and posting'
    level: api
    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.'
    negative: false
    data_needs: 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
      - TST-COM-ORD-160
    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
    category: interaction
    expected_provenance: test
    expected_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
  - id: ATS-COM-ORD-018-14
    title: Transfers preserve value without inventing uncovered cost
    level: api
    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.
    negative: false
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to: []
    provenance: proposed
    source: 'services-commerce:modules/purchasing/services/cost/transfer-cost.ts:costTransfer'
    category: boundary
    expected_provenance: proposed
    expected_source: 'services-commerce:modules/purchasing/services/cost/transfer-cost.ts:costTransfer'
  - id: ATS-COM-ORD-018-15
    title: Count and staff movements retain the proper cost facts
    level: api
    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.
    negative: false
    data_needs: 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
      - TST-COM-ORD-160
    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
    category: rule
    expected_provenance: test
    expected_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
  - id: ATS-COM-ORD-018-16
    title: Valuation reports missing cost evidence without repairing stock
    category: failure
    level: api
    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.
    negative: true
    data_needs: 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
      - TST-COM-ORD-160
    provenance: test
    source: 'services-commerce:modules/purchasing/services/valuation/inventory-valuation.ts:raiseCostFindings'
    coverage_limit: >-
      The executable example covers shipment relief; the transfer missing-relief branch remains a coverage
      gap.
    expected_provenance: test
    expected_source: 'services-commerce:modules/purchasing/services/valuation/inventory-valuation.ts:raiseCostFindings'
  - id: ATS-COM-ORD-018-17
    title: Returned goods restore their original acquisition cost
    category: interaction
    level: api
    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.
    negative: false
    data_needs: Use an isolated workspace with the records and responses named in the preconditions.
    bound_to: []
    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
    exercises:
      - CAP-COM-ORD-018
      - CAP-COM-ORD-016
    related_capabilities:
      - CAP-COM-ORD-016
    expected_provenance: proposed
    expected_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
  - id: ATS-COM-ORD-018-18
    title: Partial receipts retain the vendor commitment and acquisition trail
    category: interaction
    level: api
    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.'
    negative: false
    data_needs: Use an isolated workspace with the records and responses named in the preconditions.
    bound_to: []
    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
    exercises:
      - CAP-COM-ORD-018
      - CAP-COM-ORD-017
    workflows:
      - WF-COM-ORD-015
    expected_provenance: proposed
    expected_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
evidence:
  - >-
    Examined reference: 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
  - >-
    Examined reference: 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
  - >-
    Examined reference: 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
  - >-
    Examined reference: 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
  - >-
    Examined reference: 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
  - >-
    Examined reference: 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
  - >-
    Examined reference: 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
  - >-
    Examined reference: 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
  - >-
    Examined reference:
    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
  - >-
    Examined reference:
    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
  - >-
    Examined reference:
    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
  - >-
    Examined reference:
    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
  - >-
    Examined reference:
    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
  - >-
    Examined reference:
    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
  - >-
    Examined reference:
    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
  - >-
    Examined reference:
    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
  - >-
    Examined reference:
    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
  - >-
    Examined reference:
    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
  - >-
    Examined reference:
    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
  - >-
    Examined reference:
    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
  - >-
    Examined reference:
    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
  - >-
    Examined reference:
    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
  - >-
    Examined reference:
    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
  - >-
    Examined reference: services-commerce:modules/purchasing/tests/unit/cost/cost-rules.spec.js#carries the
    remainder on a second layer one minor unit dearer, so Σ the layers is Σ the draws
  - >-
    Examined reference: 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
  - >-
    Examined reference: 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
  - >-
    Examined reference: 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
  - >-
    Examined reference: 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
  - >-
    Examined reference: 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
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
coverage_definition: Covered means a design scenario exists; executable coverage and execution results are separate.
permission_coverage:
  - key: commerce.purchasing.create
    where_checked: api
    scenarios: []
    gap: FND-COM-ORD-075
    note: >-
      The listed examples do not establish a complete allow-and-deny matrix for this key; unused catalogue
      keys need no invented route.
    provenance: unknown
    source: FND-COM-ORD-075
  - key: commerce.purchasing.read
    where_checked: api
    scenarios: []
    gap: FND-COM-ORD-075
    note: >-
      The listed examples do not establish a complete allow-and-deny matrix for this key; unused catalogue
      keys need no invented route.
    provenance: unknown
    source: FND-COM-ORD-075
  - key: commerce.inventory-costing.read
    where_checked: api
    scenarios: []
    gap: FND-COM-ORD-075
    note: >-
      The listed examples do not establish a complete allow-and-deny matrix for this key; unused catalogue
      keys need no invented route.
    provenance: unknown
    source: FND-COM-ORD-075
  - key: commerce.inventory-costing.update
    where_checked: api
    scenarios: []
    gap: FND-COM-ORD-075
    note: >-
      The listed examples do not establish a complete allow-and-deny matrix for this key; unused catalogue
      keys need no invented route.
    provenance: unknown
    source: FND-COM-ORD-075
  - key: commerce.inventory-costing.create
    where_checked: api
    scenarios: []
    gap: FND-COM-ORD-075
    note: >-
      The listed examples do not establish a complete allow-and-deny matrix for this key; unused catalogue
      keys need no invented route.
    provenance: unknown
    source: FND-COM-ORD-075
  - key: commerce.inventory-costing.delete
    where_checked: api
    scenarios: []
    gap: FND-COM-ORD-075
    note: >-
      The listed examples do not establish a complete allow-and-deny matrix for this key; unused catalogue
      keys need no invented route.
    provenance: unknown
    source: FND-COM-ORD-075
  - key: commerce.inventory-costing.bulk
    where_checked: api
    scenarios: []
    gap: FND-COM-ORD-075
    note: >-
      The listed examples do not establish a complete allow-and-deny matrix for this key; unused catalogue
      keys need no invented route.
    provenance: unknown
    source: FND-COM-ORD-075
transition_coverage:
  - state_model: STATE-COM-ORD-013
    from: draft
    to: issued
    trigger: Staff move the stock order into issue.
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: unknown
    source: >-
      services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#drafts the order numbered with its
      line and issues it
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-013
    from: issued
    to: partially_received
    trigger: Goods arrival covers part of the outstanding remainder.
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: unknown
    source: >-
      services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#records
      the first receipt numbered, against the order, with one line of 60 at the order line’s cost, and the
      order partially received
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-013
    from: partially_received
    to: received
    trigger: Receipt or quantity cancellation removes the final remainder.
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: unknown
    source: >-
      services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#receives
      the remaining 40 and the order is received with its instant; the two layers stand oldest first
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-013
    from: issued
    to: received
    trigger: Full receipt or line cancellation removes all outstanding units.
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: unknown
    source: >-
      services-commerce:modules/purchasing/services/persistence/purchase-orders.ts:cancelPurchaseOrderLineQuantity
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-013
    from: partially_received
    to: closed
    trigger: Staff conclude a partly received order.
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: unknown
    source: >-
      services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#closes
      an issued order after 90 of 100: cancelled_quantity 10, status closed; cancelling it instead is refused
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-013
    from: issued
    to: closed
    trigger: Staff conclude an issued order.
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: unknown
    source: 'services-commerce:modules/purchasing/services/persistence/purchase-orders.ts:closePurchaseOrder'
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-013
    from: received
    to: closed
    trigger: Staff conclude a fully received order.
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: unknown
    source: 'services-commerce:modules/purchasing/services/persistence/purchase-orders.ts:closePurchaseOrder'
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-013
    from: draft
    to: cancelled
    trigger: Staff end a draft stock order.
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: unknown
    source: 'services-commerce:modules/purchasing/services/persistence/purchase-orders.ts:cancelPurchaseOrder'
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-013
    from: issued
    to: cancelled
    trigger: Staff end an issued stock order without delivery.
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: unknown
    source: 'services-commerce:modules/purchasing/services/persistence/purchase-orders.ts:cancelPurchaseOrder'
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
invariant_coverage:
  - invariant: INV-DOM-COM-ORD-006-01
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: unknown
    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
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-006-02
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: unknown
    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
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-006-03
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: unknown
    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
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-006-04
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: unknown
    source: >-
      services-commerce:modules/purchasing/db/inventory-cost-layers.table.ts:inventory_cost_layers_remaining_check,
      inventory_cost_layers_receipt_line_check
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-006-05
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: unknown
    source: 'services-commerce:modules/purchasing/db/cost-relief.table.ts:cost_relief_total_check'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-006-06
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: unknown
    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
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-006-07
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: unknown
    source: >-
      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
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-006-08
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: unknown
    source: >-
      services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#refuses a receipt against the
      received order 409, a receipt line with no quantity 400, and the vendor’s delete 409
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-006-09
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: unknown
    source: >-
      services-commerce:modules/purchasing/tests/e2e/purchasing.e2e.spec.js#replaces the draft at the version
      read with the record exactly as it was read, read-only line columns included, and answers the same lines
      one version on
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-006-10
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: unknown
    source: >-
      services-commerce:modules/purchasing/db/purchase-orders.table.ts:purchase_orders_closed_check,
      purchase_orders_cancelled_check
    note: Broader invariant coverage remains open beyond the concrete examples.
workflow_coverage:
  - workflow: WF-COM-ORD-013
    scenarios:
      - ATS-COM-ORD-016-13
    gap: FND-COM-ORD-075
    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'
  - workflow: WF-COM-ORD-015
    scenarios:
      - ATS-COM-ORD-018-18
    gap: FND-COM-ORD-075
    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
  - workflow: WF-COM-ORD-016
    scenarios: []
    gap: FND-COM-ORD-075
    provenance: proposed
    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
      - >-
        services-commerce:modules/purchasing/tests/integration/services/receiving/purchasing-flow.integration.spec.js#restores
        the LIFO relief at its recorded costs and places: each relief reversed, the layers dated with the
        originals, a restore_cogs of 14000
      - >-
        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
      - 'services-commerce:modules/purchasing/services/cost/transfer-cost.ts'
      - >-
        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/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
interaction_coverage:
  - with: CAP-COM-ORD-016
    scenarios:
      - ATS-COM-ORD-018-17
unproved_rules: []
---

# Receive inventory and retain its cost: Capability Test Specification

## Coverage

| Rule | Scenario or finding |
|---|---|
| `BR-CAP-COM-ORD-018-01` | `ATS-COM-ORD-018-01`, `ATS-COM-ORD-018-18` |
| `BR-CAP-COM-ORD-018-02` | `ATS-COM-ORD-018-02` |
| `BR-CAP-COM-ORD-018-03` | `ATS-COM-ORD-018-03` |
| `BR-CAP-COM-ORD-018-04` | `ATS-COM-ORD-018-04` |
| `BR-CAP-COM-ORD-018-05` | `ATS-COM-ORD-018-05` |
| `BR-CAP-COM-ORD-018-06` | `ATS-COM-ORD-018-06` |
| `BR-CAP-COM-ORD-018-07` | `ATS-COM-ORD-018-07` |
| `BR-CAP-COM-ORD-018-08` | `ATS-COM-ORD-018-08`, `ATS-COM-ORD-018-17` |
| `BR-CAP-COM-ORD-018-09` | `ATS-COM-ORD-018-09` |
| `BR-CAP-COM-ORD-018-10` | `ATS-COM-ORD-018-10` |
| `BR-CAP-COM-ORD-018-11` | `ATS-COM-ORD-018-11` |
| `BR-CAP-COM-ORD-018-12` | `ATS-COM-ORD-018-12` |
| `BR-CAP-COM-ORD-018-13` | `ATS-COM-ORD-018-16` |
| `BR-CAP-COM-ORD-018-14` | `ATS-COM-ORD-018-14` |
| `BR-CAP-COM-ORD-018-15` | `ATS-COM-ORD-018-15` |

## Interactions With Related Capabilities

Returned goods restore their original acquisition cost. A shipped line has identified layer relief and a receipt-based return authorization. Receive part of the goods and then the remainder; inspect cost restoration and settlement.

Crossing workflow examples also cover preparation, commitment and recovery at their service handoffs. Their structured bindings distinguish specified outcomes from executable evidence.
