URS-005 · Prevent Uncertified Reps from Creating Orders
Status: PASS · Duration: 1m 32s · Run Date: April 21, 2026
Test Scenarios
Section titled “Test Scenarios”Step 1: Uncertified rep blocked
Section titled “Step 1: Uncertified rep blocked”


Step 2: Certified rep control
Section titled “Step 2: Certified rep control”

Step 3: Manufacturer approval
Section titled “Step 3: Manufacturer approval”



Step 4: Certified order creation
Section titled “Step 4: Certified order creation”






Recordings
Section titled “Recordings”step 01 uncertified blocked
Section titled “step 01 uncertified blocked”step 02 certified control
Section titled “step 02 certified control”step 03 manufacturer approval
Section titled “step 03 manufacturer approval”step 04 certified order
Section titled “step 04 certified order”Database Validations
Section titled “Database Validations”Ryan relationship now active
Section titled “Ryan relationship now active”Ryan’s representation relationship should be active after manufacturer approval
SELECT id, status, active, responded_at, responded_by_user_id FROM organization_representation_relationships WHERE id = $1| id | status | active | responded_at | responded_by_user_id |
|---|---|---|---|---|
| 95d6e7f8-a9b0-1234-9012-345678901234 | active | true | 2026-04-21T05:57:40.841Z | d4e5f6a7-b8c9-0123-def1-234567890123 |
Bob relationship still active (control)
Section titled “Bob relationship still active (control)”Bob’s active flag should remain true and unaffected by Ryan’s approval flow
SELECT id, status, active FROM organization_representation_relationships WHERE id = $1| id | status | active |
|---|---|---|
| 84c5d6e7-f8a9-0123-8901-234567890123 | proposed_pending_onboarding | true |
Status change history recorded
Section titled “Status change history recorded”Status change to “active” should be recorded in history table
SELECT id, to_status, from_status, changed_by_user_id, created_at FROM organization_representation_request_status_changes WHERE relationship_id = $1 AND created_at > NOW() - INTERVAL '30 minutes' ORDER BY created_at DESC LIMIT 5| id | to_status | from_status | changed_by_user_id | created_at |
|---|---|---|---|---|
| 019dae9d-a76a-7c0a-bfbc-cd4caccb59b0 | active | proposed | d4e5f6a7-b8c9-0123-def1-234567890123 | 2026-04-21T05:57:40.823Z |
Billing order created by Ryan after certification
Section titled “Billing order created by Ryan after certification”At least one billing order should have been created by Ryan after being certified
SELECT bo.id, bo.order_number, bo.status, bo.created_at, bo.created_by_user_id FROM billing_orders bo WHERE bo.created_by_user_id = $1 AND bo.created_at > NOW() - INTERVAL '30 minutes' ORDER BY bo.created_at DESC LIMIT 5| id | order_number | status | created_at | created_by_user_id |
|---|---|---|---|---|
| 019dae9e-446a-78c2-87d9-1c3aad356e87 | BO-1 | submitted | 2026-04-21T05:58:21.012Z | 28c9d0e1-f2a3-4567-2345-678901234567 |
Audit trail for representative approval
Section titled “Audit trail for representative approval”Audit/decision events should exist referencing Ryan after the approval action
SELECT ae.id, ae.event_type, ae.action, ae.created_at, ae.user_id, ae.object_id, substring(ae.payload::text, 1, 500) as payload_preview FROM audit_events ae WHERE ae.created_at > NOW() - INTERVAL '30 minutes' AND (ae.object_id = $1 OR ae.object_id = $2) ORDER BY ae.created_at DESC LIMIT 10| id | event_type | action | created_at | user_id | object_id | payload_preview |
|---|---|---|---|---|---|---|
| 019dae9d-a76b-73f3-9c81-4352ec9332e4 | user_log | rep_onboarding_request_approved | 2026-04-21T05:57:40.849Z | d4e5f6a7-b8c9-0123-def1-234567890123 | 95d6e7f8-a9b0-1234-9012-345678901234 | {“userId”: “28c9d0e1-f2a3-4567-2345-678901234567”, “userN… |