Add cancel-and-replace invoice controls to the Sales reservation step
Why
The Sales Workbench reservation step currently detects an open invoice and tells the operator that creating the reservation will keep it. In the observed case for Saroop Gaddameedhi, the open unpaid invoice is $100.00, order ord_019e84a8-23d1-798b-916c-58ad45330150, but the customer wants an 8-pack.
The operator needs to correct the invoice from the reservation menu without leaving the scheduling flow.
Ask
Please add a visible Cancel invoice and choose replacement option to the open-invoice warning in app/workbench/_components/AvailabilityPlannerDrawer.tsx.
Use the existing Sales cancellation path rather than adding a new Revenue operation. cancelCreditOrderInvoice already calls the Revenue-owned cancellation endpoint, and WorkbenchCardActions.tsx already demonstrates the expected loading, failure, refresh, and success handling.
The interaction should be an explicit two-stage flow:
- Confirm that the current unpaid invoice will be canceled. Show its total and order identifier in the confirmation.
- Only after Revenue confirms cancellation, refresh the credit-order options and reveal the existing offering selector in the same reservation step.
- Let the operator select the 8-pack from the Revenue catalog and explicitly create the replacement invoice. Do not infer the pack from the old
$100.00invoice or hard-code an offering id. - Keep the existing
Create reservationpath disabled while cancellation or option refresh is in flight. If cancellation fails, retain the open-invoice state and show the actionable Revenue error. - After the replacement invoice succeeds, continue the reservation flow against the new open order. Do not create a reservation or Delivery hold against the canceled order.
Please add regression coverage for successful cancellation and 8-pack selection, cancellation failure, stale open-invoice refresh, and prevention of reservation creation against the canceled order.
Scope
This appears to be a Sales-only implementation change. Revenue already owns and exposes the canonical unpaid-invoice cancellation operation, so no contract or ADR change is requested.
References
sales/app/workbench/_components/AvailabilityPlannerDrawer.tsxsales/app/workbench/WorkbenchCardActions.tsxsales/app/workbench/_components/workbench-action-requests.tssales/modules/workbenches/workbench-credit-orders.service.tssales/lib/revenue/order-client.ts