Skip to content

URS-005 · Prevent Uncertified Reps from Creating Orders

Title: Prevent Uncertified Reps from Creating Orders Date: 2026-04-23T03:34:49.115Z Duration: 96.7s Overall Status: ✅ PASS

The system shall prevent uncertified reps from creating orders until approved. (Repeating with URS-055)

Source: User_Requirement_Specifications_ZuriMED_DeviceFlow.xlsx — the run below proves the system meets this requirement.

Status: ✅ PASS

Each step below corresponds to one Playwright test that ran sequentially. Screenshots and video recordings provide visual evidence of the UI behaviour.

1. Step 1: Uncertified rep blocked — ✅ PASS

Section titled “1. Step 1: Uncertified rep blocked — ✅ PASS”

What this step proves:

Proves the system correctly prevents an uncertified representative from creating orders. Ryan Delauintana has no active manufacturer approval, so the bill-only order creation form displays a “Manufacturer Approval Required” warning and presents no selectable manufacturers. The same block appears on both the /billing/new and /orders/requests/new routes, confirming the enforcement is applied consistently across order entry points.

Audit events generated by this step:

(Evidence matched by declared name — step timing not available or no events fell in window)

TimeTypeActionUserOrgPerformed
2026-04-23 03:34:51Zuser_loguser:loginryan.delauintana@stellartech.comStellarTech Medical Solutions
2026-04-23 03:35:09Zuser_loguser:loginbob.kauffman@stellartech.comStellarTech Medical Solutions
2026-04-23 03:35:24Zuser_loguser:loginmark.manufacturer@zurimed.comZuriMED
2026-04-23 03:35:49Zuser_loguser:loginryan.delauintana@stellartech.comStellarTech Medical Solutions

Screenshots:

step 01 ryan logged in

step 01 order blocked

step 01 order request blocked

Video recording:


2. Step 2: Certified rep control — ✅ PASS

Section titled “2. Step 2: Certified rep control — ✅ PASS”

What this step proves:

Control condition confirming that the blocking behavior is targeted at uncertified reps only. Bob Kauffman, whose representation relationship is active, can access the order creation form without any approval warning. The form auto-advances to Step 2 with ZuriMED pre-selected. This eliminates the possibility that the block in Step 1 is a general UI defect.

Audit events generated by this step:

(Evidence matched by declared name — step timing not available or no events fell in window)

TimeTypeActionUserOrgPerformed
2026-04-23 03:34:51Zuser_loguser:loginryan.delauintana@stellartech.comStellarTech Medical Solutions
2026-04-23 03:35:09Zuser_loguser:loginbob.kauffman@stellartech.comStellarTech Medical Solutions
2026-04-23 03:35:24Zuser_loguser:loginmark.manufacturer@zurimed.comZuriMED
2026-04-23 03:35:49Zuser_loguser:loginryan.delauintana@stellartech.comStellarTech Medical Solutions

Screenshots:

step 02 bob logged in

step 02 order form accessible

Video recording:


3. Step 3: Manufacturer approval — ✅ PASS

Section titled “3. Step 3: Manufacturer approval — ✅ PASS”

What this step proves:

The ZuriMED manufacturer user (Mark) navigates to Ryan’s representative detail page, confirms the status shows “Pending Approval”, and clicks the “Approve Representative” button. After submission the status badge updates to “Active”, demonstrating that the approval workflow functions end-to-end and transitions the relationship to the certified state required for order creation.

Audit events generated by this step:

(Evidence scoped to step execution window: 2026-04-23T03:35:27.049Z → 2026-04-23T03:35:44.423Z)

TimeTypeActionUserOrgPerformed
2026-04-23 03:35:37Zuser_logrep_onboarding_request_approvedmark.manufacturer@zurimed.comZuriMED
2026-04-23 03:35:37Ztransactional_emailrep_createdStellarTech Medical Solutions

Emails triggered by this step:

(Evidence matched by declared name — step timing not available or no events fell in window)

Email 1: Representative Account Approved - ZuriMED

Template: Representative_Account_Approved_-_ZuriMED

Representative Account Approved - ZuriMED

Screenshots:

step 03 mark logged in

step 03 ryan pending status

step 03 approval dialog

step 03 ryan active status

Video recording:


4. Step 4: Certified order creation — ✅ PASS

Section titled “4. Step 4: Certified order creation — ✅ PASS”

What this step proves:

Validates that the now-approved representative can create and submit a bill-only order without restriction. Ryan logs in after certification, accesses /billing/new without any approval warning, selects an account, adds a product with lot number, and successfully submits the order. The system redirects to /billing, confirming the requirement gate is lifted after manufacturer approval.

Audit events generated by this step:

(Evidence scoped to step execution window: 2026-04-23T03:35:51.890Z → 2026-04-23T03:36:23.715Z)

TimeTypeActionUserOrgPerformed
2026-04-23 03:36:18Zdecisionbill_only_order.enqueue_upload_classificationryan.delauintana@stellartech.comZuriMEDno
2026-04-23 03:36:19Ztransactional_emailnew_bill_onlyStellarTech Medical Solutions

Emails triggered by this step:

(Evidence matched by declared name — step timing not available or no events fell in window)

Email 1: New Bill-Only Order - 4/22/2026 - ZuriMED BO-1

Template: New_Bill-Only_Order_-_4_22_2026_-_ZuriMED_BO-1

New Bill-Only Order - 4/22/2026 - ZuriMED BO-1

Screenshots:

step 04 ryan logged in certified

step 04 form accessible

step 04 account selected

step 04 devices selected

step 04 documents

step 04 review

step 04 order submitted

Video recording:


The following SQL queries ran against the application database after the Playwright scenarios completed. Each query asserts a specific condition that proves the feature under test persisted its data correctly.

Assertion: 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-23T03:35:37.093Zd4e5f6a7-b8c9-0123-def1-234567890123

Bob relationship still active (control) — ✅ PASS

Section titled “Bob relationship still active (control) — ✅ PASS”

Assertion: 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

Status change history recorded — ✅ PASS

Section titled “Status change history recorded — ✅ PASS”

Assertion: 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
019db868-4f86-7292-a477-8b69a3d4bd55activeproposedd4e5f6a7-b8c9-0123-def1-2345678901232026-04-23T03:35:37.053Z

Billing order created by Ryan after certification — ✅ PASS

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

Assertion: 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
019db868-ef88-79e8-bb3d-29c1ee3c7576BO-1submitted2026-04-23T03:36:18.000Z28c9d0e1-f2a3-4567-2345-678901234567

Audit trail for representative approval — ✅ PASS

Section titled “Audit trail for representative approval — ✅ PASS”

Assertion: 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
019db868-4f9f-735e-b8a5-80a23d72c832transactional_emailrep_created2026-04-23T03:35:37.148ZNULL95d6e7f8-a9b0-1234-9012-345678901234{“to”: [“ryan.delauintana@stellartech.com”], “s3Path”: “email-audit/b2c3d4e5-f6a7-8901-bcde-f12345678901/019db868-4f9f-735e-b8a5-80a23d72c832/”, “subject”: “Representative Account Approved - ZuriMED”, “messageId”: “dev-console-log”, “relatedEntityType”: “organization_representation_relationship”}
019db868-4f88-75a8-b202-e613d724a45auser_logrep_onboarding_request_approved2026-04-23T03:35:37.112Zd4e5f6a7-b8c9-0123-def1-23456789012395d6e7f8-a9b0-1234-9012-345678901234{“userId”: “28c9d0e1-f2a3-4567-2345-678901234567”, “userName”: “Ryan Delauintana”, “userEmail”: “ryan.delauintana@stellartech.com”, “distributorOrganizationId”: “b2c3d4e5-f6a7-8901-bcde-f12345678901”, “manufacturerOrganizationId”: “a1b2c3d4-e5f6-7890-abcd-ef1234567890”}

Per-declaration outcome of every expectedAuditActions and expectedEmailTemplates entry written into the orchestrator. Missing evidence here is a real test failure, not a soft warning.

Each row asserts that a declared expectedAuditActions entry produced a matching row in audit_events. A ❌ flips overall status to FAIL — the declaration is real proof, not just an annotation.

StepExpected Audit ActionFound
Step 1: Uncertified rep blockeduser_log:user:login
Step 2: Certified rep controluser_log:user:login
Step 3: Manufacturer approvaluser_log:rep_onboarding_request_approved
Step 4: Certified order creationdecision:bill_only_order.enqueue_upload_classification

Each row asserts that a declared expectedEmailTemplates entry was matched (case-insensitive substring) by a captured email subject or template. A ❌ flips overall status to FAIL.

StepExpected TemplateFound
Step 3: Manufacturer approvalRepresentative Account Approved
Step 4: Certified order creationNew Bill-Only Order

Every row written to audit_events while this test was running (scoped to the demo organizations). Provides compliance evidence that user actions are traced end-to-end (URS-003).

Capture window start: 2026-04-23T03:34:47.275Z

SELECT
ae.created_at,
ae.event_type,
ae.action,
ae.user_id,
u.email AS user_email,
ae.organization_id,
o.name AS organization_name,
ae.object_id,
ae.secondary_object_id,
ae.payload,
ae.route,
ae.trace_id
FROM audit_events ae
LEFT JOIN users u ON u.id = ae.user_id
LEFT JOIN organizations o ON o.id = ae.organization_id
WHERE ae.created_at >= $1
AND ae.organization_id = ANY($2::uuid[])
ORDER BY ae.created_at ASC

8 event(s) captured:

TimeTypeActionUserOrgObject IDPerformedReason
2026-04-23 03:34:51Zuser_loguser:loginryan.delauintana@stellartech.comStellarTech Medical Solutions
2026-04-23 03:35:09Zuser_loguser:loginbob.kauffman@stellartech.comStellarTech Medical Solutions
2026-04-23 03:35:24Zuser_loguser:loginmark.manufacturer@zurimed.comZuriMED
2026-04-23 03:35:37Zuser_logrep_onboarding_request_approvedmark.manufacturer@zurimed.comZuriMED95d6e7f8-a9b0-1234-9012-345678901234
2026-04-23 03:35:37Ztransactional_emailrep_createdStellarTech Medical Solutions95d6e7f8-a9b0-1234-9012-345678901234
2026-04-23 03:35:49Zuser_loguser:loginryan.delauintana@stellartech.comStellarTech Medical Solutions
2026-04-23 03:36:18Zdecisionbill_only_order.enqueue_upload_classificationryan.delauintana@stellartech.comZuriMED019db868-ef88-79e8-bb3d-29c1ee3c7576noNo uploaded PO documents
2026-04-23 03:36:19Ztransactional_emailnew_bill_onlyStellarTech Medical Solutions019db868-ef88-79e8-bb3d-29c1ee3c7576

2 notification email(s) were captured during this test run. Each email is rendered as a screenshot for compliance review.

1. Representative Account Approved - ZuriMED

Section titled “1. Representative Account Approved - ZuriMED”

Template: Representative_Account_Approved_-_ZuriMED

Representative Account Approved - ZuriMED

2. New Bill-Only Order - 4/22/2026 - ZuriMED BO-1

Section titled “2. New Bill-Only Order - 4/22/2026 - ZuriMED BO-1”

Template: New_Bill-Only_Order_-_4_22_2026_-_ZuriMED_BO-1

New Bill-Only Order - 4/22/2026 - ZuriMED BO-1