Skip to content

URS-005 · Prevent Uncertified Reps from Creating Orders

Status: PASS  ·  Duration: 1m 32s  ·  Run Date: April 21, 2026


PASS

Step 1: Uncertified rep blocked

Step 1: Uncertified rep blocked

Step 1: Uncertified rep blocked


PASS

Step 2: Certified rep control

Step 2: Certified rep control


PASS

Step 3: Manufacturer approval

Step 3: Manufacturer approval

Step 3: Manufacturer approval

Step 3: Manufacturer approval


PASS

Step 4: Certified order creation

Step 4: Certified order creation

Step 4: Certified order creation

Step 4: Certified order creation

Step 4: Certified order creation

Step 4: Certified order creation

Step 4: Certified order creation

PASS

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
idstatusactiveresponded_atresponded_by_user_id
95d6e7f8-a9b0-1234-9012-345678901234activetrue2026-04-21T05:57:40.841Zd4e5f6a7-b8c9-0123-def1-234567890123

PASS

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
idstatusactive
84c5d6e7-f8a9-0123-8901-234567890123proposed_pending_onboardingtrue

PASS

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
idto_statusfrom_statuschanged_by_user_idcreated_at
019dae9d-a76a-7c0a-bfbc-cd4caccb59b0activeproposedd4e5f6a7-b8c9-0123-def1-2345678901232026-04-21T05:57:40.823Z

Billing order created by Ryan after certification

Section titled “Billing order created by Ryan after certification”
PASS

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
idorder_numberstatuscreated_atcreated_by_user_id
019dae9e-446a-78c2-87d9-1c3aad356e87BO-1submitted2026-04-21T05:58:21.012Z28c9d0e1-f2a3-4567-2345-678901234567

PASS

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
idevent_typeactioncreated_atuser_idobject_idpayload_preview
019dae9d-a76b-73f3-9c81-4352ec9332e4user_logrep_onboarding_request_approved2026-04-21T05:57:40.849Zd4e5f6a7-b8c9-0123-def1-23456789012395d6e7f8-a9b0-1234-9012-345678901234{“userId”: “28c9d0e1-f2a3-4567-2345-678901234567”, “userN…