---
id: JNY-COM-ORD-004
title: A void releases an unfinished purchase
feature: FEAT-COM-ORD-02
product_area: commerce
module: orders
revision: 1
status: draft
product_intent: confirmed
implementation_evidence: observed
supersedes:
  - COM-ACC-0297
  - COM-ACC-0298
  - COM-ACC-0299
  - COM-ACC-0300
  - COM-ACC-0313
  - COM-ACC-0863
source_sha:
  services-commerce: c8b66a98e2490617aec38ba5c8165dd9bd0a8f9b
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
actor: ACT-COM-016
goal: 'Clear a purchase before acceptance and release its inventory, promotion usage and any partial payment.'
capabilities:
  - CAP-COM-ORD-005
  - CAP-COM-ORD-008
  - CAP-COM-ORD-010
screens:
  - '/console/{tenantId}/orders/{orderId}'
  - '/console/{tenantId}/orders'
steps:
  - 'n': 1
    surface: placeCheckout
    action: 'Place the duplicate phone purchase containing two mugs and a single-use promotion, then leave it unpaid.'
    capability: CAP-COM-ORD-005
    expected: The placed purchase holds the inventory units and consumes the promotion use.
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#places one order with four
      lines, each purchase freezing its claims: the converted hold, the capacity claim, none, the lease
  - 'n': 2
    surface: '/console/{tenantId}/orders/{orderId}'
    action: Choose Void Order and enter Duplicate as the reason.
    capability: CAP-COM-ORD-008
    expected: The purchase becomes voided and its history records the intervention reason.
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/order-void.e2e.spec.js#answers 200 with the order voided,
      carrying the reason, its lines and the history
  - 'n': 3
    surface: voidOrder
    action: Allow the void work to release the purchase’s resources.
    capability: CAP-COM-ORD-008
    expected: 'The mugs become available, the promotion use is released and the pro forma is removed.'
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/order-void.e2e.spec.js#released the participant’s claim,
      the ledger and the obligations
  - 'n': 4
    surface: '/console/{tenantId}/orders'
    action: Inspect the purchase in the Orders table.
    capability: CAP-COM-ORD-010
    expected: It appears voided with no balance and does not count as unpaid.
    provenance: test
    source: >-
      react-console:components/commerce/orders/__tests__/orders-list-screen.test.tsx#marks a voided order's
      balance as none rather than zero
alternates:
  - from_step: 2
    condition: Staff leave the purchase unattended
    path: The minute sweep clears it at the end of its tender window
    outcome: The system records the void and performs the release
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/integration/services/orders/tender-window-sweeper.integration.spec.js#voided
      each in its own tenant: the reason tender_window_expired, the reservation released, the obligation
      cancelled, the history told by the system
  - from_step: 2
    condition: The purchase has partial card and store-credit funding
    path: Refund the card leg before crediting the invoice and restoring store credit
    outcome: The funding is returned through its original paths without repetition
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#ran the plan through the
      adjustment worker: the card leg refunded under the void’s key, then the memo of the sale invoice
failures:
  - from_step: 2
    condition: A caller tries to void an already voided purchase
    path: Reject the repeated void request
    outcome: The purchase remains voided
    provenance: test
    source: >-
      services-commerce:modules/checkout/tests/e2e/order-void.e2e.spec.js#refuses a second void, 409
      order_not_voidable, and a read answers the order voided
rules_in_play:
  - BR-CAP-COM-ORD-008-01
  - BR-CAP-COM-ORD-008-02
  - BR-CAP-COM-ORD-008-03
  - BR-CAP-COM-ORD-008-04
  - BR-CAP-COM-ORD-008-05
  - BR-CAP-COM-ORD-008-06
  - BR-CAP-COM-ORD-008-07
  - BR-CAP-COM-ORD-008-08
  - BR-CAP-COM-ORD-010-03
assertions:
  - id: AS-JNY-COM-ORD-004-01
    statement: Released inventory units and promotion usage are available to a subsequent buyer.
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/integration/services/placement/promotion-placement.integration.spec.js#gives
      both counters back
  - id: AS-JNY-COM-ORD-004-02
    statement: Accounting no longer retains the voided purchase’s pro forma invoice.
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#deletes the pro forma in
      Accounting and records it on the history
  - id: AS-JNY-COM-ORD-004-03
    statement: The refund plan returns each partial payment once.
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#refunds nothing twice: a
      second void is 409, a re-run of the plan sends nothing and a replayed request answers the same plan
e2e_policy: optional
e2e_reason: >-
  API evidence proves release and financial reversal; the console component tests cover the reason required by
  the void dialog.
evidence:
  - >-
    Examined reference: react-console:components/commerce/orders/__tests__/orders-list-screen.test.tsx#marks a
    voided order's balance as none rather than zero
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/holds-and-claims.e2e.spec.js#places one
    order with four lines, each purchase freezing its claims: the converted hold, the capacity claim, none,
    the lease
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/order-void.e2e.spec.js#answers 200 with
    the order voided, carrying the reason, its lines and the history
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/order-void.e2e.spec.js#refuses a second
    void, 409 order_not_voidable, and a read answers the order voided
  - >-
    Examined reference: services-commerce:modules/checkout/tests/e2e/order-void.e2e.spec.js#released the
    participant’s claim, the ledger and the obligations
  - >-
    Examined reference: services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#deletes the
    pro forma in Accounting and records it on the history
  - >-
    Examined reference: services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#ran the plan
    through the adjustment worker: the card leg refunded under the void’s key, then the memo of the sale
    invoice
  - >-
    Examined reference: services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#refunds
    nothing twice: a second void is 409, a re-run of the plan sends nothing and a replayed request answers the
    same plan
  - >-
    Examined reference:
    services-commerce:modules/orders/tests/integration/services/orders/tender-window-sweeper.integration.spec.js#voided
    each in its own tenant: the reason tender_window_expired, the reservation released, the obligation
    cancelled, the history told by the system
  - >-
    Examined reference:
    services-commerce:modules/orders/tests/integration/services/placement/promotion-placement.integration.spec.js#gives
    both counters back
proved_by: []
---
# A void releases an unfinished purchase

## Story

An administrator finds a duplicate phone purchase that has not been accepted. They record the reason for clearing it, then inspect its voided result. The purchasing resources become available again and the related financial work clears the invoice or returns partial funding.
