ujusum:3-codage:2-sprints:7-sprint-7
Différences
Ci-dessous, les différences entre deux révisions de la page.
| ujusum:3-codage:2-sprints:7-sprint-7 [2026/06/11 02:09] – créée 83.202.252.200 | ujusum:3-codage:2-sprints:7-sprint-7 [2026/06/11 02:20] (Version actuelle) – 83.202.252.200 | ||
|---|---|---|---|
| Ligne 896: | Ligne 896: | ||
| ---- | ---- | ||
| - | ====== | + | ====== |
| - | ===== Sprint 7-A.2 ===== | + | ===== Objectif |
| - | OTA Integrations & Synchronisation Temps Réel | + | Connecter la plateforme aux principaux canaux de distribution mondiaux. |
| - | Objectif | + | Cette couche permet |
| - | Implémenter | + | < |
| + | Synchronisation temps réel | ||
| + | |||
| + | Inventaire | ||
| + | |||
| + | Tarification | ||
| + | |||
| + | Réservations | ||
| + | |||
| + | Disponibilités | ||
| + | |||
| + | Webhooks | ||
| + | </ | ||
| + | |||
| + | entre la plateforme et les OTA. | ||
| + | |||
| + | À l' | ||
| < | < | ||
| - | Airbnb | + | ✓ Airbnb |
| - | Booking.com | + | ✓ Booking.com |
| - | Expedia | + | ✓ Expedia |
| - | Webhook Engine | + | ✓ Webhook Engine |
| + | |||
| + | ✓ Rate Sync | ||
| + | |||
| + | ✓ Availability Sync | ||
| + | |||
| + | ✓ OTA Distribution Platform | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture cible ====== | ||
| + | |||
| + | < | ||
| + | Properties | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Distribution Core | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | OTA Integration Layer | ||
| + | |||
| + | ├── Airbnb Connector | ||
| + | ├── Booking Connector | ||
| + | ├── Expedia Connector | ||
| + | ├── Webhook Engine | ||
| + | ├── Inventory Sync | ||
| + | ├── Rate Sync | ||
| + | └── Reservation Sync | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | External Channels | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-A.2-A ====== | ||
| + | |||
| + | ===== Extension Prisma ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 1 — ChannelSyncJob ====== | ||
| + | |||
| + | ===== Ajouter dans schema.prisma ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model ChannelSyncJob { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | channelConnectionId | ||
| + | |||
| + | syncType | ||
| + | |||
| + | status | ||
| + | |||
| + | startedAt | ||
| + | |||
| + | completedAt | ||
| + | |||
| + | recordsProcessed | ||
| + | @default(0) | ||
| + | |||
| + | errorMessage | ||
| + | |||
| + | metadata | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([syncType]) | ||
| + | |||
| + | @@index([status]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 2 — ChannelWebhook ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model ChannelWebhook { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | channelId | ||
| + | |||
| + | eventType | ||
| + | |||
| + | externalEventId | ||
| + | |||
| + | payload | ||
| + | |||
| + | processed | ||
| + | @default(false) | ||
| + | |||
| + | processedAt | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([processed]) | ||
| + | |||
| + | @@index([eventType]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 3 — ChannelSyncState ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model ChannelSyncState { | ||
| + | |||
| + | channelConnectionId | ||
| + | @id | ||
| + | |||
| + | lastInventorySync | ||
| + | |||
| + | lastPricingSync | ||
| + | |||
| + | lastReservationSync | ||
| + | |||
| + | lastSuccessfulSync | ||
| + | |||
| + | updatedAt | ||
| + | @updatedAt | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4 — Enums ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum SyncType { | ||
| + | |||
| + | INVENTORY | ||
| + | |||
| + | PRICING | ||
| + | |||
| + | RESERVATION | ||
| + | |||
| + | FULL | ||
| + | } | ||
| + | |||
| + | enum SyncStatus { | ||
| + | |||
| + | PENDING | ||
| + | |||
| + | RUNNING | ||
| + | |||
| + | SUCCESS | ||
| + | |||
| + | FAILED | ||
| + | |||
| + | PARTIAL | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 5 — Migration ====== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name ota_integrations | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-A.2-B ====== | ||
| + | |||
| + | ===== OTA Integration Module ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 6 — Création ====== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | |||
| + | ├── airbnb | ||
| + | ├── booking | ||
| + | ├── expedia | ||
| + | ├── webhooks | ||
| + | ├── sync | ||
| + | ├── jobs | ||
| + | └── distribution-integrations.module.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 7 — Services ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | AirbnbIntegrationService | ||
| + | |||
| + | BookingIntegrationService | ||
| + | |||
| + | ExpediaIntegrationService | ||
| + | |||
| + | WebhookEngineService | ||
| + | |||
| + | InventorySyncService | ||
| + | |||
| + | PricingSyncService | ||
| + | |||
| + | ReservationSyncService | ||
| + | |||
| + | ChannelSyncOrchestrator | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-A.2-C ====== | ||
| + | |||
| + | ===== Airbnb Integration ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 8 — AirbnbIntegrationService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | airbnb-integration.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Fonctionnalités ===== | ||
| + | |||
| + | < | ||
| + | OAuth | ||
| + | |||
| + | Listings Sync | ||
| + | |||
| + | Availability Sync | ||
| Rate Sync | Rate Sync | ||
| + | |||
| + | Reservation Import | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 9 — Méthodes ====== | ||
| + | |||
| + | <code ts> | ||
| + | connect() | ||
| + | |||
| + | syncListings() | ||
| + | |||
| + | syncAvailability() | ||
| + | |||
| + | syncPricing() | ||
| + | |||
| + | importReservations() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 10 — Mapping ====== | ||
| + | |||
| + | ===== Synchroniser ===== | ||
| + | |||
| + | < | ||
| + | Property | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Airbnb Listing | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-A.2-D ====== | ||
| + | |||
| + | ===== Booking.com Integration ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 11 — BookingIntegrationService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | booking-integration.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Fonctionnalités ===== | ||
| + | |||
| + | < | ||
| + | Connectivity API | ||
| + | |||
| + | Availability API | ||
| + | |||
| + | Rates API | ||
| + | |||
| + | Reservations API | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 12 — Méthodes ====== | ||
| + | |||
| + | <code ts> | ||
| + | connect() | ||
| + | |||
| + | pushAvailability() | ||
| + | |||
| + | pushRates() | ||
| + | |||
| + | pullReservations() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 13 — Gestion erreurs ====== | ||
| + | |||
| + | ===== Supporter ===== | ||
| + | |||
| + | < | ||
| + | Rate Limits | ||
| + | |||
| + | Retries | ||
| + | |||
| + | Backoff | ||
| + | |||
| + | Dead Letter Queue | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-A.2-E ====== | ||
| + | |||
| + | ===== Expedia Integration ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 14 — ExpediaIntegrationService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | expedia-integration.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Fonctionnalités ===== | ||
| + | |||
| + | < | ||
| + | Rapid API | ||
| + | |||
| + | Inventory API | ||
| + | |||
| + | Pricing API | ||
| + | |||
| + | Booking API | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 15 — Méthodes ====== | ||
| + | |||
| + | <code ts> | ||
| + | connect() | ||
| + | |||
| + | syncInventory() | ||
| + | |||
| + | syncPricing() | ||
| + | |||
| + | importBookings() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-A.2-F ====== | ||
| + | |||
| + | ===== Webhook Engine ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 16 — WebhookEngineService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | webhook-engine.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Supporter ===== | ||
| + | |||
| + | < | ||
| + | OTA Events | ||
| + | |||
| + | Reservations | ||
| + | |||
| + | Cancellations | ||
| + | |||
| + | Availability Changes | ||
| + | |||
| + | Pricing Changes | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 17 — Endpoints ====== | ||
| + | |||
| + | <code http> | ||
| + | POST / | ||
| + | |||
| + | POST / | ||
| + | |||
| + | POST / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 18 — Pipeline ====== | ||
| + | |||
| + | < | ||
| + | Receive | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Validate | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Store | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Process | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Publish Event | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-A.2-G ====== | ||
| + | |||
| + | ===== Availability Sync ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 19 — InventorySyncService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | inventory-sync.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Synchroniser ===== | ||
| + | |||
| + | < | ||
| + | Availability | ||
| + | |||
| + | Blocked Dates | ||
| + | |||
| + | Inventory Changes | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 20 — Méthodes ====== | ||
| + | |||
| + | <code ts> | ||
| + | pushInventory() | ||
| + | |||
| + | pullInventory() | ||
| + | |||
| + | resolveConflicts() | ||
| + | |||
| + | rebuildInventory() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 21 — Résolution conflits ====== | ||
| + | |||
| + | ===== Priorité ===== | ||
| + | |||
| + | < | ||
| + | Reservation Engine | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Property Availability | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | OTA Data | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-A.2-H ====== | ||
| + | |||
| + | ===== Rate Sync ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 22 — PricingSyncService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | pricing-sync.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Synchroniser ===== | ||
| + | |||
| + | < | ||
| + | Base Rate | ||
| + | |||
| + | Seasonal Rate | ||
| + | |||
| + | Promotion Rate | ||
| + | |||
| + | Channel Rate | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 23 — Méthodes ====== | ||
| + | |||
| + | <code ts> | ||
| + | pushRates() | ||
| + | |||
| + | pullRates() | ||
| + | |||
| + | applyRateAdjustments() | ||
| + | |||
| + | rebuildRates() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 24 — Priorité ====== | ||
| + | |||
| + | ===== Source de vérité ===== | ||
| + | |||
| + | < | ||
| + | PropertyPricing | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Distribution Rules | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | OTA | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-A.2-I ====== | ||
| + | |||
| + | ===== Reservation Sync ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 25 — ReservationSyncService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | reservation-sync.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Supporter ===== | ||
| + | |||
| + | < | ||
| + | New Reservation | ||
| + | |||
| + | Modification | ||
| + | |||
| + | Cancellation | ||
| + | |||
| + | Guest Update | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 26 — Méthodes ====== | ||
| + | |||
| + | <code ts> | ||
| + | importReservation() | ||
| + | |||
| + | updateReservation() | ||
| + | |||
| + | cancelReservation() | ||
| + | |||
| + | deduplicateReservation() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 27 — Anti-duplication ====== | ||
| + | |||
| + | ===== Utiliser ===== | ||
| + | |||
| + | < | ||
| + | External Reservation ID | ||
| + | |||
| + | Channel | ||
| + | |||
| + | Guest | ||
| + | |||
| + | Dates | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-A.2-J ====== | ||
| + | |||
| + | ===== API & Monitoring ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 28 — Endpoints ====== | ||
| + | |||
| + | <code http> | ||
| + | POST / | ||
| + | |||
| + | POST / | ||
| + | |||
| + | POST / | ||
| + | |||
| + | GET / | ||
| + | |||
| + | POST / | ||
| + | |||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 29 — Dashboard ====== | ||
| + | |||
| + | ===== Afficher ===== | ||
| + | |||
| + | < | ||
| + | Connected Channels | ||
| + | |||
| + | Sync Status | ||
| + | |||
| + | Last Sync | ||
| + | |||
| + | Failed Jobs | ||
| + | |||
| + | Webhook Health | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 30 — Permissions ====== | ||
| + | |||
| + | < | ||
| + | distribution.sync | ||
| + | |||
| + | distribution.webhooks | ||
| + | |||
| + | distribution.channels | ||
| + | |||
| + | distribution.monitoring | ||
| + | |||
| + | distribution.admin | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 31 — Audit ====== | ||
| + | |||
| + | < | ||
| + | CHANNEL_SYNC_STARTED | ||
| + | |||
| + | CHANNEL_SYNC_COMPLETED | ||
| + | |||
| + | WEBHOOK_RECEIVED | ||
| + | |||
| + | RESERVATION_IMPORTED | ||
| + | |||
| + | RATE_SYNCED | ||
| + | |||
| + | INVENTORY_SYNCED | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 32 — Jobs ====== | ||
| + | |||
| + | < | ||
| + | Toutes les minutes | ||
| + | |||
| + | Webhook Processing | ||
| + | |||
| + | Toutes les 5 minutes | ||
| Availability Sync | Availability Sync | ||
| + | |||
| + | Pricing Sync | ||
| + | |||
| + | Toutes les 15 minutes | ||
| + | |||
| + | Reservation Sync | ||
| + | |||
| + | Toutes les nuits | ||
| + | |||
| + | Full Reconciliation | ||
| </ | </ | ||
| - | afin de connecter | + | ---- |
| + | |||
| + | ====== Architecture Enterprise ====== | ||
| + | |||
| + | ===== Patterns recommandés ===== | ||
| + | |||
| + | < | ||
| + | Outbox Pattern | ||
| + | |||
| + | Inbox Pattern | ||
| + | |||
| + | Retry Queue | ||
| + | |||
| + | Dead Letter Queue | ||
| + | |||
| + | Idempotency Keys | ||
| + | |||
| + | Distributed Locks | ||
| + | </ | ||
| + | |||
| + | afin d' | ||
| + | |||
| + | < | ||
| + | Double réservation | ||
| + | |||
| + | Perte inventaire | ||
| + | |||
| + | Conflits OTA | ||
| + | |||
| + | Incohérences tarifaires | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | Le Sprint 7-A.2 est terminé lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ Airbnb connecté | ||
| + | |||
| + | ✓ Booking.com connecté | ||
| + | |||
| + | ✓ Expedia connecté | ||
| + | |||
| + | ✓ Webhook Engine créé | ||
| + | |||
| + | ✓ Availability Sync créé | ||
| + | |||
| + | ✓ Pricing Sync créé | ||
| + | |||
| + | ✓ Reservation Sync créé | ||
| + | |||
| + | ✓ Monitoring opérationnel | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | ChannelSyncJob | ||
| + | |||
| + | ChannelWebhook | ||
| + | |||
| + | ChannelSyncState | ||
| + | |||
| + | AirbnbIntegrationService | ||
| + | |||
| + | BookingIntegrationService | ||
| + | |||
| + | ExpediaIntegrationService | ||
| + | |||
| + | WebhookEngineService | ||
| + | |||
| + | InventorySyncService | ||
| + | |||
| + | PricingSyncService | ||
| + | |||
| + | ReservationSyncService | ||
| + | |||
| + | ChannelSyncOrchestrator | ||
| + | |||
| + | OTA Integration Platform | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.1 — Partner Management & Marketplace Core ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Construire le socle Marketplace et Partenaires Enterprise. | ||
| + | |||
| + | Cette couche permet de gérer : | ||
| + | |||
| + | < | ||
| + | Agences | ||
| + | |||
| + | Revendeurs | ||
| + | |||
| + | Partenaires commerciaux | ||
| + | |||
| + | Affiliés | ||
| + | |||
| + | Apporteurs d' | ||
| + | |||
| + | Canaux partenaires | ||
| + | </ | ||
| + | |||
| + | afin d' | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | ✓ Partner | ||
| + | |||
| + | ✓ PartnerContract | ||
| + | |||
| + | ✓ PartnerCommission | ||
| + | |||
| + | ✓ MarketplaceListing | ||
| + | |||
| + | ✓ PartnerPerformance | ||
| + | |||
| + | ✓ PartnerPortal | ||
| + | |||
| + | ✓ Marketplace Core Platform | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture cible ====== | ||
| + | |||
| + | < | ||
| + | Marketplace | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Partner Management | ||
| + | |||
| + | ├── Partners | ||
| + | ├── Contracts | ||
| + | ├── Commissions | ||
| + | ├── Listings | ||
| + | ├── Performance | ||
| + | └── Partner Portal | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Distribution | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Reservations | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Finance | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.1-A ====== | ||
| + | |||
| + | ===== Extension Prisma ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 1 — Partner ====== | ||
| + | |||
| + | ===== Ajouter dans schema.prisma ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model Partner { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | partnerCode | ||
| + | |||
| + | type PartnerType | ||
| + | |||
| + | companyName | ||
| + | |||
| + | contactName | ||
| + | |||
| + | email | ||
| + | |||
| + | phone | ||
| + | |||
| + | website | ||
| + | |||
| + | status | ||
| + | |||
| + | active | ||
| + | @default(true) | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | updatedAt | ||
| + | @updatedAt | ||
| + | |||
| + | contracts | ||
| + | |||
| + | commissions | ||
| + | |||
| + | listings | ||
| + | |||
| + | @@unique([tenantId, | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([type]) | ||
| + | |||
| + | @@index([status]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 2 — PartnerContract ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model PartnerContract { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | partnerId | ||
| + | |||
| + | contractNumber | ||
| + | |||
| + | startDate | ||
| + | |||
| + | endDate | ||
| + | |||
| + | status | ||
| + | |||
| + | commissionModel | ||
| + | |||
| + | documentPath | ||
| + | |||
| + | metadata | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | updatedAt | ||
| + | @updatedAt | ||
| + | |||
| + | partner | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | onDelete: | ||
| + | ) | ||
| + | |||
| + | @@index([partnerId]) | ||
| + | |||
| + | @@index([status]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 3 — PartnerCommission ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model PartnerCommission { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | partnerId | ||
| + | |||
| + | reservationId | ||
| + | |||
| + | commissionType | ||
| + | |||
| + | baseAmount | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | commissionRate | ||
| + | |||
| + | commissionAmount | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | currency | ||
| + | |||
| + | status | ||
| + | |||
| + | calculatedAt | ||
| + | @default(now()) | ||
| + | |||
| + | paidAt | ||
| + | |||
| + | partner | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([partnerId]) | ||
| + | |||
| + | @@index([status]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4 — MarketplaceListing ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model MarketplaceListing { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | propertyId | ||
| + | |||
| + | partnerId | ||
| + | |||
| + | listingStatus | ||
| + | |||
| + | externalListingId | ||
| + | |||
| + | publishedAt | ||
| + | |||
| + | metadata | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | updatedAt | ||
| + | @updatedAt | ||
| + | |||
| + | partner | ||
| + | @relation( | ||
| + | fields: | ||
| + | references: | ||
| + | ) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([propertyId]) | ||
| + | |||
| + | @@index([partnerId]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 5 — PartnerPerformance ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model PartnerPerformance { | ||
| + | |||
| + | partnerId | ||
| + | @id | ||
| + | |||
| + | reservationsCount | ||
| + | @default(0) | ||
| + | |||
| + | revenue | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | commissionsPaid | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | conversionRate | ||
| + | |||
| + | satisfactionScore | ||
| + | |||
| + | updatedAt | ||
| + | @updatedAt | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 6 — PartnerPortalAccess ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model PartnerPortalAccess { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | partnerId | ||
| + | |||
| + | userId | ||
| + | |||
| + | role PartnerPortalRole | ||
| + | |||
| + | active | ||
| + | @default(true) | ||
| + | |||
| + | lastLoginAt | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | @@index([partnerId]) | ||
| + | |||
| + | @@index([userId]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 7 — Enums ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum PartnerType { | ||
| + | |||
| + | AGENCY | ||
| + | |||
| + | RESELLER | ||
| + | |||
| + | AFFILIATE | ||
| + | |||
| + | OTA | ||
| + | |||
| + | CORPORATE | ||
| + | |||
| + | DISTRIBUTOR | ||
| + | } | ||
| + | |||
| + | enum PartnerStatus { | ||
| + | |||
| + | PROSPECT | ||
| + | |||
| + | ACTIVE | ||
| + | |||
| + | SUSPENDED | ||
| + | |||
| + | TERMINATED | ||
| + | } | ||
| + | |||
| + | enum ContractStatus { | ||
| + | |||
| + | DRAFT | ||
| + | |||
| + | ACTIVE | ||
| + | |||
| + | EXPIRED | ||
| + | |||
| + | TERMINATED | ||
| + | } | ||
| + | |||
| + | enum CommissionModel { | ||
| + | |||
| + | FIXED | ||
| + | |||
| + | PERCENTAGE | ||
| + | |||
| + | TIERED | ||
| + | |||
| + | HYBRID | ||
| + | } | ||
| + | |||
| + | enum CommissionType { | ||
| + | |||
| + | RESERVATION | ||
| + | |||
| + | REVENUE_SHARE | ||
| + | |||
| + | LEAD | ||
| + | |||
| + | BONUS | ||
| + | } | ||
| + | |||
| + | enum CommissionStatus { | ||
| + | |||
| + | PENDING | ||
| + | |||
| + | APPROVED | ||
| + | |||
| + | PAID | ||
| + | |||
| + | CANCELLED | ||
| + | } | ||
| + | |||
| + | enum ListingStatus { | ||
| + | |||
| + | DRAFT | ||
| + | |||
| + | PUBLISHED | ||
| + | |||
| + | PAUSED | ||
| + | |||
| + | ARCHIVED | ||
| + | } | ||
| + | |||
| + | enum PartnerPortalRole { | ||
| + | |||
| + | ADMIN | ||
| + | |||
| + | MANAGER | ||
| + | |||
| + | ANALYST | ||
| + | |||
| + | VIEWER | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 8 — Migration ====== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name marketplace_partner_core | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.1-B ====== | ||
| + | |||
| + | ===== Partner Management Module ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 9 — Structure ====== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | |||
| + | ├── partners | ||
| + | ├── contracts | ||
| + | ├── commissions | ||
| + | ├── listings | ||
| + | ├── performance | ||
| + | ├── portal | ||
| + | └── partners.module.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 10 — Services ====== | ||
| + | |||
| + | < | ||
| + | PartnerService | ||
| + | |||
| + | PartnerContractService | ||
| + | |||
| + | PartnerCommissionService | ||
| + | |||
| + | MarketplaceListingService | ||
| + | |||
| + | PartnerPerformanceService | ||
| + | |||
| + | PartnerPortalService | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.1-C ====== | ||
| + | |||
| + | ===== Gestion des Partenaires ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 11 — PartnerService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | partner.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | createPartner() | ||
| + | |||
| + | updatePartner() | ||
| + | |||
| + | activatePartner() | ||
| + | |||
| + | suspendPartner() | ||
| + | |||
| + | searchPartners() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 12 — Segmentation ====== | ||
| + | |||
| + | ===== Supporter ===== | ||
| + | |||
| + | < | ||
| + | Agences | ||
| + | |||
| + | Affiliés | ||
| + | |||
| + | OTA | ||
| + | |||
| + | Corporate | ||
| + | |||
| + | Revendeurs | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.1-D ====== | ||
| + | |||
| + | ===== Gestion Contractuelle ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 13 — PartnerContractService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | partner-contract.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | createContract() | ||
| + | |||
| + | renewContract() | ||
| + | |||
| + | terminateContract() | ||
| + | |||
| + | uploadContract() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 14 — Gestion ====== | ||
| + | |||
| + | < | ||
| + | Contrats | ||
| + | |||
| + | Avenants | ||
| + | |||
| + | Renouvellements | ||
| + | |||
| + | Échéances | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 15 — Alertes ====== | ||
| + | |||
| + | ===== Déclencher ===== | ||
| + | |||
| + | à : | ||
| + | |||
| + | < | ||
| + | 30 jours | ||
| + | |||
| + | 15 jours | ||
| + | |||
| + | 7 jours | ||
| + | </ | ||
| + | |||
| + | avant expiration. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.1-E ====== | ||
| + | |||
| + | ===== Gestion des Commissions ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 16 — PartnerCommissionService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | partner-commission.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Calculer ===== | ||
| + | |||
| + | < | ||
| + | Commission fixe | ||
| + | |||
| + | Pourcentage | ||
| + | |||
| + | Paliers | ||
| + | |||
| + | Bonus | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 17 — Méthodes ====== | ||
| + | |||
| + | <code ts> | ||
| + | calculateCommission() | ||
| + | |||
| + | approveCommission() | ||
| + | |||
| + | payCommission() | ||
| + | |||
| + | generateStatement() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 18 — Intégration ====== | ||
| + | |||
| + | ===== Connecter ===== | ||
| + | |||
| + | < | ||
| + | Reservations | ||
| + | |||
| + | Invoices | ||
| + | |||
| + | Payments | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.1-F ====== | ||
| + | |||
| + | ===== Marketplace Listings ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 19 — MarketplaceListingService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | marketplace-listing.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Méthodes ===== | ||
| + | |||
| + | <code ts> | ||
| + | publishListing() | ||
| + | |||
| + | pauseListing() | ||
| + | |||
| + | archiveListing() | ||
| + | |||
| + | syncListing() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 20 — Supporter ===== | ||
| + | |||
| + | < | ||
| + | Publication | ||
| + | |||
| + | Synchronisation | ||
| + | |||
| + | Statut | ||
| + | |||
| + | Distribution | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.1-G ====== | ||
| + | |||
| + | ===== Performance Partenaires ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 21 — PartnerPerformanceService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | partner-performance.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Mesurer ===== | ||
| + | |||
| + | < | ||
| + | Revenue | ||
| + | |||
| + | Réservations | ||
| + | |||
| + | Conversion | ||
| + | |||
| + | Commissions | ||
| + | |||
| + | Satisfaction | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 22 — KPIs ====== | ||
| + | |||
| + | < | ||
| + | Revenue Generated | ||
| + | |||
| + | Bookings | ||
| + | |||
| + | Average Booking Value | ||
| + | |||
| + | Commission Ratio | ||
| + | |||
| + | Partner Score | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.1-H ====== | ||
| + | |||
| + | ===== Portail Partenaire ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 23 — PartnerPortalService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | partner-portal.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Fournir ===== | ||
| + | |||
| + | < | ||
| + | Dashboard | ||
| + | |||
| + | Commissions | ||
| + | |||
| + | Réservations | ||
| + | |||
| + | Listings | ||
| + | |||
| + | Contrats | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 24 — Accès ====== | ||
| + | |||
| + | ===== Supporter ===== | ||
| + | |||
| + | < | ||
| + | Admin | ||
| + | |||
| + | Manager | ||
| + | |||
| + | Viewer | ||
| + | </ | ||
| + | |||
| + | pour chaque partenaire. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.1-I ====== | ||
| + | |||
| + | ===== API Marketplace ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 25 — Endpoints ====== | ||
| + | |||
| + | <code http> | ||
| + | GET /partners | ||
| + | |||
| + | GET / | ||
| + | |||
| + | POST / | ||
| + | |||
| + | PUT / | ||
| + | |||
| + | GET / | ||
| + | |||
| + | GET / | ||
| + | |||
| + | GET / | ||
| + | |||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 26 — Dashboard ====== | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.1-J ====== | ||
| + | |||
| + | ===== Gouvernance ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 27 — Permissions ====== | ||
| + | |||
| + | < | ||
| + | partner.read | ||
| + | |||
| + | partner.create | ||
| + | |||
| + | partner.update | ||
| + | |||
| + | partner.contracts | ||
| + | |||
| + | partner.commissions | ||
| + | |||
| + | partner.portal | ||
| + | |||
| + | partner.admin | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 28 — Audit ====== | ||
| + | |||
| + | < | ||
| + | PARTNER_CREATED | ||
| + | |||
| + | PARTNER_ACTIVATED | ||
| + | |||
| + | CONTRACT_CREATED | ||
| + | |||
| + | LISTING_PUBLISHED | ||
| + | |||
| + | COMMISSION_CALCULATED | ||
| + | |||
| + | PARTNER_PORTAL_LOGIN | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 29 — Jobs ====== | ||
| + | |||
| + | < | ||
| + | Toutes les nuits | ||
| + | |||
| + | Commission Calculation | ||
| + | |||
| + | Performance Refresh | ||
| + | |||
| + | Contract Expiration Check | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 7-B.2 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Partner Intelligence | ||
| + | |||
| + | Partner Scoring | ||
| + | |||
| + | Commission Optimization | ||
| + | |||
| + | Marketplace Analytics | ||
| + | |||
| + | Partner Recommendations | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | Le Sprint 7-B.1 est terminé lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ Partner créé | ||
| + | |||
| + | ✓ PartnerContract créé | ||
| + | |||
| + | ✓ PartnerCommission créé | ||
| + | |||
| + | ✓ MarketplaceListing créé | ||
| + | |||
| + | ✓ PartnerPerformance créé | ||
| + | |||
| + | ✓ PartnerPortal créé | ||
| + | |||
| + | ✓ Marketplace Core opérationnel | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | Partner | ||
| + | |||
| + | PartnerContract | ||
| + | |||
| + | PartnerCommission | ||
| + | |||
| + | MarketplaceListing | ||
| + | |||
| + | PartnerPerformance | ||
| + | |||
| + | PartnerPortalAccess | ||
| + | |||
| + | PartnerService | ||
| + | |||
| + | PartnerContractService | ||
| + | |||
| + | PartnerCommissionService | ||
| + | |||
| + | MarketplaceListingService | ||
| + | |||
| + | PartnerPerformanceService | ||
| + | |||
| + | PartnerPortalService | ||
| + | |||
| + | Marketplace Core Platform | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.2 — Partner Intelligence & Marketplace Analytics ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Transformer le portail partenaires en plateforme d' | ||
| + | |||
| + | Cette couche permet : | ||
| + | |||
| + | < | ||
| + | Scoring partenaires | ||
| + | |||
| + | Prévisions revenus | ||
| + | |||
| + | Optimisation commissions | ||
| + | |||
| + | Analyse marketplace | ||
| + | |||
| + | Recommandations IA | ||
| + | |||
| + | Pilotage du réseau partenaires | ||
| + | </ | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | ✓ Partner Score | ||
| + | |||
| + | ✓ Partner Forecasting | ||
| + | |||
| + | ✓ Commission Intelligence | ||
| + | |||
| + | ✓ Marketplace Analytics | ||
| + | |||
| + | ✓ Partner Recommendations | ||
| + | |||
| + | ✓ Partner Health Score | ||
| + | |||
| + | ✓ Partner Intelligence Platform | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture cible ====== | ||
| + | |||
| + | < | ||
| + | Partner Ecosystem | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Partner Intelligence Engine | ||
| + | |||
| + | ├── Partner Scoring | ||
| + | ├── Revenue Forecasting | ||
| + | ├── Commission Analytics | ||
| + | ├── Marketplace Analytics | ||
| + | ├── Recommendation Engine | ||
| + | ├── Health Scoring | ||
| + | └── Executive Insights | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Partner Management | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Revenue Growth | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.2-A ====== | ||
| + | |||
| + | ===== Extension Prisma ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 1 — PartnerScore ====== | ||
| + | |||
| + | ===== Ajouter dans schema.prisma ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model PartnerScore { | ||
| + | |||
| + | partnerId | ||
| + | @id | ||
| + | |||
| + | overallScore | ||
| + | |||
| + | revenueScore | ||
| + | |||
| + | growthScore | ||
| + | |||
| + | qualityScore | ||
| + | |||
| + | conversionScore | ||
| + | |||
| + | satisfactionScore | ||
| + | |||
| + | calculatedAt | ||
| + | @updatedAt | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 2 — PartnerForecast ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model PartnerForecast { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | partnerId | ||
| + | |||
| + | forecastType | ||
| + | |||
| + | forecastDate | ||
| + | |||
| + | predictedValue | ||
| + | |||
| + | confidenceScore | ||
| + | |||
| + | generatedAt | ||
| + | @default(now()) | ||
| + | |||
| + | @@index([partnerId]) | ||
| + | |||
| + | @@index([forecastType]) | ||
| + | |||
| + | @@index([forecastDate]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 3 — PartnerInsight ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model PartnerInsight { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | partnerId | ||
| + | |||
| + | category | ||
| + | |||
| + | severity | ||
| + | |||
| + | title | ||
| + | |||
| + | description | ||
| + | |||
| + | recommendation | ||
| + | |||
| + | impactScore | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | @@index([partnerId]) | ||
| + | |||
| + | @@index([category]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4 — MarketplaceAnalyticsSnapshot ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model MarketplaceAnalyticsSnapshot { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | snapshotDate | ||
| + | |||
| + | activePartners | ||
| + | |||
| + | activeListings | ||
| + | |||
| + | totalRevenue | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | totalCommissions | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | conversionRate | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | |||
| + | @@index([snapshotDate]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 5 — PartnerRecommendation ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model PartnerRecommendation { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | partnerId | ||
| + | |||
| + | recommendationType | ||
| + | |||
| + | priority | ||
| + | |||
| + | title | ||
| + | |||
| + | description | ||
| + | |||
| + | estimatedImpact | ||
| + | |||
| + | implemented | ||
| + | @default(false) | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | @@index([partnerId]) | ||
| + | |||
| + | @@index([priority]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 6 — Enums ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum PartnerForecastType { | ||
| + | |||
| + | REVENUE | ||
| + | |||
| + | BOOKINGS | ||
| + | |||
| + | COMMISSIONS | ||
| + | |||
| + | CONVERSION | ||
| + | } | ||
| + | |||
| + | enum PartnerInsightCategory { | ||
| + | |||
| + | REVENUE | ||
| + | |||
| + | PERFORMANCE | ||
| + | |||
| + | COMMISSION | ||
| + | |||
| + | MARKETPLACE | ||
| + | |||
| + | GROWTH | ||
| + | } | ||
| + | |||
| + | enum PartnerRecommendationType { | ||
| + | |||
| + | PROMOTION | ||
| + | |||
| + | COMMISSION_ADJUSTMENT | ||
| + | |||
| + | EXPANSION | ||
| + | |||
| + | TRAINING | ||
| + | |||
| + | REACTIVATION | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 7 — Migration ====== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name partner_intelligence | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.2-B ====== | ||
| + | |||
| + | ===== Partner Intelligence Module ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 8 — Structure ====== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | |||
| + | ├── scoring | ||
| + | ├── forecasting | ||
| + | ├── commissions | ||
| + | ├── analytics | ||
| + | ├── recommendations | ||
| + | ├── health | ||
| + | └── partner-intelligence.module.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 9 — Services ====== | ||
| + | |||
| + | < | ||
| + | PartnerScoreService | ||
| + | |||
| + | PartnerForecastService | ||
| + | |||
| + | CommissionIntelligenceService | ||
| + | |||
| + | MarketplaceAnalyticsService | ||
| + | |||
| + | PartnerRecommendationService | ||
| + | |||
| + | PartnerHealthScoreService | ||
| + | |||
| + | PartnerInsightService | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.2-C ====== | ||
| + | |||
| + | ===== Partner Score ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 10 — PartnerScoreService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | partner-score.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Calculer ===== | ||
| + | |||
| + | < | ||
| + | Revenue | ||
| + | |||
| + | Bookings | ||
| + | |||
| + | Conversion | ||
| + | |||
| + | Satisfaction | ||
| + | |||
| + | Growth | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 11 — Pondération ====== | ||
| + | |||
| + | < | ||
| + | Revenue | ||
| + | |||
| + | Bookings | ||
| + | |||
| + | Growth | ||
| + | |||
| + | Conversion | ||
| + | |||
| + | Satisfaction | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 12 — Classification ====== | ||
| + | |||
| + | < | ||
| + | 90-100 Elite | ||
| + | |||
| + | 75-89 Premium | ||
| + | |||
| + | 50-74 Standard | ||
| + | |||
| + | 0-49 At Risk | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.2-D ====== | ||
| + | |||
| + | ===== Partner Forecasting ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 13 — PartnerForecastService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | partner-forecast.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Prévoir ===== | ||
| + | |||
| + | < | ||
| + | Revenue | ||
| + | |||
| + | Bookings | ||
| + | |||
| + | Commissions | ||
| + | |||
| + | Growth | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 14 — Méthodes ====== | ||
| + | |||
| + | <code ts> | ||
| + | forecastRevenue() | ||
| + | |||
| + | forecastBookings() | ||
| + | |||
| + | forecastCommissions() | ||
| + | |||
| + | forecastGrowth() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 15 — Horizons ====== | ||
| + | |||
| + | < | ||
| + | 30 jours | ||
| + | |||
| + | 90 jours | ||
| + | |||
| + | 12 mois | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.2-E ====== | ||
| + | |||
| + | ===== Commission Intelligence ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 16 — CommissionIntelligenceService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | commission-intelligence.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Analyser ===== | ||
| + | |||
| + | < | ||
| + | Commission Cost | ||
| + | |||
| + | Commission ROI | ||
| + | |||
| + | Revenue Share | ||
| + | |||
| + | Partner Profitability | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 17 — Identifier ====== | ||
| + | |||
| + | < | ||
| + | Sous-performance | ||
| + | |||
| + | Sur-commission | ||
| + | |||
| + | Opportunités optimisation | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 18 — Exemple ====== | ||
| + | |||
| + | < | ||
| + | Commission | ||
| + | |||
| + | 18% | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | ROI faible | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Révision recommandée | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.2-F ====== | ||
| + | |||
| + | ===== Marketplace Analytics ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 19 — MarketplaceAnalyticsService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | marketplace-analytics.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Mesurer ===== | ||
| + | |||
| + | < | ||
| + | Marketplace Revenue | ||
| + | |||
| + | Partner Revenue | ||
| + | |||
| + | Bookings | ||
| + | |||
| + | Conversion | ||
| + | |||
| + | Commissions | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 20 — KPIs ====== | ||
| + | |||
| + | < | ||
| + | Revenue Per Partner | ||
| + | |||
| + | Bookings Per Partner | ||
| + | |||
| + | Commission Ratio | ||
| + | |||
| + | Partner Growth | ||
| + | |||
| + | Marketplace Health | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 21 — Classements ====== | ||
| + | |||
| + | ===== Produire ===== | ||
| + | |||
| + | < | ||
| + | Top Revenue | ||
| + | |||
| + | Top Conversion | ||
| + | |||
| + | Top Growth | ||
| + | |||
| + | Top ROI | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.2-G ====== | ||
| + | |||
| + | ===== Partner Health Score ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 22 — PartnerHealthScoreService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | partner-health-score.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Calcul ===== | ||
| + | |||
| + | < | ||
| + | Revenue | ||
| + | |||
| + | Growth | ||
| + | |||
| + | Bookings | ||
| + | |||
| + | Conversion | ||
| + | |||
| + | Satisfaction | ||
| + | |||
| + | Activity | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 23 — Classification ====== | ||
| + | |||
| + | < | ||
| + | 90-100 Excellent | ||
| + | |||
| + | 75-89 Healthy | ||
| + | |||
| + | 50-74 Warning | ||
| + | |||
| + | 0-49 Critical | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 24 — Exemple ====== | ||
| + | |||
| + | < | ||
| + | Partner Health | ||
| + | |||
| + | 92 | ||
| + | |||
| + | Excellent | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.2-H ====== | ||
| + | |||
| + | ===== Recommandations IA ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 25 — PartnerRecommendationService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | partner-recommendation.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Générer ===== | ||
| + | |||
| + | < | ||
| + | Commission Adjustment | ||
| + | |||
| + | Cross-Sell | ||
| + | |||
| + | Upsell | ||
| + | |||
| + | Expansion | ||
| + | |||
| + | Reactivation | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 26 — Exemple ====== | ||
| + | |||
| + | < | ||
| + | Agence Europe | ||
| + | |||
| + | ↑ 28% croissance | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Expansion recommandée | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | < | ||
| + | Affilié A45 | ||
| + | |||
| + | ↓ activité | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Programme réactivation | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.2-I ====== | ||
| + | |||
| + | ===== Dashboard Intelligence ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 27 — Endpoints ====== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | |||
| + | GET / | ||
| + | |||
| + | GET / | ||
| + | |||
| + | GET / | ||
| + | |||
| + | GET / | ||
| + | |||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 28 — Exemple ====== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 29 — Analytics ====== | ||
| + | |||
| + | ===== Mesurer ===== | ||
| + | |||
| + | < | ||
| + | Forecast Accuracy | ||
| + | |||
| + | Partner ROI | ||
| + | |||
| + | Commission Efficiency | ||
| + | |||
| + | Partner Retention | ||
| + | |||
| + | Marketplace Growth | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-B.2-J ====== | ||
| + | |||
| + | ===== Gouvernance ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 30 — Permissions ====== | ||
| + | |||
| + | < | ||
| + | partner.analytics.read | ||
| + | |||
| + | partner.forecast.read | ||
| + | |||
| + | partner.recommendations.read | ||
| + | |||
| + | partner.health.read | ||
| + | |||
| + | partner.intelligence.admin | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 31 — Audit ====== | ||
| + | |||
| + | < | ||
| + | PARTNER_SCORE_UPDATED | ||
| + | |||
| + | PARTNER_FORECAST_GENERATED | ||
| + | |||
| + | COMMISSION_ANALYSIS_COMPLETED | ||
| + | |||
| + | MARKETPLACE_ANALYTICS_REFRESHED | ||
| + | |||
| + | PARTNER_RECOMMENDATION_CREATED | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 32 — Jobs ====== | ||
| + | |||
| + | < | ||
| + | Toutes les nuits | ||
| + | |||
| + | Partner Score Refresh | ||
| + | |||
| + | Partner Health Refresh | ||
| + | |||
| + | Forecast Generation | ||
| + | |||
| + | Recommendation Generation | ||
| + | |||
| + | Marketplace Analytics Snapshot | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 7-C.1 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Revenue Sharing | ||
| + | |||
| + | Settlement Engine | ||
| + | |||
| + | Partner Billing | ||
| + | |||
| + | Commission Payments | ||
| + | |||
| + | Financial Distribution | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | Le Sprint 7-B.2 est terminé lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ Partner Score créé | ||
| + | |||
| + | ✓ Partner Forecasting créé | ||
| + | |||
| + | ✓ Commission Intelligence créée | ||
| + | |||
| + | ✓ Marketplace Analytics créé | ||
| + | |||
| + | ✓ Partner Recommendations créées | ||
| + | |||
| + | ✓ Partner Health Score créé | ||
| + | |||
| + | ✓ Partner Intelligence opérationnel | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | PartnerScore | ||
| + | |||
| + | PartnerForecast | ||
| + | |||
| + | PartnerInsight | ||
| + | |||
| + | MarketplaceAnalyticsSnapshot | ||
| + | |||
| + | PartnerRecommendation | ||
| + | |||
| + | PartnerScoreService | ||
| + | |||
| + | PartnerForecastService | ||
| + | |||
| + | CommissionIntelligenceService | ||
| + | |||
| + | MarketplaceAnalyticsService | ||
| + | |||
| + | PartnerRecommendationService | ||
| + | |||
| + | PartnerHealthScoreService | ||
| + | |||
| + | Partner Intelligence Platform | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.1 — Revenue Sharing & Settlement Core ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Construire le moteur financier partenaires Enterprise. | ||
| + | |||
| + | Cette couche permet : | ||
| + | |||
| + | < | ||
| + | Partage de revenus | ||
| + | |||
| + | Calcul commissions | ||
| + | |||
| + | Paiements partenaires | ||
| + | |||
| + | Facturation commissions | ||
| + | |||
| + | Grand livre partenaire | ||
| + | |||
| + | Réconciliation financière | ||
| + | </ | ||
| + | |||
| + | afin de sécuriser l' | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | ✓ Revenue Share | ||
| + | |||
| + | ✓ Settlement | ||
| + | |||
| + | ✓ Partner Payout | ||
| + | |||
| + | ✓ Commission Billing | ||
| + | |||
| + | ✓ Partner Ledger | ||
| + | |||
| + | ✓ Financial Reconciliation | ||
| + | |||
| + | ✓ Partner Financial Platform | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture cible ====== | ||
| + | |||
| + | < | ||
| + | Reservations | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Revenue Engine | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Settlement Engine | ||
| + | |||
| + | ├── Revenue Sharing | ||
| + | ├── Commission Billing | ||
| + | ├── Partner Ledger | ||
| + | ├── Payout Engine | ||
| + | ├── Reconciliation | ||
| + | └── Financial Reporting | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Partners | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Accounting | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.1-A ====== | ||
| + | |||
| + | ===== Extension Prisma ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 1 — RevenueShare ====== | ||
| + | |||
| + | ===== Ajouter dans schema.prisma ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model RevenueShare { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | reservationId | ||
| + | |||
| + | partnerId | ||
| + | |||
| + | grossRevenue | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | partnerShare | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | platformShare | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | shareRate | ||
| + | |||
| + | calculatedAt | ||
| + | @default(now()) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | @@index([partnerId]) | ||
| + | @@index([reservationId]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 2 — Settlement ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model Settlement { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | partnerId | ||
| + | |||
| + | settlementNumber | ||
| + | |||
| + | periodStart | ||
| + | |||
| + | periodEnd | ||
| + | |||
| + | grossAmount | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | commissionAmount | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | netAmount | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | status | ||
| + | |||
| + | generatedAt | ||
| + | @default(now()) | ||
| + | |||
| + | completedAt | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | @@index([partnerId]) | ||
| + | @@index([status]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 3 — PartnerPayout ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model PartnerPayout { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | settlementId | ||
| + | |||
| + | partnerId | ||
| + | |||
| + | payoutMethod | ||
| + | |||
| + | payoutReference | ||
| + | |||
| + | amount | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | currency | ||
| + | |||
| + | status | ||
| + | |||
| + | paidAt | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | @@index([partnerId]) | ||
| + | @@index([status]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4 — PartnerLedger ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model PartnerLedger { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | partnerId | ||
| + | |||
| + | entryType | ||
| + | |||
| + | referenceType | ||
| + | |||
| + | referenceId | ||
| + | |||
| + | debit | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | credit | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | balance | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | @@index([partnerId]) | ||
| + | @@index([entryType]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 5 — ReconciliationRecord ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model ReconciliationRecord { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | tenantId | ||
| + | |||
| + | reconciliationDate | ||
| + | |||
| + | sourceType | ||
| + | |||
| + | expectedAmount | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | actualAmount | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | variance | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | status | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | @@index([tenantId]) | ||
| + | @@index([status]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 6 — Enums ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum SettlementStatus { | ||
| + | |||
| + | DRAFT | ||
| + | |||
| + | GENERATED | ||
| + | |||
| + | APPROVED | ||
| + | |||
| + | PAID | ||
| + | |||
| + | CANCELLED | ||
| + | } | ||
| + | |||
| + | enum PayoutMethod { | ||
| + | |||
| + | BANK_TRANSFER | ||
| + | |||
| + | SEPA | ||
| + | |||
| + | STRIPE_CONNECT | ||
| + | |||
| + | PAYPAL | ||
| + | } | ||
| + | |||
| + | enum PayoutStatus { | ||
| + | |||
| + | PENDING | ||
| + | |||
| + | PROCESSING | ||
| + | |||
| + | PAID | ||
| + | |||
| + | FAILED | ||
| + | |||
| + | CANCELLED | ||
| + | } | ||
| + | |||
| + | enum LedgerEntryType { | ||
| + | |||
| + | REVENUE | ||
| + | |||
| + | COMMISSION | ||
| + | |||
| + | PAYOUT | ||
| + | |||
| + | ADJUSTMENT | ||
| + | |||
| + | REFUND | ||
| + | } | ||
| + | |||
| + | enum ReconciliationSource { | ||
| + | |||
| + | PAYMENTS | ||
| + | |||
| + | SETTLEMENTS | ||
| + | |||
| + | COMMISSIONS | ||
| + | |||
| + | PAYOUTS | ||
| + | } | ||
| + | |||
| + | enum ReconciliationStatus { | ||
| + | |||
| + | MATCHED | ||
| + | |||
| + | VARIANCE | ||
| + | |||
| + | INVESTIGATION | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 7 — Migration ====== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name revenue_sharing_core | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.1-B ====== | ||
| + | |||
| + | ===== Settlement Module ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 8 — Structure ====== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | |||
| + | ├── revenue-share | ||
| + | ├── settlements | ||
| + | ├── payouts | ||
| + | ├── ledger | ||
| + | ├── reconciliation | ||
| + | └── partner-finance.module.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 9 — Services ====== | ||
| + | |||
| + | < | ||
| + | RevenueShareService | ||
| + | |||
| + | SettlementService | ||
| + | |||
| + | PartnerPayoutService | ||
| + | |||
| + | PartnerLedgerService | ||
| + | |||
| + | FinancialReconciliationService | ||
| + | |||
| + | PartnerFinanceDashboardService | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.1-C ====== | ||
| + | |||
| + | ===== Revenue Sharing ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 10 — RevenueShareService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | revenue-share.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Calculer ===== | ||
| + | |||
| + | < | ||
| + | Revenue Split | ||
| + | |||
| + | Partner Share | ||
| + | |||
| + | Platform Share | ||
| + | |||
| + | Commission Deduction | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 11 — Modèles ====== | ||
| + | |||
| + | ===== Supporter ===== | ||
| + | |||
| + | < | ||
| + | Pourcentage | ||
| + | |||
| + | Fixe | ||
| + | |||
| + | Paliers | ||
| + | |||
| + | Hybride | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 12 — Méthodes ====== | ||
| + | |||
| + | <code ts> | ||
| + | calculateRevenueShare() | ||
| + | |||
| + | applyCommissionModel() | ||
| + | |||
| + | generateRevenueEntries() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.1-D ====== | ||
| + | |||
| + | ===== Settlement Engine ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 13 — SettlementService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | settlement.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Générer ===== | ||
| + | |||
| + | < | ||
| + | Partner Statements | ||
| + | |||
| + | Settlement Reports | ||
| + | |||
| + | Financial Summaries | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 14 — Méthodes ====== | ||
| + | |||
| + | <code ts> | ||
| + | generateSettlement() | ||
| + | |||
| + | approveSettlement() | ||
| + | |||
| + | closeSettlement() | ||
| + | |||
| + | exportSettlement() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 15 — Périodes ====== | ||
| + | |||
| + | < | ||
| + | Hebdomadaire | ||
| + | |||
| + | Mensuelle | ||
| + | |||
| + | Trimestrielle | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.1-E ====== | ||
| + | |||
| + | ===== Partner Payout ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 16 — PartnerPayoutService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | partner-payout.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Supporter ===== | ||
| + | |||
| + | < | ||
| + | SEPA | ||
| + | |||
| + | Virement bancaire | ||
| + | |||
| + | Stripe Connect | ||
| + | |||
| + | PayPal | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 17 — Méthodes ====== | ||
| + | |||
| + | <code ts> | ||
| + | createPayout() | ||
| + | |||
| + | executePayout() | ||
| + | |||
| + | retryPayout() | ||
| + | |||
| + | cancelPayout() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 18 — Sécurité ====== | ||
| + | |||
| + | ===== Exiger ===== | ||
| + | |||
| + | < | ||
| + | Double validation | ||
| + | |||
| + | Montant maximum | ||
| + | |||
| + | Journalisation complète | ||
| + | </ | ||
| + | |||
| + | pour les paiements. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.1-F ====== | ||
| + | |||
| + | ===== Partner Ledger ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 19 — PartnerLedgerService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | partner-ledger.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Fonction ===== | ||
| + | |||
| + | Grand livre comptable partenaire. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 20 — Écritures ====== | ||
| + | |||
| + | < | ||
| + | Revenue | ||
| + | |||
| + | Commission | ||
| + | |||
| + | Payout | ||
| + | |||
| + | Refund | ||
| + | |||
| + | Adjustment | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 21 — Méthodes ====== | ||
| + | |||
| + | <code ts> | ||
| + | postEntry() | ||
| + | |||
| + | calculateBalance() | ||
| + | |||
| + | generateStatement() | ||
| + | |||
| + | exportLedger() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.1-G ====== | ||
| + | |||
| + | ===== Financial Reconciliation ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 22 — FinancialReconciliationService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | financial-reconciliation.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Réconcilier ===== | ||
| + | |||
| + | < | ||
| + | Payments | ||
| + | |||
| + | Settlements | ||
| + | |||
| + | Payouts | ||
| + | |||
| + | Commissions | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 23 — Détection ====== | ||
| + | |||
| + | ===== Identifier ===== | ||
| + | |||
| + | < | ||
| + | Écarts | ||
| + | |||
| + | Paiements manquants | ||
| + | |||
| + | Doubles paiements | ||
| + | |||
| + | Commissions incorrectes | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 24 — Méthodes ====== | ||
| + | |||
| + | <code ts> | ||
| + | runReconciliation() | ||
| + | |||
| + | detectVariance() | ||
| + | |||
| + | createInvestigation() | ||
| + | |||
| + | closeInvestigation() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.1-H ====== | ||
| + | |||
| + | ===== Dashboard Financier ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 25 — PartnerFinanceDashboardService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | partner-finance-dashboard.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Afficher ===== | ||
| + | |||
| + | < | ||
| + | Revenue Shared | ||
| + | |||
| + | Pending Settlements | ||
| + | |||
| + | Payouts | ||
| + | |||
| + | Commissions | ||
| + | |||
| + | Outstanding Balance | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 26 — KPIs ====== | ||
| + | |||
| + | < | ||
| + | Partner Revenue | ||
| + | |||
| + | Commission Cost | ||
| + | |||
| + | Settlement Cycle Time | ||
| + | |||
| + | Payout Success Rate | ||
| + | |||
| + | Reconciliation Accuracy | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.1-I ====== | ||
| + | |||
| + | ===== API Finance Partenaires ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 27 — Endpoints ====== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | |||
| + | GET / | ||
| + | |||
| + | POST / | ||
| + | |||
| + | POST / | ||
| + | |||
| + | GET / | ||
| + | |||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 28 — Exemple ====== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.1-J ====== | ||
| + | |||
| + | ===== Gouvernance ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 29 — Permissions ====== | ||
| + | |||
| + | < | ||
| + | partner.finance.read | ||
| + | |||
| + | partner.finance.settlement | ||
| + | |||
| + | partner.finance.payout | ||
| + | |||
| + | partner.finance.reconciliation | ||
| + | |||
| + | partner.finance.approve | ||
| + | |||
| + | partner.finance.admin | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 30 — Audit ====== | ||
| + | |||
| + | < | ||
| + | REVENUE_SHARE_CALCULATED | ||
| + | |||
| + | SETTLEMENT_GENERATED | ||
| + | |||
| + | SETTLEMENT_APPROVED | ||
| + | |||
| + | PAYOUT_CREATED | ||
| + | |||
| + | PAYOUT_EXECUTED | ||
| + | |||
| + | RECONCILIATION_COMPLETED | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 31 — Jobs ====== | ||
| + | |||
| + | < | ||
| + | Toutes les nuits | ||
| + | |||
| + | Revenue Share Calculation | ||
| + | |||
| + | Settlement Generation | ||
| + | |||
| + | Reconciliation Run | ||
| + | |||
| + | Toutes les heures | ||
| + | |||
| + | Payout Processing | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 7-C.2 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Revenue Intelligence | ||
| + | |||
| + | Commission Optimization | ||
| + | |||
| + | Cash Forecasting | ||
| + | |||
| + | Partner Profitability | ||
| + | |||
| + | Financial Analytics | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | Le Sprint 7-C.1 est terminé lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ Revenue Share créé | ||
| + | |||
| + | ✓ Settlement créé | ||
| + | |||
| + | ✓ Partner Payout créé | ||
| + | |||
| + | ✓ Partner Ledger créé | ||
| + | |||
| + | ✓ Financial Reconciliation créé | ||
| + | |||
| + | ✓ Dashboard financier créé | ||
| + | |||
| + | ✓ Moteur financier partenaires opérationnel | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | RevenueShare | ||
| + | |||
| + | Settlement | ||
| + | |||
| + | PartnerPayout | ||
| + | |||
| + | PartnerLedger | ||
| + | |||
| + | ReconciliationRecord | ||
| + | |||
| + | RevenueShareService | ||
| + | |||
| + | SettlementService | ||
| + | |||
| + | PartnerPayoutService | ||
| + | |||
| + | PartnerLedgerService | ||
| + | |||
| + | FinancialReconciliationService | ||
| + | |||
| + | PartnerFinanceDashboardService | ||
| + | |||
| + | Partner Financial Platform | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.2 — Revenue Intelligence & Partner Profitability ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Transformer le moteur financier partenaires en plateforme d' | ||
| + | |||
| + | Cette couche permet : | ||
| + | |||
| + | < | ||
| + | Rentabilité partenaires | ||
| + | |||
| + | Prévisions revenus | ||
| + | |||
| + | Prévisions trésorerie | ||
| + | |||
| + | Optimisation commissions | ||
| + | |||
| + | Intelligence des règlements | ||
| + | |||
| + | Pilotage financier avancé | ||
| + | </ | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | ✓ Partner Profitability | ||
| + | |||
| + | ✓ Commission Optimization | ||
| + | |||
| + | ✓ Revenue Forecasting | ||
| + | |||
| + | ✓ Cash Flow Forecast | ||
| + | |||
| + | ✓ Settlement Intelligence | ||
| + | |||
| + | ✓ Financial Health Score | ||
| + | |||
| + | ✓ Revenue Intelligence Platform | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture cible ====== | ||
| + | |||
| + | < | ||
| + | Partner Finance | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Revenue Intelligence Engine | ||
| + | |||
| + | ├── Profitability Engine | ||
| + | ├── Commission Intelligence | ||
| + | ├── Revenue Forecasting | ||
| + | ├── Cash Flow Forecasting | ||
| + | ├── Settlement Intelligence | ||
| + | ├── Financial Health Scoring | ||
| + | └── Executive Financial Insights | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Partner Finance Dashboard | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Financial Planning | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.2-A ====== | ||
| + | |||
| + | ===== Extension Prisma ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 1 — PartnerProfitability ====== | ||
| + | |||
| + | ===== Ajouter dans schema.prisma ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model PartnerProfitability { | ||
| + | |||
| + | partnerId | ||
| + | @id | ||
| + | |||
| + | totalRevenue | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | totalCommission | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | netProfit | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | marginPercent | ||
| + | |||
| + | roi | ||
| + | |||
| + | calculatedAt | ||
| + | @updatedAt | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 2 — FinancialForecast ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model FinancialForecast { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | partnerId | ||
| + | |||
| + | forecastType | ||
| + | |||
| + | forecastDate | ||
| + | |||
| + | predictedValue | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | confidenceScore | ||
| + | |||
| + | generatedAt | ||
| + | @default(now()) | ||
| + | |||
| + | @@index([partnerId]) | ||
| + | |||
| + | @@index([forecastType]) | ||
| + | |||
| + | @@index([forecastDate]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 3 — SettlementInsight ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model SettlementInsight { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | settlementId | ||
| + | |||
| + | partnerId | ||
| + | |||
| + | insightType | ||
| + | |||
| + | severity | ||
| + | |||
| + | title | ||
| + | |||
| + | description | ||
| + | |||
| + | recommendation | ||
| + | |||
| + | impactAmount | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | @@index([partnerId]) | ||
| + | |||
| + | @@index([insightType]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4 — FinancialHealthScore ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model FinancialHealthScore { | ||
| + | |||
| + | partnerId | ||
| + | @id | ||
| + | |||
| + | overallScore | ||
| + | |||
| + | profitabilityScore | ||
| + | |||
| + | paymentScore | ||
| + | |||
| + | growthScore | ||
| + | |||
| + | settlementScore | ||
| + | |||
| + | riskScore | ||
| + | |||
| + | calculatedAt | ||
| + | @updatedAt | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 5 — CommissionOptimization ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | model CommissionOptimization { | ||
| + | |||
| + | id String | ||
| + | @id | ||
| + | @default(uuid()) | ||
| + | |||
| + | partnerId | ||
| + | |||
| + | currentRate | ||
| + | |||
| + | suggestedRate | ||
| + | |||
| + | expectedRevenueGain | ||
| + | @db.Decimal(14, | ||
| + | |||
| + | expectedMarginGain | ||
| + | |||
| + | implemented | ||
| + | @default(false) | ||
| + | |||
| + | createdAt | ||
| + | @default(now()) | ||
| + | |||
| + | @@index([partnerId]) | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 6 — Enums ====== | ||
| + | |||
| + | ===== Ajouter ===== | ||
| + | |||
| + | <code prisma> | ||
| + | enum FinancialForecastType { | ||
| + | |||
| + | REVENUE | ||
| + | |||
| + | CASHFLOW | ||
| + | |||
| + | COMMISSION | ||
| + | |||
| + | PAYOUT | ||
| + | |||
| + | PROFITABILITY | ||
| + | } | ||
| + | |||
| + | enum SettlementInsightType { | ||
| + | |||
| + | DELAY_RISK | ||
| + | |||
| + | PAYMENT_ANOMALY | ||
| + | |||
| + | COMMISSION_VARIANCE | ||
| + | |||
| + | CASHFLOW_RISK | ||
| + | |||
| + | RECONCILIATION_ISSUE | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 7 — Migration ====== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate dev \ | ||
| + | --name revenue_intelligence | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.2-B ====== | ||
| + | |||
| + | ===== Revenue Intelligence Module ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 8 — Structure ====== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | |||
| + | ├── profitability | ||
| + | ├── forecasting | ||
| + | ├── commissions | ||
| + | ├── settlements | ||
| + | ├── health | ||
| + | ├── insights | ||
| + | └── revenue-intelligence.module.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 9 — Services ====== | ||
| + | |||
| + | < | ||
| + | PartnerProfitabilityService | ||
| + | |||
| + | RevenueForecastService | ||
| + | |||
| + | CashFlowForecastService | ||
| + | |||
| + | CommissionOptimizationService | ||
| + | |||
| + | SettlementIntelligenceService | ||
| + | |||
| + | FinancialHealthScoreService | ||
| + | |||
| + | FinancialInsightService | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.2-C ====== | ||
| + | |||
| + | ===== Partner Profitability ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 10 — PartnerProfitabilityService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | partner-profitability.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Calculer ===== | ||
| + | |||
| + | < | ||
| + | Revenue | ||
| + | |||
| + | Commission Cost | ||
| + | |||
| + | Acquisition Cost | ||
| + | |||
| + | Net Profit | ||
| + | |||
| + | Margin | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 11 — Méthodes ====== | ||
| + | |||
| + | <code ts> | ||
| + | calculateProfitability() | ||
| + | |||
| + | calculateMargin() | ||
| + | |||
| + | calculateROI() | ||
| + | |||
| + | rankPartnersByProfitability() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 12 — Classification ====== | ||
| + | |||
| + | < | ||
| + | ROI > 30% Strategic | ||
| + | |||
| + | ROI 15-30% | ||
| + | |||
| + | ROI 5-15% Watch | ||
| + | |||
| + | ROI < 5% At Risk | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.2-D ====== | ||
| + | |||
| + | ===== Revenue Forecasting ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 13 — RevenueForecastService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | revenue-forecast.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Prévoir ===== | ||
| + | |||
| + | < | ||
| + | Revenue | ||
| + | |||
| + | Commission | ||
| + | |||
| + | Profit | ||
| + | |||
| + | Bookings | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 14 — Horizons ====== | ||
| + | |||
| + | < | ||
| + | 30 jours | ||
| + | |||
| + | 90 jours | ||
| + | |||
| + | 12 mois | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 15 — Sources ====== | ||
| + | |||
| + | < | ||
| + | Reservations | ||
| + | |||
| + | Settlements | ||
| + | |||
| + | Revenue Share | ||
| + | |||
| + | Partner Analytics | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.2-E ====== | ||
| + | |||
| + | ===== Cash Flow Forecast ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 16 — CashFlowForecastService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | cashflow-forecast.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Prévoir ===== | ||
| + | |||
| + | < | ||
| + | Incoming Cash | ||
| + | |||
| + | Outgoing Payouts | ||
| + | |||
| + | Commission Liabilities | ||
| + | |||
| + | Settlement Exposure | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 17 — Méthodes ====== | ||
| + | |||
| + | <code ts> | ||
| + | forecastCashIn() | ||
| + | |||
| + | forecastCashOut() | ||
| + | |||
| + | forecastNetCashFlow() | ||
| + | |||
| + | forecastLiquidity() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 18 — KPI ====== | ||
| + | |||
| + | < | ||
| + | Cash Position | ||
| + | |||
| + | Liquidity Ratio | ||
| + | |||
| + | Forecast Accuracy | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.2-F ====== | ||
| + | |||
| + | ===== Commission Optimization ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 19 — CommissionOptimizationService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | commission-optimization.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Analyser ===== | ||
| + | |||
| + | < | ||
| + | Commission Rate | ||
| + | |||
| + | Revenue Contribution | ||
| + | |||
| + | Margin Impact | ||
| + | |||
| + | Partner Performance | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 20 — Recommandations ====== | ||
| + | |||
| + | < | ||
| + | Increase | ||
| + | |||
| + | Decrease | ||
| + | |||
| + | Tiered Model | ||
| + | |||
| + | Bonus Program | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 21 — Exemple ====== | ||
| + | |||
| + | < | ||
| + | Commission | ||
| + | |||
| + | 18% | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Optimisée | ||
| + | |||
| + | 15% | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | +12% marge | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.2-G ====== | ||
| + | |||
| + | ===== Settlement Intelligence ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 22 — SettlementIntelligenceService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | settlement-intelligence.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Détecter ===== | ||
| + | |||
| + | < | ||
| + | Retards | ||
| + | |||
| + | Variances | ||
| + | |||
| + | Anomalies | ||
| + | |||
| + | Risques de paiement | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 23 — Méthodes ====== | ||
| + | |||
| + | <code ts> | ||
| + | detectSettlementRisks() | ||
| + | |||
| + | analyzeSettlementPerformance() | ||
| + | |||
| + | generateSettlementInsights() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 24 — Exemple ====== | ||
| + | |||
| + | < | ||
| + | Partner A | ||
| + | |||
| + | Retard moyen | ||
| + | |||
| + | 14 jours | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Risque élevé | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.2-H ====== | ||
| + | |||
| + | ===== Financial Health Score ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 25 — FinancialHealthScoreService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | financial-health-score.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Pondération ===== | ||
| + | |||
| + | < | ||
| + | Profitability | ||
| + | |||
| + | Payments | ||
| + | |||
| + | Growth | ||
| + | |||
| + | Settlement | ||
| + | |||
| + | Risk 10% | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 26 — Classification ====== | ||
| + | |||
| + | < | ||
| + | 90-100 Excellent | ||
| + | |||
| + | 75-89 Healthy | ||
| + | |||
| + | 50-74 Warning | ||
| + | |||
| + | 0-49 Critical | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 27 — Exemple ====== | ||
| + | |||
| + | < | ||
| + | Financial Health | ||
| + | |||
| + | 93 | ||
| + | |||
| + | Excellent | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.2-I ====== | ||
| + | |||
| + | ===== Executive Financial Intelligence ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 28 — FinancialInsightService ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | financial-insight.service.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Générer ===== | ||
| + | |||
| + | < | ||
| + | Profitability Opportunities | ||
| + | |||
| + | Commission Optimization | ||
| + | |||
| + | Cash Flow Alerts | ||
| + | |||
| + | Partner Risks | ||
| + | |||
| + | Growth Opportunities | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 29 — Exemple ====== | ||
| + | |||
| + | < | ||
| + | Top 10 partenaires | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | 72% du revenu | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Programme premium recommandé | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | < | ||
| + | Commission moyenne | ||
| + | |||
| + | 21% | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Au-dessus marché | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Optimisation suggérée | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Sprint 7-C.2-J ====== | ||
| + | |||
| + | ===== Dashboard Intelligence ===== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 30 — Endpoints ====== | ||
| + | |||
| + | <code http> | ||
| + | GET / | ||
| + | |||
| + | GET / | ||
| + | |||
| + | GET / | ||
| + | |||
| + | GET / | ||
| + | |||
| + | GET / | ||
| + | |||
| + | GET / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 31 — Exemple ====== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 32 — Analytics ====== | ||
| + | |||
| + | ===== Mesurer ===== | ||
| + | |||
| + | < | ||
| + | Profit Margin | ||
| + | |||
| + | Forecast Accuracy | ||
| + | |||
| + | Commission Efficiency | ||
| + | |||
| + | Cash Flow Accuracy | ||
| + | |||
| + | Partner ROI | ||
| + | |||
| + | Financial Health Trend | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Gouvernance ====== | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 33 — Permissions ====== | ||
| + | |||
| + | < | ||
| + | partner.finance.analytics | ||
| + | |||
| + | partner.finance.forecast | ||
| + | |||
| + | partner.finance.health | ||
| + | |||
| + | partner.finance.intelligence | ||
| + | |||
| + | partner.finance.executive | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 34 — Audit ====== | ||
| + | |||
| + | < | ||
| + | PROFITABILITY_CALCULATED | ||
| + | |||
| + | FORECAST_GENERATED | ||
| + | |||
| + | CASHFLOW_FORECAST_GENERATED | ||
| + | |||
| + | COMMISSION_OPTIMIZATION_CREATED | ||
| + | |||
| + | FINANCIAL_HEALTH_UPDATED | ||
| + | |||
| + | FINANCIAL_INSIGHT_CREATED | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 35 — Jobs ====== | ||
| + | |||
| + | < | ||
| + | Toutes les nuits | ||
| + | |||
| + | Profitability Refresh | ||
| + | |||
| + | Forecast Generation | ||
| + | |||
| + | Cash Flow Forecast | ||
| + | |||
| + | Health Score Refresh | ||
| + | |||
| + | Recommendation Generation | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Clôture Domaine Marketplace ====== | ||
| + | |||
| + | À la fin du Sprint 7-C.2 : | ||
| + | |||
| + | < | ||
| + | ✓ Distribution | ||
| + | |||
| + | ✓ OTA Integrations | ||
| + | |||
| + | ✓ Marketplace | ||
| + | |||
| + | ✓ Partner Management | ||
| + | |||
| + | ✓ Revenue Sharing | ||
| + | |||
| + | ✓ Settlements | ||
| + | |||
| + | ✓ Partner Intelligence | ||
| + | |||
| + | ✓ Revenue Intelligence | ||
| + | </ | ||
| + | |||
| + | sont entièrement opérationnels. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Préparation Sprint 8 ====== | ||
| + | |||
| + | Compatible avec : | ||
| + | |||
| + | < | ||
| + | Marketing | ||
| + | |||
| + | Campaigns | ||
| + | |||
| + | Loyalty | ||
| + | |||
| + | Customer Engagement | ||
| + | |||
| + | Growth Platform | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | Le Sprint 7-C.2 est terminé lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ Partner Profitability créé | ||
| + | |||
| + | ✓ Commission Optimization créée | ||
| + | |||
| + | ✓ Revenue Forecasting créé | ||
| + | |||
| + | ✓ Cash Flow Forecast créé | ||
| + | |||
| + | ✓ Settlement Intelligence créée | ||
| + | |||
| + | ✓ Financial Health Score créé | ||
| + | |||
| + | ✓ Revenue Intelligence finalisée | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | PartnerProfitability | ||
| + | |||
| + | FinancialForecast | ||
| + | |||
| + | SettlementInsight | ||
| + | |||
| + | FinancialHealthScore | ||
| + | |||
| + | CommissionOptimization | ||
| + | |||
| + | PartnerProfitabilityService | ||
| + | |||
| + | RevenueForecastService | ||
| + | |||
| + | CashFlowForecastService | ||
| + | |||
| + | CommissionOptimizationService | ||
| + | |||
| + | SettlementIntelligenceService | ||
| + | |||
| + | FinancialHealthScoreService | ||
| + | |||
| + | FinancialInsightService | ||
| + | |||
| + | Revenue Intelligence Platform | ||
| + | </ | ||
ujusum/3-codage/2-sprints/7-sprint-7.1781136561.txt.gz · Dernière modification : 2026/06/11 02:09 de 83.202.252.200