# Version 13 — Developer production build specification

## Deliverable boundary
This ZIP preserves the **offline demonstration** and establishes requirements for a **separate production application**. Do not publish the prototype as a customer service. The developer must implement server-side controls, authenticated APIs and a persistent database. Browser local storage cannot be the source of truth.

## 1. Student journey (approved behavior)
- Public course catalog starts with **ICC B1 — 2024 IRC** and allows future B2 and other certification products without hardcoding a B1-only platform. No other course is approved for sale yet.
- Students sign up using a **personal email** as permanent login/contact; verify ownership of this email.
- Student may supply a **separate employer email** for discount verification; verify by expiring, single-use email challenge. No employee discount based solely on an entered domain or claimed employment.
- Approved qualifying categories: BV employees and city/county/municipal employees; permit approved non-.gov municipal domains. Maintain an admin-reviewed domain allowlist, with deactivation and audit.
- Regular package price **$79.99**; verified eligible employee 20% discount produces **$63.99** before any tax/other disclosed charges. Price and discount must be calculated server-side.
- Payment must be processed through a hosted/secure payment provider. Access granted only on server-verified completed payment event; deduplicate payment notifications. Do not accept client UI confirmation as proof of payment. Provide transaction receipt and refund/chargeback handling rules for administrator approval.
- Approved bundle: **three fixed, user-approved 60-question 2024 IRC exams**. Practice and Timed modes; score and review show selected answer letter/full text, correct answer letter/full text, reference and explanation. Unlimited retakes within access window.
- **180-day access** begins at first Practice or Timed exam launch after valid purchase. Before first launch, show 180 days available (not activated). Expiration and start timestamp are server-authoritative.
- On expiry, deny starting/resuming exams but preserve read-only score/history. For Pause, preserve remaining duration while paused; on Resume, shift expiry to conserve paused time. Admin-approved extensions and resets use audited reasons; reset policy must be explicitly specified and applied consistently.
- Prevent unauthorized clients from retrieving entire question bank or answer keys via public endpoints; restrict question delivery/review to properly authenticated entitled sessions. Do not assume downloadable static HTML offers content protection.

## 2. Exam attempt and score persistence
- Store student, product, approved exam id and version, mode, started_at, submitted_at, answers, score, correct and answered counts, completion state, source and attempt id.
- Keep Practice/Timed result histories independent. Highest = max completed score for exam+mode; Most Recent = latest completed attempt for exam+mode.
- Show all completed attempts in history even after expiry; do not erase history on pause, extend, resume or reset.
- For partial attempts: define save/timeout behavior with the owner before implementation; do not silently mark unfinished attempts complete.
- Separate synthetic QA records and admin testing from real students, real business metrics and regular CSV reports. Test fixtures must not leak to production.

## 3. Administration and audit
- Separate protected admin role; enforce authorization on every endpoint, not just a hidden browser button. Consider MFA for administrators.
- Account search, access state, purchase records, verified employer/domain workflow, exam results and CSV exports.
- Require a reason entered **inside the confirmation pop-up at action time** for every reason-required admin action: student Pause, Resume, Extend, Reset, employee discount approve/decline, domain approve/deactivate/reactivate (and similar actions). Reject blank/whitespace reasons on the server.
- Audit actor/admin id, action, subject, old/new values, reason, timestamp and request correlation id; audit records should resist tampering.
- CSV export of student accounts, purchases, exam results, administrator activity. Use authorization and field minimization; protect against CSV formula injection and malicious text.
- UI improvement found in V12: after developer simulation action, visibly confirm success and block accidental rapid duplicate clicks; developer controls hidden from production students.

## 4. Security, operations and hosting
- TLS/HTTPS, strong password handling (managed auth or contemporary slow salted hash), session rotation, secure cookies, CSRF protection as applicable, input validation and output encoding, rate limits, basic abuse protection, audit monitoring, role separation.
- No real card numbers in the application database; minimize personal data; document deletion/retention and privacy notices.
- Encrypted managed database, backups with restore test, error monitoring, secure secret management, separate staging/production deployments and change rollback.
- Domain and DNS to be held in business-controlled account; candidate **BuildingInspectorPrep.com** subject to registration/ownership confirmation. Developer gets delegated access, not sole ownership.
- Provide accessibility and mobile support, privacy/terms/support/refund policy review, contact and product-disclaimer language: independent educational prep; not affiliated with or endorsed by ICC. Obtain professional trademark/legal review before launch.

## 5. Mandatory release gates
1. Approved three exams remain textually identical to signed-off originals. Independently validate actual exam references/keys against authorized 2024 IRC, track reviewer and corrections through change control.
2. Security review: authentication, role separation, API controls, payment webhook verification, access/expiration enforcement, backup recovery.
3. Run acceptance tests in 04_ACCEPTANCE_TESTS.md using sandbox accounts/payment mode.
4. Stakeholder signoff for open decisions, legal/privacy/terms, customer support process and pricing.
5. Production deployment rehearsal, DNS and SSL check, monitoring/rollback ownership, staged go-live.
