Files
oto-enterprise-os-dtp/AUDIT_P1_COMPTE_CLIENT_20260810.md
Claude Code DTP Worker 69def8cde8
CI / Contraintes NON-NÉGOCIABLES (CLAUDE.md) (push) Has been cancelled
CI / Validation JSON (schémas Faisabilité) (push) Has been cancelled
CI / Qualité documentaire (liens + 4Big) (push) Has been cancelled
CI / Reproductibilité des artefacts out/ (build == commité) (push) Has been cancelled
CI / Fraîcheur matrice de régression (run == commité) (push) Has been cancelled
CI / Intégrité du câblage CI (gate agrège tout · gates statiques verrouillés) (push) Has been cancelled
CI / Intégrité des chiffres du README (valeur == artefact cité · (push) Has been cancelled
CI / Intégrité mobile-build.yml (gating portable · activation différée · (push) Has been cancelled
CI / Publiciste · parser + schéma + generator (unittest) (push) Has been cancelled
CI / RBAC · 50 rôles + schéma (unittest) (push) Has been cancelled
CI / Faisabilité · générateur 4 volets + round-trip (unittest) (push) Has been cancelled
CI / RBAC · fixtures ERPNext (Role + Custom DocPerm) (push) Has been cancelled
CI / RBAC · plan User Permission (row-level) (push) Has been cancelled
CI / RBAC · Role Profile (bundles par portail) (push) Has been cancelled
CI / RBAC · run-book d'application unifié (agrégat 3 volets) (push) Has been cancelled
CI / Faisabilité · dossier bancable trilingue FR/EN/ES (push) Has been cancelled
CI / CRM · workflow vente ERPNext (lead → CONFOTUR) (push) Has been cancelled
CI / CRM · DocType porteur OTO Dossier Vente (push) Has been cancelled
CI / CRM · barème commissions vendeurs (push) Has been cancelled
CI / CRM · Financement Bancaire (gate hypothécaire RD) (push) Has been cancelled
CI / Fiscal · e-CF DGII (Compupar) (push) Has been cancelled
CI / Frontend · Workspaces 5 portails rôle (push) Has been cancelled
CI / Legal · DocType CONFOTUR Application (push) Has been cancelled
CI / QA · Audit 5D conformité (push) Has been cancelled
CI / SEO · mots-clés trilingues + schema.org + hreflang (push) Has been cancelled
CI / Chat OTOIA · montage par portail (Custom Block) (push) Has been cancelled
CI / QA · Audit 4Big (95+/100 sur 100% deliverables) (push) Has been cancelled
CI / Démo · Scénarios (run-sheet P07 banquier / P05 client) (push) Has been cancelled
CI / QA · Matrice de régression exhaustive (Sprint 8) (push) Has been cancelled
CI / DevOps · Run-book de déploiement VPS unifié (Sprint 8) (push) Has been cancelled
CI / QA · Matrice d'acceptation / traçabilité MVP (Sprint 8) (push) Has been cancelled
CI / Mobile · config app Expo/EAS (navigation par rôle) (push) Has been cancelled
CI / PIE · manifest de dépendances (Annexe 12 · V10.1) (push) Has been cancelled
CI / E2E baseline Playwright (manuel) (push) Has been cancelled
CI / Gate qualité (agrégat) (push) Has been cancelled
audit P1 compte client + gaps + plan 4 phases
2026-08-10 18:59:22 +00:00

9.7 KiB

AUDIT §27 · P1 COMPTE CLIENT + COURRIELS SPÉCIALISÉS

Date: 2026-08-10 · Auditeur: Claude · Cible: VPS 153.75.250.214 Référence: DIRECTIVE_COMPTE_CLIENT_COURRIELS_20260810.md (commit d0f05ad)


1. Résumé Exécutif

État: 🟡 Fondations solides · Refactoring léger nécessaire · Templates Business à créer

Le système actuel a déjà 90% de l'infrastructure P1 en place:

  • Portail unifié /entrer-compte/ (login + signup + OTP + reset)
  • Backend lead_signup.py port 8091 avec endpoints ACCOUNT complets
  • Dashboard client /mon-compte/ (211KB HTML riche · 6 sections)
  • ERPNext v15 + apps custom otov7_platform + otov7_construction
  • DocuSeal (OTO Sign™) + Cardnet + WhatsApp webhook câblés

Ce qui manque:

  • Séparation formelle ACCOUNT vs BUSINESS emails (mélangés)
  • Templates emails Business spécialisés (immobilier, docs, paiement)
  • Deep-links contextuels dans les emails (tout pointe accueil)
  • Consolidation /api/login vs /api/auth/login (doublons)
  • Validation email obligatoire avant activation (§4, §8)

2. Audit §27 — Inventaire des 12 points

§27.1 · Système compte client OTO déjà prévu

  • Portail: /opt/oto/sites/vente/entrer-compte/index.html (30KB · luxury dark + gold)
  • Blocs: login, signup, code_block (OTP), reset_email, reset_confirm
  • Redirects consolidés /connexion, /creer-mon-compte, /login/entrer-compte/

§27.2 · Portail client

  • /opt/oto/sites/vente/mon-compte/index.html (211KB · 6 sections)
  • Sections identifiées via bak files: Profil, Documents, Signatures, Paiements, Concierge, Coûts opération, Suivi projet

§27.3 · ERPNext

  • ERPNext v15.112, custom apps otov7_platform + otov7_construction
  • Docker containers healthy: backend, frontend, db, redis, scheduler, queues

§27.4 · DocTypes existants

  • 100+ fichiers Python dans /apps/otov7_platform/otov7_platform/ (adaptive, ads, api, audit_console, bibliotheque, etc.)
  • À approfondir dans phase implémentation

§27.5 · Système d'authentification

  • JWT (otov7_jwt key localStorage)
  • Fallback X-User-Email header
  • OTP flow via /api/auth/otp/*
  • Refresh token via /api/auth/refresh

§27.6 · Email Accounts

  • Postfix actif sur VPS
  • oto_mailer.py existe dans /opt/oto/api/
  • proactive_notifier.py pour comms proactives
  • ⚠️ Templates séparés ACCOUNT vs BUSINESS non formalisés

§27.7 · Templates

  • WhatsApp templates approuvés Meta: otov7_appointment_reminder_es/en (paramètres positionnels)
  • ⚠️ Templates email HTML: à inventorier dans oto_mailer.py

§27.8 · Notifications

  • proactive_notifier.py actif
  • ERPNext Notifications DocType disponible
  • ⚠️ Segmentation ACCOUNT vs BUSINESS à faire

§27.9 · Communications

  • /api/whatsapp/webhook reçoit les inbound
  • DocuSeal webhook pour signatures
  • Cardnet webhook pour paiements
  • Historique tracké en ERPNext (Communication DocType)

§27.10 · Intégrations WhatsApp

  • Meta Cloud API câblée: WABA 2074828686776814, PHONE_ID 1282876274905074
  • Token System User valide (créé aujourd'hui)
  • ⚠️ Business "OTOv7" non vérifié Meta — comms outbound bloquées (statut PENDING)
  • Contournement email+wa.me possible immédiatement

§27.11 · Ne pas reconstruire ce qui existe

  • 90% de l'infra existe déjà. On refactor, on n'écrit pas de zéro.

§27.12 · Connecter les systèmes proprement

  • ACTION: consolidation endpoints doublons + séparation templates

3. Inventaire Endpoints Backend

ACCOUNT (auth/identité) — 15 endpoints

Endpoint Statut Note
/api/signup Création compte
/api/verify Verif email
/api/reset Reset password
/api/check Check email exists
/api/login ⚠️ Doublon avec /api/auth/login
/api/auth/login ⚠️ Doublon avec /api/login
/api/auth/otp/resend OTP renvoi
/api/auth/otp/verify OTP verif
/api/auth/refresh JWT refresh
/api/user/profil GET/POST profil
/api/user/identite GET/POST identité (cédula/passeport)
/api/user/set Update user fields
/api/consent/log Log consent
/api/consent/record Record consent
/api/waitlist/subscribe Liste d'attente

BUSINESS (métier) — 28 endpoints

Domaine Endpoints Note
Client /api/client/create, /api/client/self
Réservation /api/reservation/rdv, /api/reservation/set
Documents /api/document/{create,sign,submit,audit,mark,webhook/docuseal} Complet
DocuSeal /api/docuseal/{send,webhook}
Notaire /api/notaire/{self,update}
Banques /api/banques/{self,upload}
Hypothèque /api/hypotheque/{create,update,upload,prequalif,etape/next} 5 endpoints
Cardnet /api/cardnet/create Paiements
Catalog /api/catalog/units, /api/lead/unit
IoT (portes) /api/iot/{door/open,gate/open,guest/invite,guest/validate}
WhatsApp /api/whatsapp/webhook Inbound OK
Admin /api/admin/{import,units,validate}
Upload /api/upload

Total: 43 endpoints backend actifs.


4. Gaps identifiés vs Directive

🔴 CRITIQUE (bloque le respect strict de la directive)

Gap 1 · Doublons endpoints auth

  • /api/login vs /api/auth/login — clarifier lequel garder
  • Recommandation: garder /api/auth/login (namespace propre), rediriger /api/login avec 301

Gap 2 · Validation email obligatoire avant activation

  • §4: "Après validation de l'email → compte activé"
  • §8: "OTP-based email verification"
  • ⚠️ À vérifier: le compte est-il vraiment INACTIF tant que email non confirmé? Ou juste flag?

Gap 3 · Templates emails Business séparés

  • §16: distinction technique claire ACCOUNT vs BUSINESS
  • Actuellement oto_mailer.py mélange probablement les 2
  • ACTION: créer 2 modules: oto_account_mailer.py (ACCOUNT) + oto_business_mailer.py (BUSINESS)

🟡 IMPORTANT

Gap 4 · Deep-links contextuels dans emails

  • §22: "JAMAIS envoyer client à la page d'accueil"
  • Actuellement tous les emails linkent probablement à /mon-compte/ racine
  • ACTION: chaque template a un deep_link param (paiement → /mon-compte/#paiement/{id}, doc → /mon-compte/#documents/{ref}, etc.)

Gap 5 · Templates Business spécialisés à créer

  • §12-15: templates fournis (intérêt unité, doc manquant, paiement, changement prix)
  • 4 templates minimum à créer côté email (ES/FR/EN = 12 fichiers)

Gap 6 · CRM = ERPNext natif (pas EspoCRM/HubSpot)

  • Voir memory otov7_crm_espocrm_pas_hubspot.md
  • ACTION: vérifier que toutes les créations clients passent par ERPNext Customer/Lead DocType, jamais ailleurs

🟢 MINEUR

Gap 7 · Bouton "Enregistrer" unifié dans /mon-compte/

  • Déjà fait (voir summary session précédente)

Gap 8 · Radio "Résident RD" / "Étranger" pour cédula OU passeport

  • Déjà fait (§27 identité)

5. Plan d'implantation en 4 phases

Phase 1 — Consolidation ACCOUNT (2h)

  1. Fusionner /api/login/api/auth/login (301 redirect)
  2. Vérifier flag email_verified dans DB · bloquer login si false
  3. Audit oto_mailer.py → identifier appels ACCOUNT vs BUSINESS
  4. Créer oto_account_mailer.py isolé avec 3 templates:
    • account_email_verification.html
    • account_activated.html
    • account_password_reset.html

Phase 2 — Templates BUSINESS spécialisés (3h)

  1. Créer oto_business_mailer.py
  2. 4 templates HTML minimum + versions ES/FR/EN:
    • business_unit_interest.html (§12)
    • business_document_required.html (§13)
    • business_payment_confirmation.html (§14)
    • business_price_change.html (§15)
  3. Chaque template accepte deep_link param
  4. Wire vers ERPNext Notification triggers
  1. Modifier /mon-compte/index.html pour supporter URL fragments:
    • #paiement/{id} → ouvre section Paiements + scroll to invoice
    • #documents/{ref} → ouvre section Documents + highlight doc
    • #reservation/{id} → ouvre section Réservations + focus
    • #projet/{code} → ouvre section Projet + tab active
  2. Router JS existant à étendre (probablement déjà présent)

Phase 4 — Tests E2E + Documentation (2h)

  1. Test complet §27: Création compte → Email verif → Login → Formulaire → ERPNext → Dossier → Business email → Deep-link → Action → Historique
  2. Documenter dans /opt/oto/docs/P1_COMPTE_CLIENT_ARCHITECTURE.md
  3. Commit sur Gitea + tag release

Total estimé: 8h de dev + tests. Réalisable en 1 journée dédiée.


6. Risques

Risque Probabilité Impact Mitigation
WhatsApp Business toujours en attente Meta Haute Moyen Contournement email + wa.me déjà planifié
ERPNext DocType Customer/Lead pas correctement câblé Moyenne Haut Audit approfondi phase 1
Templates Business demandent revue légale/UX Moyenne Moyen Michel valide chaque template avant prod
Bugs régression dans /mon-compte/ après refactor Faible Haut Backups auto avant chaque édition

7. Prochaines actions immédiates

  1. Publier ce rapport sur Gitea (fait par ce commit)
  2. Phase 1 · Consolidation ACCOUNT — démarrer immédiatement
  3. En parallèle: contournement email + wa.me — 15 min de code
  4. Suivi Meta WhatsApp — check quotidien du statut "En attente" → "Vérifié"

Fin de l'audit. Rapport livré à Michel le 2026-08-10 · Prêt pour go-ahead implantation.