Manual Verification Flow
Status Flow
Automatic Validation Process
- PENDING → Initial state when validation request is created
- VERIFIED → Automatic validation succeeded (user is authorized representative)
- ESCALATED → Automatic validation failed, needs manual review
- FAILED → Manual rejection
- EXPIRED → Verification expired without completion
Manual Verification Process
When automatic validation returns ESCALATED status:
- User submits justification:
- Provides written explanation for why they should be authorized
-
Can attach supporting documents (multiple files allowed)
-
Staff reviews justification:
- Reviews user's explanation and documents
-
Makes decision: Approve or Reject
-
Final status:
- Approve → Status changes to VERIFIED (customer can be created)
- Reject → Status changes to FAILED (cannot create customer)
Automatic Expiration
- Verifications that remain in PENDING or ESCALATED status past their
expires_at
timestamp are automatically marked as EXPIRED - An hourly background task checks for and expires stale verifications
- Once expired, the verification cannot be completed and the user must start a new validation request
Status Transitions Diagram
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
API Endpoints
1. Start Validation
POST /api/onboarding-verifications/validate_company/
Request:
1 2 3 4 5 6 7 8 |
|
Response includes status
field:
verified
: Can proceed to create customerescalated
: Need to submit justificationfailed
: Cannot proceed (configuration/identity error)
2. Create Justification (User Action)
POST /api/onboarding-justifications/create_justification/
Request:
1 2 3 4 |
|
3. Attach Documents (User Action)
POST /api/onboarding-justifications/{uuid}/attach_document/
Request: multipart/form-data with file
field
Can be called multiple times to attach multiple documents.
4. Approve Justification (Staff Only)
POST /api/onboarding-justifications/{uuid}/approve/
Request:
1 2 3 |
|
Effect:
- Justification status →
approved
- Verification status →
verified
- User can now create customer
5. Reject Justification (Staff Only)
POST /api/onboarding-justifications/{uuid}/reject/
Request:
1 2 3 |
|
Effect:
- Justification status →
rejected
- Verification status →
failed
- User cannot create customer
6. Create Customer (After Verification)
POST /api/onboarding-verifications/{uuid}/create_customer/
Only works when verification status is verified
.
Use Cases
Use Case 1: Successful Automatic Validation
- User submits validation request
- System checks Äriregister API
- User found as authorized representative → status:
verified
- User creates customer immediately
Use Case 2: Failed Automatic Validation (Research Group)
- User submits validation request
- System checks Äriregister API
- User not found in company representatives → status:
escalated
- User submits justification: "I'm leading a research project under this organization"
- User uploads: project authorization letter, email from supervisor
- Staff reviews and approves
- Verification status →
verified
- User creates customer
Use Case 3: Failed Automatic Validation (Rejected)
- User submits validation request
- System checks Äriregister API
- User not found → status:
escalated
- User submits justification with insufficient explanation
- Staff reviews and rejects with notes
- Verification status →
failed
- User cannot proceed
Frontend Integration Guide
Step 1: Submit Validation
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
Step 2: Submit Justification (if escalated)
1 2 3 4 5 6 7 8 9 10 11 |
|
Step 3: Staff Review (Admin UI)
1 2 3 4 5 6 7 8 9 |
|
Background Tasks
Automatic Verification Expiration
An hourly Celery task (expire_stale_verifications
) runs to automatically expire stale verifications:
- Schedule: Every hour at the top of the hour (e.g., 1:00, 2:00, 3:00)
- What it does: Finds all verifications with
expires_at
in the past and status ofPENDING
orESCALATED
, then marks them asEXPIRED
- Purpose: Ensures that incomplete verification requests don't remain indefinitely in the system
- Impact: Users with expired verifications must start a new validation request