# LineUp France

Plateforme LineUp France avec:

- backend Laravel (API + site vitrine + BO admin)
- 2 apps Flutter
  - `apps/client_app` (clients)
  - `apps/liner_app` (liners)

Le design UI est aligne sur le V0 (`/Users/gsent/Downloads/lineupproj 3`) pour le frontend web, le BO et les apps mobiles.

## Structure

```text
.
├── app/
│   ├── Http/Controllers/Api/      # Endpoints API
│   ├── Http/Controllers/Web/Bo/   # BO login/dashboard
│   ├── Http/Middleware/            # auth api token + roles
│   ├── Models/                     # Missions, Wallet, Payments, KYC, ...
│   └── Services/BoDashboardMetrics.php
├── routes/
│   ├── api.php                     # API v1 LineUp
│   └── web.php                     # Landing + BO
├── resources/views/
│   ├── welcome.blade.php           # Front vitrine
│   └── bo/                         # Login + Dashboard BO
├── apps/
│   ├── client_app/
│   └── liner_app/
└── docs/
    ├── product/
    ├── architecture/
    └── api/openapi.yaml
```

## Prerequis

- PHP 8.2+
- Composer
- Node.js 20+
- Flutter 3.35+

## Installation rapide

```bash
composer install
cp .env.example .env
php artisan key:generate
php artisan migrate --seed
npm install
php artisan serve
```

Landing: `http://localhost:8000`

## Deploiement cPanel (lineupfrance.com)

Template prod:

```bash
cp .env.production.example .env
php artisan key:generate --force
```

Script de deploiement:

```bash
./scripts/deploy_cpanel.sh
```

Mode releases recommande (rollback rapide):

```bash
./scripts/deploy_release_cpanel.sh
# rollback release precedente
./scripts/rollback_release_cpanel.sh
# preflight production (routes, migrations, writable dirs)
./scripts/preflight_cpanel.sh
```

Points importants en prod:

- `APP_URL=https://lineupfrance.com`
- `DocumentRoot` du domaine vers `.../current/public`
- Cron scheduler: `* * * * * php artisan schedule:run`
- Cron queue: `* * * * * php artisan queue:work --stop-when-empty`
- Healthcheck: `https://lineupfrance.com/health`
- Verbes REST (`PATCH/DELETE`) autorises via `.htaccess` (racine + `public/`)
- `./scripts/smoke_web.sh` valide que `PATCH/DELETE` ne sont pas reecrits en `GET`

Troubleshooting prod (erreur migration manquante):

```bash
php artisan migrate --force
php artisan optimize:clear
php artisan optimize
```

## BO Admin

- URL login: `http://localhost:8000/bo/login`
- URL dashboard: `http://localhost:8000/bo/dashboard`
- URL finance: `http://localhost:8000/bo/finance`
- URL users: `http://localhost:8000/bo/users`
- URL missions: `http://localhost:8000/bo/missions`
- URL KYC: `http://localhost:8000/bo/kyc`
- URL payouts: `http://localhost:8000/bo/payouts`

Compte seed par defaut:

- email: `admin@lineup.fr`
- password: `lineup-admin-1234`

Comptes mobile seed de demo:

- client: `client@lineup.fr` / `lineup-client-1234`
- liner: `liner@lineup.fr` / `lineup-liner-1234`

## API Laravel (socle MVP)

Base URL locale: `http://localhost:8000/api`

### Auth

- `POST /auth/register`
- `POST /auth/login`
- `POST /auth/firebase` (id_token Firebase + role `client|liner`)
- `POST /auth/forgot-password`
- `POST /auth/reset-password`
- `GET /auth/me` (Bearer token)
- `PATCH /auth/me` (Bearer token)
- `POST /auth/logout` (Bearer token)

Reset web link (email):

- `GET /reset-password/{token}` (route `password.reset`)

### Missions

- `GET /missions`
- `POST /missions` (client)
- `PATCH /missions/{mission}` (client)
- `DELETE /missions/{mission}` (client)
- `POST /missions/{mission}/accept` (liner)
- `POST /missions/{mission}/status` (liner)
- `POST /missions/{mission}/proof` (liner)
- `GET /missions/{mission}/track`
- `GET /missions/{mission}/stream` (SSE live feed)
- `POST /missions/{mission}/rating` (client)

### Paiements / Wallet / KYC

- `GET /payment-methods` (client/liner/admin)
- `POST /payment-methods` (client/liner/admin)
- `PATCH /payment-methods/{paymentMethod}` (client/liner/admin)
- `DELETE /payment-methods/{paymentMethod}` (client/liner/admin)
- `GET /payments/history` (client)
- `GET /wallet` (liner)
- `GET /wallet/history` (liner)
- `POST /wallet/withdraw` (liner)
- `POST /kyc/documents` (liner)

Providers supportes:

- Client (pay_in): `stripe`, `paypal`, `apple_pay`, `google_pay`
- Liner (pay_out): `rib`, `paypal`, `stripe`, `apple_pay`, `google_pay`

Notes prod Stripe/Wallet:

- Pour `stripe|apple_pay|google_pay` en `pay_in`, envoyer `details.payment_method_id` (ou `reference` legacy).
- Pour `stripe|apple_pay|google_pay` en `pay_out`, envoyer `details.destination_account` (ou `account_id`/`reference` legacy).

Pour `POST /wallet/withdraw`:

- recommende: `payment_method_id`
- legacy compatible: `provider`

### Admin API

- `GET /admin/dashboard` (admin)
- `GET /admin/kyc` (admin)
- `PATCH /admin/kyc/{kycDocument}` (admin)
- `GET /admin/proofs` (admin)
- `PATCH /admin/proofs/{missionProof}` (admin)
- `GET /admin/disputes` (admin)
- `PATCH /admin/disputes/{missionDispute}` (admin)
- `POST /admin/push/test` (admin)

### Litiges

- `GET /disputes` (client/liner)
- `POST /missions/{mission}/disputes` (client/liner)

### Notifications

- `GET /notifications` (client/liner/admin)
- `POST /notifications/{notification}/read` (client/liner/admin)
- `POST /notifications/read-all` (client/liner/admin)

### Appareils Push

- `GET /devices/tokens` (client/liner/admin)
- `POST /devices/tokens` (client/liner/admin)
- `DELETE /devices/tokens/{deviceToken}` (client/liner/admin)

### Webhooks Paiement

- `POST /webhooks/stripe`
- `POST /webhooks/paypal`

## Moderation BO

- Le dashboard BO affiche les dossiers KYC en attente.
- Le dashboard BO affiche aussi les preuves mission en attente et les litiges ouverts.
- Actions directes:
  - KYC: `POST /bo/kyc/{kycDocument}/approve`, `POST /bo/kyc/{kycDocument}/reject`
  - Preuves: `POST /bo/proofs/{missionProof}/approve`, `POST /bo/proofs/{missionProof}/reject`
  - Litiges: `POST /bo/disputes/{missionDispute}/resolve`, `POST /bo/disputes/{missionDispute}/reject`
  - Push test: `POST /bo/push/test`
- Chaque moderation est tracee dans `admin_audit_logs`.

## Lancer les apps Flutter

### Client

```bash
cd apps/client_app
flutter pub get
flutter run --dart-define=API_BASE_URL=http://127.0.0.1:8000/api
```

Le token de session est conserve localement (connexion persistante).

### Liner

```bash
cd apps/liner_app
flutter pub get
flutter run --dart-define=API_BASE_URL=http://127.0.0.1:8000/api
```

Le token de session est conserve localement (connexion persistante).

Note Android emulator:

- utiliser `http://10.0.2.2:8000/api` au lieu de `127.0.0.1`.

### Branding mobile (splash + icones)

Assets utilises:

- `apps/client_app/assets/branding/lineup-logo.png`
- `apps/client_app/assets/branding/splash-screen-light.png`
- `apps/liner_app/assets/branding/lineup-logo.png`
- `apps/liner_app/assets/branding/splash-screen-light.png`

Regeneration native:

```bash
cd apps/client_app
dart run flutter_native_splash:create
dart run flutter_launcher_icons

cd ../liner_app
dart run flutter_native_splash:create
dart run flutter_launcher_icons
```

Smoke web non destructif:

```bash
./scripts/smoke_web.sh http://127.0.0.1:8000
./scripts/smoke_web.sh https://lineupfrance.com
```

Gate pre-release (tests + preflight + smoke optionnel):

```bash
./scripts/release_gate.sh
./scripts/release_gate.sh https://lineupfrance.com
```

## Firebase Auth (Google, SMS, Apple)

Les deux apps ont les boutons et le flux backend `/api/auth/firebase` actifs pour:

- Google (`google.com`)
- SMS (`phone`)
- Apple (`apple.com`, iOS/macOS)

Checklist avant test/release:

1. Firebase Console > Authentication > Sign-in method
   - activer Google
   - activer Phone
   - activer Apple
2. Firebase Console > Project settings > Apps
   - Android client: package `com.lineup.androclient`
   - Android liner: package `com.liners.lineup`
   - iOS client: bundle `com.lineup.client`
   - iOS liner: bundle `com.iosliners.lineup`
3. Android
   - renseigner SHA-1 et SHA-256 de la keystore debug/release
   - conserver `google-services.json` dans `android/app/`
4. iOS
   - conserver `GoogleService-Info.plist` dans `ios/Runner/`
   - URL scheme (`REVERSED_CLIENT_ID`) dans `Info.plist`
   - capability Sign In with Apple active + `Runner.entitlements`
5. Backend Laravel
   - `FIREBASE_PROJECT` doit correspondre au projet Firebase (ex: `lineup-react`)
   - si `FIREBASE_CREDENTIALS` est renseigne, le fichier JSON doit exister sur le serveur (`storage/firebase/service-account.json`, en release mode: `shared/storage/firebase/service-account.json`)
   - ne jamais commiter de secrets de production dans Git

## Variables d'environnement utiles

- `LINEUP_CLIENT_IOS_URL`
- `LINEUP_CLIENT_ANDROID_URL`
- `LINEUP_LINER_IOS_URL`
- `LINEUP_LINER_ANDROID_URL`
- `LINEUP_PUSH_DRIVER` (`log` ou `fcm_legacy`)
- `LINEUP_FCM_LEGACY_SERVER_KEY`
- `LINEUP_PAYMENTS_SIMULATE` (`true` local/test, `false` prod)
- `LINEUP_PAYMENTS_REQUIRE_METHOD` (`true` pour exiger une methode client)
- `LINEUP_STRIPE_SECRET_KEY`
- `LINEUP_STRIPE_WEBHOOK_SECRET`
- `LINEUP_PAYPAL_MODE` (`sandbox`/`live`)
- `LINEUP_PAYPAL_CLIENT_ID`
- `LINEUP_PAYPAL_CLIENT_SECRET`
- `LINEUP_PAYPAL_WEBHOOK_ID`

## Configuration Firebase mobile

Deposer les fichiers natifs aux emplacements suivants:

- Client Android: `apps/client_app/android/app/google-services.json`
- Client iOS: `apps/client_app/ios/Runner/GoogleService-Info.plist`
- Liner Android: `apps/liner_app/android/app/google-services.json`
- Liner iOS: `apps/liner_app/ios/Runner/GoogleService-Info.plist`

Providers Firebase Auth actifs dans les apps:

- Google
- Apple
- Phone (SMS OTP)

Variables backend liees a Firebase (verification ID token):

- `FIREBASE_PROJECT`
- `FIREBASE_CREDENTIALS` (fichier JSON service account cote serveur)
- `FIREBASE_STORAGE_DEFAULT_BUCKET`

Les identifiants applicatifs doivent correspondre aux fichiers Firebase:

- Client Android `applicationId`: `com.lineup.androclient`
- Client iOS `PRODUCT_BUNDLE_IDENTIFIER`: `com.lineup.client`
- Liner Android `applicationId`: `com.liners.lineup`
- Liner iOS `PRODUCT_BUNDLE_IDENTIFIER`: `com.iosliners.lineup`

## Documentation

- Vision produit: `docs/product/vision.md`
- Backlog MVP: `docs/product/mvp-backlog.md`
- Architecture: `docs/architecture/architecture.md`
- Contrat API initial: `docs/api/openapi.yaml`
- Deploiement VPS cPanel: `docs/deployment/cpanel-lineupfrance.md`
- Runbook cPanel copier/coller: `docs/deployment/cpanel-runbook-copy-paste.md`
- Checklist QA visuelle BO OneUI: `docs/qa/bo-oneui-visual-checklist.md`
- Checklist smoke prod: `docs/qa/prod-smoke-checklist.md`
- Checklist E2E prod client + liner + BO: `docs/qa/prod-e2e-client-liner-bo-checklist.md`
- Runbook E2E prod copier/coller: `docs/qa/prod-e2e-runbook-copy-paste.md`
- Fiche de recette E2E prod: `docs/qa/prod-e2e-run-sheet.md`
- Etat de validation courant: `docs/qa/validation-status-2026-03-12.md`
- Resume go/no-go: `docs/qa/go-no-go-summary-2026-03-12.md`
- Version direction une page: `docs/qa/executive-go-no-go-2026-03-12.md`
- Ready for prod validation: `docs/qa/ready-for-prod-validation-2026-03-12.md`
- Message pack Slack/mail: `docs/qa/ready-for-prod-validation-message-2026-03-12.md`
- Release candidate runbook: `docs/qa/release-candidate-runbook-2026-03-12.md`
- Final GO/NO-GO decision template: `docs/qa/final-go-no-go-decision-template.md`
- Prod evidence log template: `docs/qa/prod-validation-evidence-log-template.md`
- Prod validation triage matrix: `docs/qa/prod-validation-triage-matrix.md`
- Prod validation command sheet: `docs/qa/prod-validation-command-sheet.md`
- Prod validation pack overview: `docs/qa/prod-validation-pack-overview.md`
- Prod validation owner matrix: `docs/qa/prod-validation-owner-matrix.md`
- Prod validation day plan: `docs/qa/prod-validation-day-plan.md`
- Prod validation war room board: `docs/qa/prod-validation-war-room-board-template.md`
- Prod validation session outcome template: `docs/qa/prod-validation-session-outcome-template.md`
- Prod validation facilitator checklist: `docs/qa/prod-validation-facilitator-checklist.md`
- Prod validation workspace init script: `scripts/init_prod_validation_workspace.sh`
- Prod validation workspace archive script: `scripts/archive_prod_validation_workspace.sh`
- Prod validation workspace finalize script: `scripts/finalize_prod_validation_workspace.sh`
- Prod validation workspace summary script: `scripts/summarize_prod_validation_workspace.sh`
- Suite locale unifiee: `scripts/local_validation_suite.sh`
- Wrapper reel liner_app: `/Users/gsent/Documents/untitled2/apps/liner_app/scripts/e2e_real_liner_api.sh`
