---
id: ATS-COM-ORD-015
scope: CAP-COM-ORD-015
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-015-01
    title: Remaining-term upgrade places the net difference
    level: api
    proves:
      - BR-CAP-COM-ORD-015-01
    preconditions: >-
      A three-hundred-dollar annual purchase has six months left and replacement annual price is four hundred
      fifty dollars.
    steps:
      - do: Evaluate and execute its upgrade.
        provenance: test
        source: >-
          services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#prorates by remaining months (six
          of twelve): $150.00 unused, $225.00 for the rest of the term, net $75.00 charged
    expected: >-
      The unused value is 150, replacement remaining value 225 and the linked order charges 75 using the
      original parties.
    negative: false
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#prorates by remaining months (six of
        twelve): $150.00 unused, $225.00 for the rest of the term, net $75.00 charged
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#placed the change order under the
        amendment: the original’s parties, one premium line at the remaining value, billed, placed
      - TST-COM-ORD-072
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#prorates by remaining months (six of
      twelve): $150.00 unused, $225.00 for the rest of the term, net $75.00 charged
    category: rule
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#prorates by remaining months (six of
      twelve): $150.00 unused, $225.00 for the rest of the term, net $75.00 charged
  - id: ATS-COM-ORD-015-02
    title: Replacement delivery completes the amendment
    level: api
    proves:
      - BR-CAP-COM-ORD-015-02
    preconditions: An executed upgrade still waits for its change-order payment.
    steps:
      - do: Pay the change order and process its application delivery.
        provenance: test
        source: >-
          services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#marked the original line amended
          with its successor (nothing to fence: the type claims nothing), and wrote a modify obligation
          superseding the delivered fulfilment
    expected: The original delivery is superseded and the replacement completion closes the amendment.
    negative: false
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#marked the original line amended
        with its successor (nothing to fence: the type claims nothing), and wrote a modify obligation
        superseding the delivered fulfilment
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#completes once the buyer’s card
        accepts the change order and the worker delivers the modify: the original fulfilment superseded
      - TST-COM-ORD-072
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#marked the original line amended with
      its successor (nothing to fence: the type claims nothing), and wrote a modify obligation superseding the
      delivered fulfilment
    category: transition
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#marked the original line amended with
      its successor (nothing to fence: the type claims nothing), and wrote a modify obligation superseding the
      delivered fulfilment
  - id: ATS-COM-ORD-015-03
    title: Downgrade credit accepts without a new payment
    level: api
    proves:
      - BR-CAP-COM-ORD-015-03
    preconditions: The six-month remaining values produce a seventy-five-dollar decrease.
    steps:
      - do: Execute the downgrade.
        provenance: test
        source: >-
          services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#credits $225.00 unused against
          $150.00 new: net −$75.00 as a credit; the change order accepted at once, the document executing
    expected: The document carries a negative difference and accepts the change order using the credit treatment.
    negative: false
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#credits $225.00 unused against
        $150.00 new: net −$75.00 as a credit; the change order accepted at once, the document executing
      - TST-COM-ORD-072
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#credits $225.00 unused against $150.00
      new: net −$75.00 as a credit; the change order accepted at once, the document executing
    category: edge
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#credits $225.00 unused against $150.00
      new: net −$75.00 as a credit; the change order accepted at once, the document executing
  - id: ATS-COM-ORD-015-04
    title: Change settlement includes both tax shares
    level: api
    proves:
      - BR-CAP-COM-ORD-015-04
    preconditions: Original and replacement purchases use eight-and-a-quarter-percent tax.
    steps:
      - do: Evaluate taxed upgrade and downgrade fixtures.
        provenance: test
        source: >-
          services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#shows the tax on both sides in the
          plan: $18.56 on the new value, $12.38 of the original tax unused, the net $81.18
    expected: >-
      The upgrade uses 18.56 new tax and 12.38 unused tax for 81.18 due; the downgrade retains its
      demonstrated tax-inclusive credit.
    negative: false
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#shows the tax on both sides in the
        plan: $18.56 on the new value, $12.38 of the original tax unused, the net $81.18
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#placed the change order taxed: the
        tax on the change line and the header, a tax line on the tax product, the quote frozen
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#refunds a downgrade’s unused tax
        share less the new value’s tax: −$81.19, the change order accepted with nothing to pay
      - TST-COM-ORD-072
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#shows the tax on both sides in the
      plan: $18.56 on the new value, $12.38 of the original tax unused, the net $81.18
    category: boundary
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#shows the tax on both sides in the
      plan: $18.56 on the new value, $12.38 of the original tax unused, the net $81.18
  - id: ATS-COM-ORD-015-05
    title: Application review controls permitted changes
    level: api
    proves:
      - BR-CAP-COM-ORD-015-05
    preconditions: One application refuses a change and another requests approval.
    steps:
      - do: 'Submit each change, attempt overlap and approve and execute the held case.'
        provenance: test
        source: >-
          services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#rejects a change the participant
          refuses, with its problem, and leaves the line open
    expected: Refusal preserves the original line and the held request blocks overlap until permitted execution.
    negative: false
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#rejects a change the participant
        refuses, with its problem, and leaves the line open
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#holds a change the participant wants
        approved; a second request on the line is 409; the approver approves, staff execute
      - TST-COM-ORD-072
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#rejects a change the participant
      refuses, with its problem, and leaves the line open
    category: concurrency
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#rejects a change the participant
      refuses, with its problem, and leaves the line open
  - id: ATS-COM-ORD-015-06
    title: Invalid amendment targets and callers are refused
    level: api
    proves:
      - BR-CAP-COM-ORD-015-06
    preconditions: 'Fixtures include a change order, unknown product and unauthorized contexts.'
    steps:
      - do: Request changes through the corresponding cases.
        provenance: test
        source: >-
          services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#refuses a change order itself (409
          order_not_amendable), an unknown product (409 product_not_found), another member, a reader and
          another tenant
    expected: >-
      The responses identify invalid order or product and reject other-party, reader and cross-workspace
      access.
    negative: true
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#refuses a change order itself (409
        order_not_amendable), an unknown product (409 product_not_found), another member, a reader and another
        tenant
      - TST-COM-ORD-072
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#refuses a change order itself (409
      order_not_amendable), an unknown product (409 product_not_found), another member, a reader and another
      tenant
    category: permission
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#refuses a change order itself (409
      order_not_amendable), an unknown product (409 product_not_found), another member, a reader and another
      tenant
  - id: ATS-COM-ORD-015-07
    title: A later code adjusts paid or terms money
    level: api
    proves:
      - BR-CAP-COM-ORD-015-07
    preconditions: A paid order and unpaid terms order can receive the same eligible code.
    steps:
      - do: Apply it with a reason and exercise missing-reason and missing-permission cases.
        provenance: test
        source: >-
          services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#answers 200 with
          the apply_promotion amendment completed, its plan on the document, its net owed to the buyer
    expected: >-
      The completed discount creates the appropriate credit or refund, while invalid requests fail before
      adjustment.
    negative: false
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#answers 200 with the
        apply_promotion amendment completed, its plan on the document, its net owed to the buyer
      - >-
        services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#sends the memo to the
        fixture Accounting per invoice line, then the refund of what it freed, under the amendment’s keys
      - >-
        services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#completes the
        amendment with the memo alone: the balance reduced by 250, nothing refunded or credited
      - >-
        services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#refuses a missing
        reason 400, a clerk without the key 403 permission_missing, a portal member 403, another tenant 404
      - TST-COM-ORD-074
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#answers 200 with the
      apply_promotion amendment completed, its plan on the document, its net owed to the buyer
    category: interaction
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#answers 200 with the
      apply_promotion amendment completed, its plan on the document, its net owed to the buyer
  - id: ATS-COM-ORD-015-08
    title: Stored Standard price enables after-sale comparison
    level: api
    proves:
      - BR-CAP-COM-ORD-015-08
    preconditions: >-
      The member item costs eighteen dollars with a twenty-five-dollar Standard basis; an older order lacks
      that basis.
    steps:
      - do: Apply non-combining and combining offers and try the older order.
        provenance: test
        source: >-
          services-commerce:modules/orders/tests/e2e/promotion-alternatives.e2e.spec.js#applies STD30 after
          placement on the lower of her $18.00 and the Standard $25.00 less 30 %, $17.50: she saves $0.50, not
          both
    expected: >-
      The demonstrated savings are fifty cents or four dollars fifty, while the missing-basis order is
      refused.
    negative: false
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/orders/tests/e2e/promotion-alternatives.e2e.spec.js#applies STD30 after
        placement on the lower of her $18.00 and the Standard $25.00 less 30 %, $17.50: she saves $0.50, not
        both
      - >-
        services-commerce:modules/orders/tests/e2e/promotion-alternatives.e2e.spec.js#applies YES25, which
        combines, to her Member price: 25 % of $18.00 is $4.50, $13.50
      - >-
        services-commerce:modules/orders/tests/e2e/promotion-alternatives.e2e.spec.js#refuses STD30 for an
        order placed before the Standard price was stored, with the staff message
      - TST-COM-ORD-083
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/e2e/promotion-alternatives.e2e.spec.js#applies STD30 after
      placement on the lower of her $18.00 and the Standard $25.00 less 30 %, $17.50: she saves $0.50, not
      both
    category: validation
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/orders/tests/e2e/promotion-alternatives.e2e.spec.js#applies STD30 after
      placement on the lower of her $18.00 and the Standard $25.00 less 30 %, $17.50: she saves $0.50, not
      both
  - id: ATS-COM-ORD-015-09
    title: Rejected after-sale codes leave money unchanged
    level: api
    proves:
      - BR-CAP-COM-ORD-015-09
    preconditions: 'Offers are already used, exhausted, non-qualifying or unknown.'
    steps:
      - do: Attempt each after-sale application.
        provenance: test
        source: >-
          services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#refuses the same
          code again 409 promotion_refused, already_applied, the second document rejected and nothing moved
    expected: The rejected document records its reason without redemption or financial movement.
    negative: true
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#refuses the same code
        again 409 promotion_refused, already_applied, the second document rejected and nothing moved
      - >-
        services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#refuses an exhausted
        code code_exhausted, after its one use on another order, with nothing written but the rejected
        document
      - >-
        services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#refuses a code that
        applies to none of the lines nothing_qualifies, with the staff message
      - >-
        services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#refuses a code the
        tenant does not have code_not_found
      - TST-COM-ORD-074
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#refuses the same code
      again 409 promotion_refused, already_applied, the second document rejected and nothing moved
    category: validation
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#refuses the same code
      again 409 promotion_refused, already_applied, the second document rejected and nothing moved
  - id: ATS-COM-ORD-015-10
    title: Proration variants honor their date and value basis
    level: unit
    proves:
      - BR-CAP-COM-ORD-015-13
    preconditions: 'Inputs cover daily and monthly terms, alternative value bases and invalid effective dates.'
    steps:
      - do: Calculate the supported methods and refusal cases.
        provenance: test
        source: >-
          services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#leaves July out after its
          15th: 5 of 12, unused 5000, new 6250, net 1250
    expected: >-
      The bindings prove the fifteenth-day rule, full-term and difference cases, suppressed-money cases,
      positive-net fee minimum and invalid time calculations.
    negative: false
    data_needs: Use the controlled records and transports established by the cited tests.
    bound_to:
      - >-
        services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#leaves July out after its
        15th: 5 of 12, unused 5000, new 6250, net 1250
      - >-
        services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#full_difference credits no
        time and charges the whole difference; a negative difference is credited whole
      - >-
        services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#new_full_term credits the
        unused value by the days and charges the new price in full
      - >-
        services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#no_charge and no_refund move
        no money
      - >-
        services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#applies the minimum upgrade
        fee to a positive net only
      - >-
        services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#refuses an effective date
        before the start or after the end, a lifetime term under a time method, and a method with no term
      - >-
        services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#prorates by remaining days:
        183 of 365, unused 6016, new 7521, net 1505
      - >-
        services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#billing_periods counts the
        term’s months until a plan carries periods
      - >-
        services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#C4: a $90 promotional
        purchase under original_price credits 4500 and nets 3000; under standard_price 6000 and 1500
      - TST-COM-ORD-123
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#leaves July out after its 15th:
      5 of 12, unused 5000, new 6250, net 1250
    category: boundary
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#leaves July out after its 15th:
      5 of 12, unused 5000, new 6250, net 1250
  - id: ATS-COM-ORD-015-11
    title: Withdrawing a prepared change keeps the original purchase open
    category: transition
    level: api
    proves:
      - BR-CAP-COM-ORD-015-11
    preconditions: A member has an approved unexecuted change.
    steps:
      - do: Withdraw it and inspect the original line.
        provenance: test
        source: >-
          services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#lets the member withdraw an
          approved, unexecuted change; the line stays open
    expected: The change is withdrawn and the original line remains open.
    negative: false
    data_needs: Use an isolated workspace with the records and responses named in the preconditions.
    bound_to:
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#lets the member withdraw an
        approved, unexecuted change; the line stays open
      - TST-COM-ORD-072
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#lets the member withdraw an approved,
      unexecuted change; the line stays open
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#lets the member withdraw an approved,
      unexecuted change; the line stays open
  - id: ATS-COM-ORD-015-12
    title: A void releases a later promotion redemption
    category: interaction
    level: api
    proves:
      - BR-CAP-COM-ORD-015-12
    preconditions: An unaccepted order carries an after-sale promotion redemption.
    steps:
      - do: Void it and inspect the redemption.
        provenance: test
        source: >-
          services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#releases the
          amendment’s redemption order_voided, as the void releases a placement’s
    expected: The redemption records release for the order void.
    negative: false
    data_needs: Use an isolated workspace with the records and responses named in the preconditions.
    bound_to:
      - >-
        services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#releases the
        amendment’s redemption order_voided, as the void releases a placement’s
      - TST-COM-ORD-074
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#releases the
      amendment’s redemption order_voided, as the void releases a placement’s
    expected_provenance: test
    expected_source: >-
      services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#releases the
      amendment’s redemption order_voided, as the void releases a placement’s
  - id: ATS-COM-ORD-015-13
    title: A later code extends the sale’s retained discount history
    category: interaction
    level: api
    proves:
      - BR-CAP-COM-ORD-004-06
      - BR-CAP-COM-ORD-015-07
    preconditions: An accepted sale carries an earlier offer and qualifies for a distinct combinable offer.
    steps:
      - do: Apply the later offer with authorized staff and inspect both allocations and credit.
        provenance: proposed
        source:
          - >-
            services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#takes one use of the code and
            of the promotion
          - >-
            services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#answers 200 with
            the apply_promotion amendment completed, its plan on the document, its net owed to the buyer
    expected: The earlier allocation remains and the later saving has its own amendment and financial adjustment.
    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/checkout/tests/e2e/promotions.e2e.spec.js#takes one use of the code and of
        the promotion
      - >-
        services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#answers 200 with the
        apply_promotion amendment completed, its plan on the document, its net owed to the buyer
    exercises:
      - CAP-COM-ORD-015
      - CAP-COM-ORD-004
    related_capabilities:
      - CAP-COM-ORD-004
    expected_provenance: proposed
    expected_source:
      - >-
        services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#takes one use of the code and of
        the promotion
      - >-
        services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#answers 200 with the
        apply_promotion amendment completed, its plan on the document, its net owed to the buyer
  - id: ATS-COM-ORD-015-14
    title: Independent change documents need an explicit cross-kind conflict decision
    category: interaction
    level: api
    proves:
      - BR-CAP-COM-ORD-014-07
      - BR-CAP-COM-ORD-015-05
    preconditions: An approved cancellation occupies a line that also supports amendment.
    steps:
      - do: 'Request an amendment before executing the cancellation, then try executing both.'
        provenance: proposed
        source:
          - >-
            services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#holds staff’s request for
            approval (participant_requires_approval) and refuses a second request on the line 409
            line_already_cancelling (B38)
          - >-
            services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#holds a change the participant
            wants approved; a second request on the line is 409; the approver approves, staff execute
          - FND-COM-ORD-071
    expected: Record whether one operation refuses or both proceed; the cross-kind policy needs a product decision.
    negative: true
    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/cancellations.e2e.spec.js#holds staff’s request for
        approval (participant_requires_approval) and refuses a second request on the line 409
        line_already_cancelling (B38)
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#holds a change the participant wants
        approved; a second request on the line is 409; the approver approves, staff execute
      - FND-COM-ORD-071
    exercises:
      - CAP-COM-ORD-015
      - CAP-COM-ORD-014
    related_capabilities:
      - CAP-COM-ORD-014
    intent_question: FND-COM-ORD-071
    expected_provenance: proposed
    expected_source:
      - >-
        services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#holds staff’s request for
        approval (participant_requires_approval) and refuses a second request on the line 409
        line_already_cancelling (B38)
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#holds a change the participant wants
        approved; a second request on the line is 409; the approver approves, staff execute
      - FND-COM-ORD-071
    note: >-
      Exploratory coverage only: this scenario records the undefined cross-kind outcome instead of asserting a
      mutual-exclusion promise.
  - id: ATS-COM-ORD-015-15
    title: Replacement payment determines amendment completion
    category: interaction
    level: api
    proves:
      - BR-CAP-COM-ORD-015-01
      - BR-CAP-COM-ORD-005-01
      - BR-CAP-COM-ORD-006-01
      - BR-CAP-COM-ORD-007-01
    preconditions: An accepted purchase supports a positive-price upgrade.
    steps:
      - do: 'Execute the change, pay its linked replacement and deliver the replacement work.'
        provenance: proposed
        source:
          - >-
            services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#refuses a change order itself
            (409 order_not_amendable), an unknown product (409 product_not_found), another member, a reader
            and another tenant
          - >-
            services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#marked the original line amended
            with its successor (nothing to fence: the type claims nothing), and wrote a modify obligation
            superseding the delivered fulfilment
          - >-
            services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#credited the unused value from
            the original payment and applied it to the change invoice; the document awaits the buyer’s tender
          - 'services-commerce:modules/orders/services/amendments/amendment-settlement.ts:onChangeOrderVoided'
          - 'services-commerce:modules/orders/services/orders/accept-order.ts:acceptOrder'
          - >-
            services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#completes once the buyer’s card
            accepts the change order and the worker delivers the modify: the original fulfilment superseded
    expected: >-
      The original is superseded only through the amendment chain and completion follows replacement
      acceptance and delivery.
    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/amendments.e2e.spec.js#refuses a change order itself (409
        order_not_amendable), an unknown product (409 product_not_found), another member, a reader and another
        tenant
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#marked the original line amended
        with its successor (nothing to fence: the type claims nothing), and wrote a modify obligation
        superseding the delivered fulfilment
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#credited the unused value from the
        original payment and applied it to the change invoice; the document awaits the buyer’s tender
      - 'services-commerce:modules/orders/services/amendments/amendment-settlement.ts:onChangeOrderVoided'
      - 'services-commerce:modules/orders/services/orders/accept-order.ts:acceptOrder'
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#completes once the buyer’s card
        accepts the change order and the worker delivers the modify: the original fulfilment superseded
    exercises:
      - CAP-COM-ORD-015
      - CAP-COM-ORD-005
      - CAP-COM-ORD-006
      - CAP-COM-ORD-007
    workflows:
      - WF-COM-ORD-011
    expected_provenance: proposed
    expected_source:
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#refuses a change order itself (409
        order_not_amendable), an unknown product (409 product_not_found), another member, a reader and another
        tenant
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#marked the original line amended
        with its successor (nothing to fence: the type claims nothing), and wrote a modify obligation
        superseding the delivered fulfilment
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#credited the unused value from the
        original payment and applied it to the change invoice; the document awaits the buyer’s tender
      - 'services-commerce:modules/orders/services/amendments/amendment-settlement.ts:onChangeOrderVoided'
      - 'services-commerce:modules/orders/services/orders/accept-order.ts:acceptOrder'
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#completes once the buyer’s card
        accepts the change order and the worker delivers the modify: the original fulfilment superseded
  - id: ATS-COM-ORD-015-16
    title: A later offer settles against the preserved sale basis
    category: interaction
    level: api
    proves:
      - BR-CAP-COM-ORD-015-01
      - BR-CAP-COM-ORD-004-01
    preconditions: An accepted order retains its Standard price and earlier discount allocations.
    steps:
      - do: Apply a qualifying later code and replay its money adjustment.
        provenance: proposed
        source:
          - 'services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js'
          - 'services-commerce:modules/orders/tests/e2e/promotion-alternatives.e2e.spec.js'
          - 'services-commerce:modules/orders/services/amendments/promotion-amendment.ts'
          - 'services-commerce:modules/orders/services/adjustments/resume-adjustments.ts'
    expected: The resulting amendment credits the evaluated saving once and retains the original sale basis.
    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/apply-promotion-amendment.e2e.spec.js'
      - 'services-commerce:modules/orders/tests/e2e/promotion-alternatives.e2e.spec.js'
      - 'services-commerce:modules/orders/services/amendments/promotion-amendment.ts'
      - 'services-commerce:modules/orders/services/adjustments/resume-adjustments.ts'
    exercises:
      - CAP-COM-ORD-015
      - CAP-COM-ORD-004
    workflows:
      - WF-COM-ORD-012
    expected_provenance: proposed
    expected_source:
      - 'services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js'
      - 'services-commerce:modules/orders/tests/e2e/promotion-alternatives.e2e.spec.js'
      - 'services-commerce:modules/orders/services/amendments/promotion-amendment.ts'
      - 'services-commerce:modules/orders/services/adjustments/resume-adjustments.ts'
evidence:
  - >-
    Examined reference: services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#completes once the
    buyer’s card accepts the change order and the worker delivers the modify: the original fulfilment
    superseded
  - >-
    Examined reference: services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#credits $225.00
    unused against $150.00 new: net −$75.00 as a credit; the change order accepted at once, the document
    executing
  - >-
    Examined reference: services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#holds a change the
    participant wants approved; a second request on the line is 409; the approver approves, staff execute
  - >-
    Examined reference: services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#marked the original
    line amended with its successor (nothing to fence: the type claims nothing), and wrote a modify obligation
    superseding the delivered fulfilment
  - >-
    Examined reference: services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#placed the change
    order taxed: the tax on the change line and the header, a tax line on the tax product, the quote frozen
  - >-
    Examined reference: services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#placed the change
    order under the amendment: the original’s parties, one premium line at the remaining value, billed, placed
  - >-
    Examined reference: services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#prorates by
    remaining months (six of twelve): $150.00 unused, $225.00 for the rest of the term, net $75.00 charged
  - >-
    Examined reference: services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#refunds a
    downgrade’s unused tax share less the new value’s tax: −$81.19, the change order accepted with nothing to
    pay
  - >-
    Examined reference: services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#refuses a change
    order itself (409 order_not_amendable), an unknown product (409 product_not_found), another member, a
    reader and another tenant
  - >-
    Examined reference: services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#rejects a change the
    participant refuses, with its problem, and leaves the line open
  - >-
    Examined reference: services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#shows the tax on
    both sides in the plan: $18.56 on the new value, $12.38 of the original tax unused, the net $81.18
  - >-
    Examined reference:
    services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#answers 200 with the
    apply_promotion amendment completed, its plan on the document, its net owed to the buyer
  - >-
    Examined reference:
    services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#completes the amendment
    with the memo alone: the balance reduced by 250, nothing refunded or credited
  - >-
    Examined reference:
    services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#refuses a code that
    applies to none of the lines nothing_qualifies, with the staff message
  - >-
    Examined reference:
    services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#refuses a code the tenant
    does not have code_not_found
  - >-
    Examined reference:
    services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#refuses a missing reason
    400, a clerk without the key 403 permission_missing, a portal member 403, another tenant 404
  - >-
    Examined reference:
    services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#refuses an exhausted code
    code_exhausted, after its one use on another order, with nothing written but the rejected document
  - >-
    Examined reference:
    services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#refuses the same code
    again 409 promotion_refused, already_applied, the second document rejected and nothing moved
  - >-
    Examined reference: services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#sends
    the memo to the fixture Accounting per invoice line, then the refund of what it freed, under the
    amendment’s keys
  - >-
    Examined reference: services-commerce:modules/orders/tests/e2e/promotion-alternatives.e2e.spec.js#applies
    STD30 after placement on the lower of her $18.00 and the Standard $25.00 less 30 %, $17.50: she saves
    $0.50, not both
  - >-
    Examined reference: services-commerce:modules/orders/tests/e2e/promotion-alternatives.e2e.spec.js#applies
    YES25, which combines, to her Member price: 25 % of $18.00 is $4.50, $13.50
  - >-
    Examined reference: services-commerce:modules/orders/tests/e2e/promotion-alternatives.e2e.spec.js#refuses
    STD30 for an order placed before the Standard price was stored, with the staff message
  - >-
    Examined reference: services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#C4: a $90
    promotional purchase under original_price credits 4500 and nets 3000; under standard_price 6000 and 1500
  - >-
    Examined reference: services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#applies the
    minimum upgrade fee to a positive net only
  - >-
    Examined reference:
    services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#billing_periods counts the term’s
    months until a plan carries periods
  - >-
    Examined reference:
    services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#full_difference credits no time
    and charges the whole difference; a negative difference is credited whole
  - >-
    Examined reference: services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#leaves July
    out after its 15th: 5 of 12, unused 5000, new 6250, net 1250
  - >-
    Examined reference: services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#new_full_term
    credits the unused value by the days and charges the new price in full
  - >-
    Examined reference: services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#no_charge and
    no_refund move no money
  - >-
    Examined reference: services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#prorates by
    remaining days: 183 of 365, unused 6016, new 7521, net 1505
  - >-
    Examined reference: services-commerce:modules/orders/tests/unit/amendments/proration.spec.js#refuses an
    effective date before the start or after the end, a lifetime term under a time method, and a method with
    no term
coverage:
  rule: covered
  transition: 'gap: FND-COM-ORD-072'
  validation: covered
  permission: 'gap: FND-COM-ORD-072'
  edge: covered
  failure: 'gap: FND-COM-ORD-072'
  boundary: covered
  concurrency: covered
  invariant: 'gap: FND-COM-ORD-072'
  interaction: 'gap: FND-COM-ORD-071'
coverage_definition: Covered means a design scenario exists; executable coverage and execution results are separate.
permission_coverage:
  - key: commerce.amendments.read
    where_checked: api
    scenarios: []
    gap: FND-COM-ORD-072
    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-072
  - key: commerce.amendments.create
    where_checked: api
    scenarios: []
    gap: FND-COM-ORD-072
    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-072
  - key: commerce.amendments.update
    where_checked: api
    scenarios: []
    gap: FND-COM-ORD-072
    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-072
  - key: commerce.amendments.approve
    where_checked: api
    scenarios: []
    gap: FND-COM-ORD-072
    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-072
  - key: commerce.amendments.override
    where_checked: service
    scenarios: []
    gap: FND-COM-ORD-072
    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-072
  - key: commerce.amendments.apply-promotion
    where_checked: api
    scenarios: []
    gap: FND-COM-ORD-072
    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-072
transition_coverage:
  - state_model: STATE-COM-ORD-010
    from: evaluating
    to: approved
    trigger: Evaluation permits an amendment without approval.
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: 'services-commerce:modules/orders/services/amendments/amendment-workflow.ts:requestAmendment'
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-010
    from: evaluating
    to: rejected
    trigger: Evaluation denies the proposed change or later offer.
    scenarios:
      - ATS-COM-ORD-015-05
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#rejects a change the participant
      refuses, with its problem, and leaves the line open
    note: The cited test exercises this transition; other transitions retain separate gaps.
  - state_model: STATE-COM-ORD-010
    from: awaiting_approval
    to: approved
    trigger: An approver records permission and an explanation.
    scenarios:
      - ATS-COM-ORD-015-05
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#holds a change the participant wants
      approved; a second request on the line is 409; the approver approves, staff execute
    note: The cited test exercises this transition; other transitions retain separate gaps.
  - state_model: STATE-COM-ORD-010
    from: approved
    to: scheduled
    trigger: The permitted change has a future or renewal effective point.
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: 'services-commerce:modules/orders/services/persistence/amendments.ts:AMENDMENT_TRANSITIONS'
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-010
    from: approved
    to: executing
    trigger: The caller starts replacement execution.
    scenarios:
      - ATS-COM-ORD-015-01
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#placed the change order under the
      amendment: the original’s parties, one premium line at the remaining value, billed, placed
    note: The cited test exercises this transition; other transitions retain separate gaps.
  - state_model: STATE-COM-ORD-010
    from: executing
    to: awaiting_tender
    trigger: Replacement credit leaves additional payment outstanding.
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#credited the unused value from the
      original payment and applied it to the change invoice; the document awaits the buyer’s tender
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-010
    from: awaiting_tender
    to: executing
    trigger: Replacement acceptance invokes amendment follow-up.
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: 'services-commerce:modules/orders/services/amendments/amendment-settlement.ts:onChangeOrderAccepted'
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-010
    from: awaiting_tender
    to: voided
    trigger: The replacement sale is voided at its elapsed deadline.
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: 'services-commerce:modules/orders/services/amendments/amendment-settlement.ts:onChangeOrderVoided'
    note: 'Individual examples do not exhaustively prove this transition, its guard and side effects.'
  - state_model: STATE-COM-ORD-010
    from: executing
    to: completed
    trigger: 'Settlement observes accepted replacement, completed modification and settled money.'
    scenarios:
      - ATS-COM-ORD-015-02
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#completes once the buyer’s card
      accepts the change order and the worker delivers the modify: the original fulfilment superseded
    note: The cited test exercises this transition; other transitions retain separate gaps.
  - state_model: STATE-COM-ORD-010
    from: approved
    to: withdrawn
    trigger: The requester ends the approved amendment.
    scenarios:
      - ATS-COM-ORD-015-11
    provenance: test
    source: >-
      services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#lets the member withdraw an approved,
      unexecuted change; the line stays open
    note: The cited test exercises this transition; other transitions retain separate gaps.
invariant_coverage:
  - invariant: INV-DOM-COM-ORD-002-01
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: 'services-commerce:modules/orders/db/orders.table.ts:orders_total_check, orders_amounts_check'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-02
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: >-
      services-commerce:modules/checkout/tests/e2e/idempotency.e2e.spec.js#answers the stored status and body,
      marked Idempotent-Replayed, and runs the placement once: one order row;
      services-commerce:modules/orders/db/orders.table.ts:orders_checkout_uq
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-03
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: 'services-commerce:modules/orders/db/orders.table.ts:orders_number_uq, orders_number_check'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-04
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: 'services-commerce:modules/orders/services/persistence/orders.ts:ORDER_TRANSITIONS'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-05
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: 'services-commerce:modules/orders/db/order-lines.table.ts:order_lines_quantity_check'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-06
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: >-
      services-commerce:modules/orders/db/order-line-purchases.table.ts:order_line_purchases_write_once_trigger
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-07
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: >-
      services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#resumes the same attempt on a
      retry, whatever card the retry names, and moves nothing while the intent is processing
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-08
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: 'services-commerce:modules/orders/db/order-invoices.table.ts:order_invoices_idempotency_key_uq'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-09
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: 'services-commerce:modules/orders/db/order-events.table.ts'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-10
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: 'services-commerce:modules/orders/db/order-lines.table.ts:order_lines_order_fk'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-11
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: 'services-commerce:modules/orders/db/orders.table.ts:orders_installment_schedule_check'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-12
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: >-
      services-commerce:modules/orders/tests/e2e/billing-and-tender.e2e.spec.js#never stores the card: the
      attempt keeps a reference of the merchant account and the token’s last four only
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-002-13
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: >-
      services-commerce:modules/orders/db/reservations.table.ts:reservations_subject_check;
      modules/orders/services/persistence/reservations.ts:RESERVATION_TRANSITIONS
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-005-01
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: >-
      services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#holds staff’s request for approval
      (participant_requires_approval) and refuses a second request on the line 409 line_already_cancelling
      (B38); services-commerce:modules/orders/db/cancellation-lines.table.ts:cancellation_lines_active_uidx;
      services-commerce:modules/orders/db/amendment-lines.table.ts:amendment_lines_active_uidx;
      services-commerce:modules/orders/db/return-lines.table.ts:return_lines_active_uidx
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-005-02
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: >-
      services-commerce:modules/orders/db/cancellations.table.ts:cancellations_override_reason_check;
      modules/orders/db/amendments.table.ts:amendments_override_reason_check;
      modules/orders/db/returns.table.ts:returns_override_reason_check
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-005-03
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: >-
      services-commerce:modules/orders/services/cancellations/cancellation-workflow.ts:requestCancellation;
      services-commerce:modules/orders/services/amendments/amendment-workflow.ts:requestAmendment;
      services-commerce:modules/orders/services/returns/return-workflow.ts:requestReturn;
      services-commerce:modules/orders/services/amendments/promotion-amendment.ts
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-005-04
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: >-
      services-commerce:modules/orders/services/persistence/cancellations.ts:CANCELLATION_TRANSITIONS;
      modules/orders/services/persistence/amendments.ts:AMENDMENT_TRANSITIONS;
      modules/orders/services/persistence/returns.ts:RETURN_TRANSITIONS
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-005-05
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: >-
      services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#credits no more than the invoice
      line still owes, so Accounting does not refuse the memo as an over-application
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-005-06
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: >-
      services-commerce:modules/orders/db/return-policies.table.ts:return_policies_scope_uq,
      return_policies_scope_check
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-005-07
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: 'services-commerce:modules/orders/db/return-authorizations.table.ts:return_authorizations_open_uidx'
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-005-08
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: >-
      services-commerce:modules/orders/services/returns/return-workflow.ts;
      services-commerce:modules/orders/services/persistence/returns.ts:recordReturnEvaluation
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-005-09
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: >-
      services-commerce:modules/orders/tests/e2e/cancellations.e2e.spec.js#is delivered by the worker to the
      participant’s cancel, which settles the document completed and runs the refund after the domain (ADR-13)
    note: Broader invariant coverage remains open beyond the concrete examples.
  - invariant: INV-DOM-COM-ORD-005-10
    scenarios: []
    gap: FND-COM-ORD-072
    provenance: unknown
    source: 'services-commerce:modules/orders/services/persistence/cancellations.ts'
    note: Broader invariant coverage remains open beyond the concrete examples.
workflow_coverage:
  - workflow: WF-COM-ORD-005
    scenarios:
      - ATS-COM-ORD-008-14
    gap: FND-COM-ORD-072
    provenance: proposed
    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
      - 'services-commerce:modules/orders/services/orders/void-refund.ts:voidRefundLegsOf'
      - >-
        services-commerce:modules/checkout/tests/e2e/order-void.e2e.spec.js#released the participant’s claim,
        the ledger and the obligations
      - 'services-commerce:modules/orders/services/orders/void-order.ts:voidOrder'
      - >-
        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
      - 'services-commerce:modules/fulfillment/services/register/intervention-audit.ts:auditIntervention'
  - workflow: WF-COM-ORD-011
    scenarios:
      - ATS-COM-ORD-015-15
    gap: FND-COM-ORD-072
    provenance: proposed
    source:
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#refuses a change order itself (409
        order_not_amendable), an unknown product (409 product_not_found), another member, a reader and another
        tenant
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#marked the original line amended
        with its successor (nothing to fence: the type claims nothing), and wrote a modify obligation
        superseding the delivered fulfilment
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#credited the unused value from the
        original payment and applied it to the change invoice; the document awaits the buyer’s tender
      - 'services-commerce:modules/orders/services/amendments/amendment-settlement.ts:onChangeOrderVoided'
      - 'services-commerce:modules/orders/services/orders/accept-order.ts:acceptOrder'
      - >-
        services-commerce:modules/orders/tests/e2e/amendments.e2e.spec.js#completes once the buyer’s card
        accepts the change order and the worker delivers the modify: the original fulfilment superseded
  - workflow: WF-COM-ORD-012
    scenarios:
      - ATS-COM-ORD-015-16
    gap: FND-COM-ORD-072
    provenance: proposed
    source:
      - 'services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js'
      - 'services-commerce:modules/orders/tests/e2e/promotion-alternatives.e2e.spec.js'
      - 'services-commerce:modules/orders/services/amendments/promotion-amendment.ts'
      - 'services-commerce:modules/orders/services/adjustments/resume-adjustments.ts'
interaction_coverage:
  - with: CAP-COM-ORD-004
    scenarios:
      - ATS-COM-ORD-015-13
  - with: CAP-COM-ORD-014
    scenarios:
      - ATS-COM-ORD-015-14
unproved_rules:
  - rule: BR-CAP-COM-ORD-015-10
    gap: FND-COM-ORD-072
    provenance: unknown
    source: 'services-commerce:docs/milestones/plans/COMM-M2-D10-report.md#Decisions for Andrew / follow-ups'
---

# Amend purchases and settle their price difference: Capability Test Specification

## Coverage

| Rule | Scenario or finding |
|---|---|
| `BR-CAP-COM-ORD-015-01` | `ATS-COM-ORD-015-01`, `ATS-COM-ORD-015-15`, `ATS-COM-ORD-015-16` |
| `BR-CAP-COM-ORD-015-02` | `ATS-COM-ORD-015-02` |
| `BR-CAP-COM-ORD-015-03` | `ATS-COM-ORD-015-03` |
| `BR-CAP-COM-ORD-015-04` | `ATS-COM-ORD-015-04` |
| `BR-CAP-COM-ORD-015-05` | `ATS-COM-ORD-015-05`, `ATS-COM-ORD-015-14` |
| `BR-CAP-COM-ORD-015-06` | `ATS-COM-ORD-015-06` |
| `BR-CAP-COM-ORD-015-07` | `ATS-COM-ORD-015-07`, `ATS-COM-ORD-015-13` |
| `BR-CAP-COM-ORD-015-08` | `ATS-COM-ORD-015-08` |
| `BR-CAP-COM-ORD-015-09` | `ATS-COM-ORD-015-09` |
| `BR-CAP-COM-ORD-015-10` | no scenario: `FND-COM-ORD-072` |
| `BR-CAP-COM-ORD-015-11` | `ATS-COM-ORD-015-11` |
| `BR-CAP-COM-ORD-015-12` | `ATS-COM-ORD-015-12` |
| `BR-CAP-COM-ORD-015-13` | `ATS-COM-ORD-015-10` |

## Interactions With Related Capabilities

A later code extends the sale’s retained discount history. An accepted sale carries an earlier offer and qualifies for a distinct combinable offer. Apply the later offer with authorized staff and inspect both allocations and credit.

Independent change documents need an explicit cross-kind conflict decision. An approved cancellation occupies a line that also supports amendment. Request an amendment before executing the cancellation, then try executing both.

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