---
id: TST-COM-ORD-126
title: InvoiceRequestOf
kind: unit
product_area: commerce
module: orders
revision: 1
status: draft
source_sha:
  services-commerce: c8b66a98e2490617aec38ba5c8165dd9bd0a8f9b
repository: services-commerce
files:
  - modules/orders/tests/unit/billing/invoice-request.spec.js
implements:
  - ATS-COM-ORD-006-04
  - ATS-COM-ORD-006-05
  - ATS-COM-ORD-006-06
environment: mock
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 1
isolation: 'The suite owns its in-memory inputs, scripted responses and rendered component state.'
evidence:
  - provenance: test
    source: 'services-commerce:modules/orders/tests/unit/billing/invoice-request.spec.js'
    test_cases:
      - 'sends the header Accounting needs, from Commerce, for the order'
      - sends the line at its unit price and quantity with a zero discount and no discount product
      - 'sends a line that ships as one, and the ship-to address when the order names one (contracts 0.3.0)'
      - names no discount reason for a line without an allocation
      - 'bills a terms order real, with the settings’ payment terms and the purchase order number'
      - bills a pay-now order real when the settings turn pro forma invoices off
      - sends the gross unit price 45000 and the discount 2500 on the line
      - names the promotion by its public name and number as the discount reason
      - gives a net amount of 42500 by Accounting’s generated column rule
      - 'expects the header’s subtotal 45000, discount total 2500 and total 42500'
      - passes J1’s tax of 3188 through as a line on the tax product with no discount
      - sends no tax line and expects the lines’ net total with the quoted tax beside it
      - leaves a tax line of the zone-table days out of the body rather than have Accounting tax the tax
      - still holds the order’s total to the net lines plus the quoted tax
      - answers the tax of zero and the order’s total when Commerce bills the tax as a line (the default)
      - sends each line at 10000 gross with 1000 off
      - 'sends no negative line and expects the order’s 30000, 3000 and 27000'
      - 'writes the lines in the order’s position order, whatever order they are given in'
      - names both promotions in the order they were applied
      - 'sends the line’s whole discount, 4700, for a net of 15300'
      - names the settings’ discount product on a discounted line
      - names no discount product when the settings name none
      - names no discount product on an undiscounted line even when the settings name one
      - 'refuses an order with a discount line, 409 discount_line_not_billable, naming the line'
      - 'refuses an order discount its lines do not carry, 409 unallocated_order_discount, with both figures'
      - 'refuses a fee no fee line carries, 409 unbilled_order_charge, naming the kind'
      - throws for a line whose discount exceeds its extension
      - throws for a line whose total is not its extension less its discount
      - throws for a line discount its allocations do not sum to
      - throws for an allocation naming a line of another order
      - throws for a discount on a tax line
      - throws when the invoice’s subtotal is not the order’s
      - throws when the invoice’s total is not the order’s
      - throws when the lines carry more discount than the order
      - 'admits a migrated line’s discount without allocations (a Rhythm 1.0 inline coupon), naming no reason'
      - 'reads card_fee_policy back (the ordering profile’s, D25; the contract’s since 0.3.0)'
      - accepts J1’s body whole
      - accepts J7’s body whole
      - accepts J16’s body whole
      - reads J1’s line back with its discount in minor units
      - 'takes a discount_reason on a line up to 200 characters (0.5.0), so the reason travels in the body'
      - >-
        travels in the discounted line exactly when the installed contract has the field, never as a key it
        would refuse
      - answers the same request under the same idempotency key
      - answers null for a line with no allocation
      - 'joins the promotions'' names in sequence order, then the order-discount share'
      - 'cuts a reason longer than Accounting takes, marked, so the invoice is never refused for it'
scenario_coverage:
  - scenario: ATS-COM-ORD-006-04
    test_cases:
      - 'refuses an order discount its lines do not carry, 409 unallocated_order_discount, with both figures'
      - 'refuses a fee no fee line carries, 409 unbilled_order_charge, naming the kind'
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
  - scenario: ATS-COM-ORD-006-05
    test_cases:
      - 'joins the promotions'' names in sequence order, then the order-discount share'
      - names no discount reason for a line without an allocation
      - 'cuts a reason longer than Accounting takes, marked, so the invoice is never refused for it'
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
  - scenario: ATS-COM-ORD-006-06
    test_cases:
      - 'sends no negative line and expects the order’s 30000, 3000 and 27000'
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
dependency_evidence:
  provenance: test
  source: 'services-commerce:modules/orders/tests/unit/billing/invoice-request.spec.js'
  declared_by_test: 'the function, Accounting''s contract schema. Doubled: nothing (the inputs are literals).'
---

# InvoiceRequestOf

## Verification Boundary

The unit suite checks the named contract or helper with controlled inputs.

## What This Suite Proves

The registered cases check invoiceRequestOf with their fixture records and assertions. Scenario bindings name only the examples those cases exercise.

## What It Does Not Prove

A registered file supplies no run result or verified conformance by itself. Local fixtures do not establish deployed cross-service behavior or complete browser journeys.

## Real Dependencies and Test Doubles

Inputs and external responses are controlled in process; this suite establishes no deployed service behavior.

## Must Not Be Doubled

The named contract validation or component behavior under assertion must use its actual implementation.
