- Streamlined the README.md for clarity and conciseness. - Deleted outdated documentation files related to Freebit SIM management, SIM management API data flow, and various architectural guides to reduce clutter and improve maintainability. - Updated the last modified date in the README to reflect the latest changes.
4.6 KiB
4.6 KiB
Portal – Development Roadmap (Step-by-Step)
This roadmap references PORTAL-ORDERING-PROVISIONING.md (complete flows and architecture) and PORTAL-DATA-MODEL.md (objects/fields/mappings).
Phase 1 – Foundations
-
Salesforce setup (Admin)
- Product2 custom fields: create all fields listed in
SALESFORCE-PRODUCTS.md(core fields:StockKeepingUnit,Product2Categories1__c,Portal_Catalog__c,Portal_Accessible__c,Item_Class__c, plus service-specific fields) - Pricebook: create "Portal" pricebook; add
PricebookEntryrecords for visible Product2 items - Order fields: add
Provisioning_*,WHMCS_*,ESIM_ICCID__c,Attempt_Count__c,Last_Provisioning_At__c - OrderItem fields: add
Billing_Cycle__c,ConfigOptions_JSON__c,WHMCS_Service_ID__c - Platform Event:
OrderProvisionRequested__e; Flow publishes on Order approval
- Product2 custom fields: create all fields listed in
-
WHMCS setup (Admin)
- Create custom field on Client for Customer Number (note id/name).
- Confirm product IDs for Internet/eSIM/VPN and required config options.
- Confirm gateway system name for
paymentmethod.
-
Portal BFF env & security
- Ensure env vars for Salesforce/WHMCS and logging are set; rotate secrets.
- Enable Platform Events subscriber (
SF_EVENTS_ENABLED=true); no inbound SF allowlisting required.
Phase 2 – Identity & Billing
-
BFF: Signup requires SF Number
- Update
SignupDtoto requiresfNumber. - Flow: create portal user → create WHMCS User + Client → set Customer Number custom field → create mapping (userId, whmcsClientId, sfAccountId).
- On email discrepancy with Salesforce Account: create Salesforce Case (no block).
- Send Welcome email (EmailService via jobs).
- Update
-
Portal UI: Address & payment method
- Address step after signup;
PATCH /api/me/addressto update address fields. - Payment methods page/button:
POST /api/auth/sso-linkto WHMCS payment methods; show banner on dashboard untilGET /billing/payment-methods/summaryis true.
- Address step after signup;
Phase 3 – Catalog
-
BFF: Catalog endpoints
GET /catalog: read Product2 (Portal_Catalog__c & validity), price via PricebookEntryGET /catalog/personalized: filter Product2 using Account eligibility fields- Additional endpoints:
/catalog/sim/activation-fees,/catalog/vpn/activation-fees,/catalog/sim/addons, etc.
-
Portal UI: Catalog & product detail
- Build
/cataloglisting; product detail pages for Internet/eSIM/VPN. - Support configurable options via Product2
Portal_ConfigOptions_JSON__c.
- Build
Phase 4 – Orders & Provisioning
-
BFF: Orders API
POST /orders: create SF Order + OrderItems (snapshots: Quantity, UnitPrice, Billing_Cycle, ConfigOptions), status Pending Review; returnsfOrderId.GET /orders/:sfOrderId: return orchestration status.- Async Provisioning: triggered by Platform Event
OrderProvisionRequested__e; worker rechecks payment method; (eSIM) activate; WHMCS AddOrder → AcceptOrder; update SF with IDs/status; send emails.
-
Salesforce: Record-Triggered Flow
- On Order status = Approved, publish
OrderProvisionRequested__ewithOrderId__cand optionalIdemKey__c.
- On Order status = Approved, publish
-
Portal UI: Checkout & status
- Build checkout button gating on
hasPaymentMethod; after order, show status page that pollsGET /orders/:sfOrderId.
Phase 5 – eSIM Extras & Emails
- BFF: eSIM actions
POST /subscriptions/:id/reissue-esim: call provider API; update WHMCS service notes/custom fields; email customer.POST /subscriptions/:id/topup: call provider API; create add-on or invoice in WHMCS; email customer.
- Email templates & jobs
- Implement EmailService (SendGrid or SMTP) and queue jobs for: Signup Welcome, eSIM Activation, Order Provisioned.
Phase 6 – Observability & Hardening
- Observability
- Add correlation IDs across BFF, Salesforce calls, WHMCS calls.
- Metrics: provisioning latency, error rates, retries; alerts on anomalies.
- Idempotency & resilience
- Cart hash idempotency for
POST /orders. - Idempotency on Platform Event (
IdemKey__c); dedupe in worker. - Include
sfOrderIdin WHMCSnotesfor duplicate protection.
- Security reviews
- Confirm no PAN/PII leakage in logs; confirm TLS and secrets; rate limits on auth endpoints.
Deliverables Checklist
- Salesforce fields created and secured (FLS/profiles)
- WHMCS Client custom field created; product IDs confirmed
- BFF endpoints implemented (auth/billing/catalog/orders/esim)
- Portal pages implemented (signup/address/catalog/detail/checkout/status)
- Platform Event Flow wired and tested end-to-end
- Emails tested in dev/staging
- Monitoring and alerts configured