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.pyport 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/loginvs/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_jwtkey localStorage) - Fallback
X-User-Emailheader - OTP flow via
/api/auth/otp/* - Refresh token via
/api/auth/refresh
§27.6 · Email Accounts
- Postfix actif sur VPS
oto_mailer.pyexiste dans/opt/oto/api/proactive_notifier.pypour 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.pyactif- ERPNext Notifications DocType disponible
- ⚠️ Segmentation ACCOUNT vs BUSINESS à faire
§27.9 · Communications
/api/whatsapp/webhookreç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_ID1282876274905074 - 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} |
✅ |
/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/loginvs/api/auth/login— clarifier lequel garder- Recommandation: garder
/api/auth/login(namespace propre), rediriger/api/loginavec 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.pymé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_linkparam (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)
- Fusionner
/api/login→/api/auth/login(301 redirect) - Vérifier flag
email_verifieddans DB · bloquer login si false - Audit
oto_mailer.py→ identifier appels ACCOUNT vs BUSINESS - Créer
oto_account_mailer.pyisolé avec 3 templates:account_email_verification.htmlaccount_activated.htmlaccount_password_reset.html
Phase 2 — Templates BUSINESS spécialisés (3h)
- Créer
oto_business_mailer.py - 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)
- Chaque template accepte
deep_linkparam - Wire vers ERPNext Notification triggers
Phase 3 — Deep-links contextuels (1h)
- Modifier
/mon-compte/index.htmlpour 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
- Router JS existant à étendre (probablement déjà présent)
Phase 4 — Tests E2E + Documentation (2h)
- Test complet §27: Création compte → Email verif → Login → Formulaire → ERPNext → Dossier → Business email → Deep-link → Action → Historique
- Documenter dans
/opt/oto/docs/P1_COMPTE_CLIENT_ARCHITECTURE.md - 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
- ✅ Publier ce rapport sur Gitea (fait par ce commit)
- Phase 1 · Consolidation ACCOUNT — démarrer immédiatement
- En parallèle: contournement email + wa.me — 15 min de code
- 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.