API vitrine : Stripe / subscription process

lblt 66cd6106fa refactor environment configuration and remove unused mailer tests 1 week ago
cmd 66cd6106fa refactor environment configuration and remove unused mailer tests 1 week ago
internal 66cd6106fa refactor environment configuration and remove unused mailer tests 1 week ago
.env.sample 66cd6106fa refactor environment configuration and remove unused mailer tests 1 week ago
.gitignore 60b3ad55ad init onboard api 1 month ago
Dockerfile 66cd6106fa refactor environment configuration and remove unused mailer tests 1 week ago
README.md 66cd6106fa refactor environment configuration and remove unused mailer tests 1 week ago
config.sample.yml 60b3ad55ad init onboard api 1 month ago
docker-compose.yml 66cd6106fa refactor environment configuration and remove unused mailer tests 1 week ago
go.mod 60b3ad55ad init onboard api 1 month ago
go.sum 60b3ad55ad init onboard api 1 month ago

README.md

BYOM-Onboard

Attention

Gros nettoyage à faire.

Structure API incohérente avec le reste des projets

Mais fonctionnelle.

Description

BYOM-Onboard est un service de provisionnement automatisé qui gère :

  • L'inscription des utilisateurs
  • Le traitement des paiements via Stripe
  • Le déploiement automatique de machines virtuelles sur OVH

Prérequis

  • Go 1.21 ou supérieur
  • SQLite
  • Compte OVH avec accès API
  • Compte Stripe
  • Git

Installation

# Cloner le projet
git clone git@git.linuxforward.com:byom/byom-onboard.git

# Se placer dans le répertoire
cd byom-onboard

# Installer les dépendances
go mod download

Configuration

Créer un fichier .env à la racine du projet :

SERVER_ADDRESS=:8080
DATABASE_URL=postgres://user:password@localhost:5432/byom_onboard
OVH_ENDPOINT=ovh-eu
OVH_APP_KEY=votre-app-key
OVH_APP_SECRET=votre-app-secret
STRIPE_KEY=votre-stripe-key

Structure du Projet

byom-onboard/
├── cmd/
│   └── server/           # Point d'entrée de l'application
├── internal/
│   ├── config/          # Configuration
│   ├── domain/          # Logique métier
│   ├── handlers/        # Gestionnaires HTTP
│   ├── middleware/      # Middleware HTTP
│   ├── repository/      # Accès aux données
│   └── services/        # Services métier
└── pkg/                 # Packages publics réutilisables

Lancement

# En développement
go run cmd/server/main.go

# En production
go build -o byom-onboard cmd/server/main.go
./byom-onboard

API

Workflow

sequenceDiagram
    participant U as User
    participant API as Registration API
    participant DB as Database
    participant PS as Payment Service
    participant Q as Message Queue
    participant P as Provisioning Service
    participant C as Cloud Provider

    U->>API: Submit registration
    API->>DB: Store registration details
    API->>PS: Initialize payment
    PS-->>U: Redirect to payment gateway
    U->>PS: Complete payment
    PS-->>API: Payment confirmation
    API->>Q: Send provisioning request
    Q->>P: Process request
    P->>C: Create VM instance
    C-->>P: VM creation confirmation
    P->>DB: Update VM details
    P-->>U: Send access credentials

Endpoints

  • POST /api/register - Inscription utilisateur
  • POST /api/payment - Traitement du paiement
  • POST /api/provision - Provisionnement VPS
  • GET /api/status - État du service

Contribution

  1. Forker le projet
  2. Créer une branche (git checkout -b feature/nouvelle-fonctionnalite)
  3. Commiter les changements (git commit -am 'Ajout nouvelle fonctionnalité')
  4. Pousser la branche (git push origin feature/nouvelle-fonctionnalite)
  5. Créer une Pull Request

Licence

Propriétaire - Tous droits réservés

Contact

Pour toute question ou suggestion, merci de contacter l'équipe BYOM.