{
  "ursId": "URS-010",
  "title": "Submit different order types (Bill-Only, Trunk Stock, Direct, Drop-ship)",
  "timestamp": "2026-04-23T03:35:46.490Z",
  "durationMs": 111288,
  "config": {
    "inboxUrl": "http://localhost:62490",
    "dbHost": "localhost",
    "dbPort": 62491,
    "dbName": "cc_repinbox_dev"
  },
  "setup": {
    "status": "pass"
  },
  "scenarios": [
    {
      "name": "Step 1: Login and navigate",
      "status": "pass",
      "description": "Step 1: Login and navigate",
      "screenshots": [
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-01-logged-in.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-01-order-creation-form.png"
      ],
      "explanation": "Proves that Bob Kauffman (StellarTech sales rep) can authenticate and reach the order creation form. Establishes the user context used for every subsequent submission.",
      "startedAt": "2026-04-23T03:35:51.771Z",
      "finishedAt": "2026-04-23T03:35:56.211Z",
      "videoPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/videos/step-01-login.webm"
    },
    {
      "name": "Step 2: Bill-Only order",
      "status": "pass",
      "description": "Step 2: Bill-Only order",
      "screenshots": [
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-02-bill-only-devices.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-02-bill-only-product.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-02-bill-only-documents.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-02-bill-only-review.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-02-bill-only-submitted.png"
      ],
      "explanation": "A Bill-Only order is created and submitted end-to-end via the /billing/new flow. The rep selects BOSS Surgical as the sales account, uses their own trunk (TRUNK-36) as the inventory source, and adds SpeedPatch with the seeded lot. The success screen confirms the bill-only submission landed as a billing_orders row. A \"New Bill-Only Order\" notification email is dispatched to the rep confirming the submission.",
      "expectedEmailTemplates": [
        "bill-only"
      ],
      "expectedAuditActions": [
        "decision:bill_only_order.enqueue_upload_classification"
      ],
      "startedAt": "2026-04-23T03:36:09.140Z",
      "finishedAt": "2026-04-23T03:36:23.761Z",
      "videoPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/videos/step-02-bill-only.webm"
    },
    {
      "name": "Step 3: Consignment order",
      "status": "pass",
      "description": "Step 3: Consignment order",
      "screenshots": [
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-03-consignment-step2.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-03-consignment-products.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-03-consignment-review.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-03-consignment-submitted.png"
      ],
      "explanation": "A consignment order is created and submitted end-to-end via /orders/requests/new. The rep selects BOSS Surgical as the delivery location; Consignment is the default order type. The success screen confirms the order_requests row was accepted with order type \"Consignment\".",
      "startedAt": "2026-04-23T03:36:32.963Z",
      "finishedAt": "2026-04-23T03:36:38.778Z",
      "videoPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/videos/step-03-consignment.webm"
    },
    {
      "name": "Step 4: Direct order",
      "status": "pass",
      "description": "Step 4: Direct order",
      "screenshots": [
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-04-direct-step2.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-04-direct-products.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-04-direct-review.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-04-direct-submitted.png"
      ],
      "explanation": "A direct sales order is created and submitted end-to-end via /orders/requests/new. The rep selects Copley Hospital as the delivery location and switches the order type to Direct Order. The success screen confirms the order_requests row was accepted with order type \"Direct\".",
      "startedAt": "2026-04-23T03:36:51.716Z",
      "finishedAt": "2026-04-23T03:36:57.315Z",
      "videoPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/videos/step-04-direct.webm"
    },
    {
      "name": "Step 5: Drop-ship order",
      "status": "pass",
      "description": "Step 5: Drop-ship order",
      "screenshots": [
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-05-dropship-step2.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-05-dropship-products.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-05-dropship-review.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-05-dropship-submitted.png"
      ],
      "explanation": "A drop-ship order is created and submitted end-to-end via /orders/requests/new. The rep selects Connecticut Orthopaedic Surgery Center as the delivery location and switches the order type to Drop-ship, which reveals the Receiving Rep selector. The success screen confirms the order_requests row was accepted with order type \"Drop-ship\".",
      "startedAt": "2026-04-23T03:37:10.350Z",
      "finishedAt": "2026-04-23T03:37:16.177Z",
      "videoPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/videos/step-05-dropship.webm"
    },
    {
      "name": "Step 6: Orders summary",
      "status": "pass",
      "description": "Step 6: Orders summary",
      "screenshots": [
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-06-orders-list.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/step-06-billing-list.png"
      ],
      "explanation": "Both the /orders/requests and /billing lists are opened after all submissions. Evidence screenshots show that the consignment, direct, drop-ship, and bill-only orders all persisted and are visible in their respective list views.",
      "startedAt": "2026-04-23T03:37:27.299Z",
      "finishedAt": "2026-04-23T03:37:33.502Z",
      "videoPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/videos/step-06-summary.webm"
    }
  ],
  "dbValidations": [
    {
      "name": "Bill-Only order created",
      "query": "SELECT bo.id, bo.order_number, bo.status, bo.sales_account_id,\n        bo.notes, bo.created_at\n      FROM billing_orders bo\n      WHERE bo.created_by_user_id = $1\n        AND bo.notes LIKE '%URS-010%'\n      ORDER BY bo.created_at DESC\n      LIMIT 5",
      "status": "pass",
      "rows": [
        {
          "id": "019db868-efbe-76a0-9b92-c2bd134663fc",
          "order_number": "BO-1",
          "status": "submitted",
          "sales_account_id": "fea7b8c9-d0e1-2345-0123-456789012345",
          "notes": "URS-010 validation: bill-only",
          "created_at": "2026-04-23T03:36:18.045Z"
        }
      ],
      "assertion": "A billing_orders row tagged URS-010 should exist for Bob"
    },
    {
      "name": "Bill-Only item pulls from Bob's trunk with the seeded lot",
      "query": "SELECT boi.id, boi.billing_order_id, boi.location_id,\n        boi.lot_number, op.title AS product_name,\n        rwl.name AS location_name, rwl.type AS location_type\n      FROM billing_order_items boi\n      JOIN billing_orders bo ON boi.billing_order_id = bo.id\n      LEFT JOIN org_products op ON boi.product_id = op.id\n      LEFT JOIN real_world_locations rwl ON boi.location_id = rwl.id\n      WHERE bo.created_by_user_id = $1\n        AND bo.notes LIKE '%URS-010%'\n        AND boi.lot_number = $2\n      ORDER BY bo.created_at DESC\n      LIMIT 10",
      "status": "pass",
      "rows": [
        {
          "id": "019db868-efba-7f7a-8bf8-0b0e0078973f",
          "billing_order_id": "019db868-efbe-76a0-9b92-c2bd134663fc",
          "location_id": "a6e7f8a9-b0c1-2345-0123-456789012345",
          "lot_number": "URS010-SP-001",
          "product_name": "FiberLocker® Instrument SN",
          "location_name": "TRUNK-36",
          "location_type": "trunk_stock"
        }
      ],
      "assertion": "A billing_order_items row should reference TRUNK-36 and lot URS010-SP-001"
    },
    {
      "name": "Consignment order submitted",
      "query": "SELECT id, request_number, order_type, status, sales_account_id, notes\n      FROM order_requests\n      WHERE requested_by_user_id = $1\n        AND order_type = 'consignment'\n        AND notes LIKE '%URS-010%'\n      ORDER BY created_at DESC\n      LIMIT 1",
      "status": "pass",
      "rows": [
        {
          "id": "019db869-4030-74f8-a149-6a40de3c7b50",
          "request_number": "OR-2",
          "order_type": "consignment",
          "status": "submitted",
          "sales_account_id": "fea7b8c9-d0e1-2345-0123-456789012345",
          "notes": "URS-010 validation: consignment"
        }
      ],
      "assertion": "A consignment order_request tagged URS-010 should exist"
    },
    {
      "name": "Direct order submitted",
      "query": "SELECT id, request_number, order_type, status, sales_account_id, notes\n      FROM order_requests\n      WHERE requested_by_user_id = $1\n        AND order_type = 'direct'\n        AND notes LIKE '%URS-010%'\n      ORDER BY created_at DESC\n      LIMIT 1",
      "status": "pass",
      "rows": [
        {
          "id": "019db869-887d-791a-a978-818c8d3abaf5",
          "request_number": "OR-3",
          "order_type": "direct",
          "status": "submitted",
          "sales_account_id": "1fb8c9d0-e1f2-3456-1234-567890123456",
          "notes": "URS-010 validation: direct"
        }
      ],
      "assertion": "A direct order_request tagged URS-010 should exist"
    },
    {
      "name": "Drop-ship order submitted",
      "query": "SELECT id, request_number, order_type, status, sales_account_id, notes\n      FROM order_requests\n      WHERE requested_by_user_id = $1\n        AND order_type = 'dropship'\n        AND notes LIKE '%URS-010%'\n      ORDER BY created_at DESC\n      LIMIT 1",
      "status": "pass",
      "rows": [
        {
          "id": "019db869-d1a7-7775-a653-ae4b6c39800b",
          "request_number": "OR-4",
          "order_type": "dropship",
          "status": "submitted",
          "sales_account_id": "2ac9d0e1-f2a3-4567-2345-678901234567",
          "notes": "URS-010 validation: dropship"
        }
      ],
      "assertion": "A dropship order_request tagged URS-010 should exist"
    },
    {
      "name": "All four order types submitted",
      "query": "SELECT\n        (SELECT COUNT(DISTINCT order_type)::int\n           FROM order_requests\n           WHERE requested_by_user_id = $1\n             AND notes LIKE '%URS-010%'\n             AND order_type IN ('consignment', 'direct', 'dropship')) AS request_type_count,\n        (SELECT COUNT(*)::int\n           FROM billing_orders\n           WHERE created_by_user_id = $1\n             AND notes LIKE '%URS-010%') AS billing_order_count",
      "status": "pass",
      "rows": [
        {
          "request_type_count": 3,
          "billing_order_count": 1
        }
      ],
      "assertion": "All four order types should be present: consignment, direct, dropship (order_requests) plus at least one billing_orders row (Bill-Only)"
    }
  ],
  "overallStatus": "pass",
  "outputDir": "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z",
  "auditStartTime": "2026-04-23T03:35:44.607Z",
  "emailEvidence": [
    {
      "subject": "New Bill-Only Order - 4/22/2026 - ZuriMED BO-1",
      "template": "New_Bill-Only_Order_-_4_22_2026_-_ZuriMED_BO-1",
      "screenshotPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-010-submit-order-types/2026-04-23T03-35-46-489Z/screenshots/emails/2026-04-23T03-36-19-245Z-New_Bill-Only_Order_-_4_22_2026_-_ZuriMED_BO-1.png"
    }
  ],
  "auditEventEvidence": [
    {
      "createdAt": "2026-04-23T03:35:49.155Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "bob.kauffman@stellartech.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "StellarTech Medical Solutions",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "bob.kauffman@stellartech.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-04-23T03:35:57.576Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "bob.kauffman@stellartech.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "StellarTech Medical Solutions",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "bob.kauffman@stellartech.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-04-23T03:36:18.045Z",
      "eventType": "decision",
      "action": "bill_only_order.enqueue_upload_classification",
      "userEmail": "bob.kauffman@stellartech.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "ZuriMED",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019db868-efbe-76a0-9b92-c2bd134663fc",
      "secondaryObjectId": null,
      "payload": {
        "reason": "No uploaded PO documents",
        "performed": false,
        "entityType": "billing_order",
        "fileSourceOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
        "hasSelectedPurchaseOrderId": false,
        "purchaseOrderDocumentCount": 0
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-04-23T03:36:19.262Z",
      "eventType": "transactional_email",
      "action": "new_bill_only",
      "userEmail": null,
      "userId": null,
      "organizationName": "StellarTech Medical Solutions",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "019db868-efbe-76a0-9b92-c2bd134663fc",
      "secondaryObjectId": null,
      "payload": {
        "to": [
          "bob.kauffman@stellartech.com"
        ],
        "s3Path": "email-audit/b2c3d4e5-f6a7-8901-bcde-f12345678901/019db868-f431-706d-8c69-a05eca2fa7d9/",
        "subject": "New Bill-Only Order - 4/22/2026 - ZuriMED BO-1",
        "messageId": "dev-console-log",
        "relatedEntityType": "billing_order"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-04-23T03:36:25.414Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "bob.kauffman@stellartech.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "StellarTech Medical Solutions",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "bob.kauffman@stellartech.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-04-23T03:36:38.683Z",
      "eventType": "decision",
      "action": "order_request_created",
      "userEmail": "bob.kauffman@stellartech.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "ZuriMED",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019db869-4030-74f8-a149-6a40de3c7b50",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Order request OR-2 created (importSource=manual)",
        "priority": "normal",
        "itemCount": 1,
        "orderType": "consignment",
        "performed": true,
        "entityType": "order_request",
        "importSource": "manual",
        "requestNumber": "OR-2",
        "resolvedLocationId": "6ea3b4c5-d6e7-8901-6789-012345678901",
        "resolvedSalesAccountId": "fea7b8c9-d0e1-2345-0123-456789012345",
        "fulfillingOrganizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-04-23T03:36:43.294Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "bob.kauffman@stellartech.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "StellarTech Medical Solutions",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "bob.kauffman@stellartech.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-04-23T03:36:57.201Z",
      "eventType": "decision",
      "action": "order_request_created",
      "userEmail": "bob.kauffman@stellartech.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "ZuriMED",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019db869-887d-791a-a978-818c8d3abaf5",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Order request OR-3 created (importSource=manual)",
        "priority": "normal",
        "itemCount": 1,
        "orderType": "direct",
        "performed": true,
        "entityType": "order_request",
        "importSource": "manual",
        "requestNumber": "OR-3",
        "resolvedLocationId": "81c5d6e7-f8a9-0123-8901-234567890123",
        "resolvedSalesAccountId": "1fb8c9d0-e1f2-3456-1234-567890123456",
        "fulfillingOrganizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-04-23T03:37:01.936Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "bob.kauffman@stellartech.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "StellarTech Medical Solutions",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "bob.kauffman@stellartech.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-04-23T03:37:15.845Z",
      "eventType": "decision",
      "action": "order_request_created",
      "userEmail": "bob.kauffman@stellartech.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "ZuriMED",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019db869-d1a7-7775-a653-ae4b6c39800b",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Order request OR-4 created (importSource=manual)",
        "priority": "normal",
        "itemCount": 1,
        "orderType": "dropship",
        "performed": true,
        "entityType": "order_request",
        "importSource": "manual",
        "requestNumber": "OR-4",
        "resolvedLocationId": "a3e7f8a9-b0c1-2345-0123-456789012345",
        "resolvedSalesAccountId": "2ac9d0e1-f2a3-4567-2345-678901234567",
        "fulfillingOrganizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-04-23T03:37:20.753Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "bob.kauffman@stellartech.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "StellarTech Medical Solutions",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "bob.kauffman@stellartech.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    }
  ],
  "auditQuery": "SELECT\n    ae.created_at,\n    ae.event_type,\n    ae.action,\n    ae.user_id,\n    u.email AS user_email,\n    ae.organization_id,\n    o.name AS organization_name,\n    ae.object_id,\n    ae.secondary_object_id,\n    ae.payload,\n    ae.route,\n    ae.trace_id\n  FROM audit_events ae\n  LEFT JOIN users u ON u.id = ae.user_id\n  LEFT JOIN organizations o ON o.id = ae.organization_id\n  WHERE ae.created_at >= $1\n    AND ae.organization_id = ANY($2::uuid[])\n  ORDER BY ae.created_at ASC",
  "auditAssertions": [
    {
      "stepName": "Step 2: Bill-Only order",
      "expectedAction": "decision:bill_only_order.enqueue_upload_classification",
      "found": true
    }
  ],
  "emailAssertions": [
    {
      "stepName": "Step 2: Bill-Only order",
      "expectedTemplate": "bill-only",
      "found": true
    }
  ]
}