- Introduced ResidenceCardSubmission model to handle user submissions of residence cards, including status tracking and file management. - Updated User model to include a relation to ResidenceCardSubmission for better user data management. - Enhanced the checkout process to require residence card submission for SIM orders, improving compliance and verification. - Integrated VerificationModule into the application, updating relevant modules and routes to support new verification features. - Refactored various components and services to utilize the new residence card functionality, ensuring a seamless user experience. - Updated public-facing views to guide users through the residence card submission process, enhancing clarity and accessibility.
7.1 KiB
7.1 KiB
Eligibility & Verification (Salesforce-Driven)
This guide describes the intended “Salesforce is the source of truth” model for:
- Internet eligibility (address/serviceability review)
- SIM ID verification (residence card / identity document)
It also explains how these checks gate checkout and where the portal should display their status.
Goals
- Make eligibility/verification account-level so repeat orders are frictionless.
- Use Salesforce workflow + audit trail (Cases + Account fields + Files) instead of portal-only tables.
- Keep checkout clean: show one canonical status and a single next action.
Concepts & Ownership
| Concept | Source of truth | Why |
|---|---|---|
| Products + pricing | Salesforce pricebook | Single catalog truth |
| Payment methods | WHMCS | No card storage in portal |
| Orders + fulfillment | Salesforce Order (and downstream WHMCS) | Operational workflow |
| Internet eligibility status | Salesforce Account (with Case for workflow) | Reuse for future internet orders |
| SIM ID verification status | Salesforce Account (with Files) | Reuse for future SIM orders |
Internet Eligibility (Address Review)
Target UX
- On
/account/shop/internet:- Show current eligibility status (e.g. “Checking”, “Eligible for …”, “Not available”, “Action needed”).
- If not requested yet: show a single CTA (“Request eligibility review”).
- In checkout (Internet orders):
- If eligibility is PENDING/REQUIRED, the submit CTA is disabled and we guide the user to the next action.
- If ELIGIBLE, proceed normally.
Target Salesforce Model
Account fields (canonical, cached by portal):
InternetEligibilityStatus__c(picklist)- Suggested values:
REQUIRED(no check requested / missing address)PENDING(case open, awaiting review)ELIGIBLE(approved)INELIGIBLE(rejected)
- Suggested values:
InternetEligibilityResult__c(text/picklist; optional)- Example:
Home,Apartment, or a more structured code that maps to portal offerings.
- Example:
InternetEligibilityCheckedAt__c(datetime; optional)InternetEligibilityNotes__c(long text; optional)
Case (workflow + audit trail):
- Record type: “Internet Eligibility”
- Fields populated from portal:
- Account, contact, service address snapshot, desired product (SKU), notes
- SLA/review handled by internal team; a Flow/Trigger updates Account fields above.
Portal/BFF Flow (proposed)
- Portal calls
POST /api/eligibility/internet/request(or reuse existing hook behavior). - BFF validates:
- account has a service address (or includes the address in request)
- throttling/rate limits
- BFF creates Salesforce Case and sets
InternetEligibilityStatus__c = PENDING. - Portal reads
GET /api/eligibility/internetand shows:PENDING→ “Review in progress”ELIGIBLE→ “Eligible for …”INELIGIBLE→ “Not available” + next steps (support/contact)
- When Salesforce updates the Account fields:
- Portal cache invalidates via CDC/eventing (preferred), or via polling fallback.
Recommended status → UI mapping
| Status | Shop page | Checkout gating |
|---|---|---|
REQUIRED |
Show “Add/confirm address” then “Request review” | Block submit |
PENDING |
Show “Review in progress” | Block submit |
ELIGIBLE |
Show “Eligible for: …” | Allow submit |
INELIGIBLE |
Show “Not available” + support CTA | Block submit |
SIM ID Verification (Residence Card / Identity Document)
Target UX
- In SIM checkout (and any future SIM order flow):
- If status is
VERIFIED: show “Verified” and no upload/change UI. - If
SUBMITTED: show what was submitted (filename + submitted time) and optionally allow “Replace file”. - If
REQUIRED: require upload before order submission.
- If status is
- In order detail pages:
- Show a simple “ID verification: Required / Submitted / Verified” row.
Target Salesforce Model
Account fields (canonical):
IdVerificationStatus__c(picklist)- Suggested values (3-state):
REQUIREDSUBMITTEDVERIFIED
- Suggested values (3-state):
IdVerificationSubmittedAt__c(datetime; optional)IdVerificationVerifiedAt__c(datetime; optional)IdVerificationNotes__c(long text; optional)
Files (document storage):
- Upload as Salesforce Files (ContentVersion)
- Link to Account (ContentDocumentLink)
- Optionally keep a reference field on Account (e.g.
IdVerificationContentDocumentId__c) for fast lookup.
Portal/BFF Flow (proposed)
- Portal calls
GET /api/verification/idto read the Account’s canonical status. - If user uploads a file:
- Portal calls
POST /api/verification/idwith multipart file. - BFF uploads File to Salesforce Account and sets:
IdVerificationStatus__c = SUBMITTEDIdVerificationSubmittedAt__c = now()
- Portal calls
- Internal review updates status to
VERIFIED(and sets verified timestamp/notes). - Portal displays:
VERIFIED→ no edit, no uploadSUBMITTED→ show file metadata + optional replaceREQUIRED→ upload required before SIM activation
Gating rules (SIM checkout)
| Status | Can submit order? | What portal shows |
|---|---|---|
REQUIRED |
No | Upload required |
SUBMITTED |
Yes | Submitted summary + (optional) replace |
VERIFIED |
Yes | Verified badge only |
Where to show status (recommended)
- Shop pages
- Internet: eligibility banner/status on
/account/shop/internet - SIM: verification requirement banner/status on
/account/shop/sim(optional)
- Internet: eligibility banner/status on
- Checkout
- Show the relevant status inline in the “Checkout requirements” section.
- Orders
- Show “Eligibility / ID verification” status on the order detail page so users can track progress after submitting.
- Dashboard
- Task tiles like “Internet availability review in progress” or “Submit ID to activate SIM”.
Notes on transitioning from current implementation
Current portal code uses a portal-side residence_card_submissions table for the uploaded file and status. The target model moves canonical status to Salesforce Account fields and stores the file in Salesforce Files.
Recommended migration approach:
- Add Salesforce Account fields for eligibility and ID verification.
- Dual-write (temporary): when portal receives an upload, store in both DB and Salesforce.
- Switch reads to Salesforce status.
- Backfill existing DB submissions into Salesforce Files.
- Remove DB storage once operationally safe.