🐛 fix(Stripe/Client): N'initialise le client Stripe que si l'environnement n'est pas 'test'

This commit is contained in:
Serreau Jovann
2026-01-31 14:01:27 +01:00
parent 2d231f51ce
commit 486e3116c9

View File

@@ -27,7 +27,11 @@ class Client
) {
$stripeSk = $_ENV['STRIPE_SK'] ?? '';
$this->stripeBaseUrl = $_ENV['STRIPE_BASEURL'] ?? '';
$this->client = $client ?? new StripeClient($stripeSk);
if($_ENV['APP_ENV'] !== 'test') {
$this->client = new StripeClient($stripeSk);
} else {
$this->client = $client;
}
}
/**
@@ -56,7 +60,7 @@ class Client
try {
$this->client->accounts->all(['limit' => 1]);
return ['state' => true, 'message' => 'Connexion établie avec Stripe'];
} catch (AuthenticationException) {
} catch (AuthenticationException $e) {
return ['state' => false, 'message' => 'Clé API Stripe invalide.'];
} catch (ApiConnectionException) {
return ['state' => false, 'message' => 'Problème de connexion réseau.'];