🐛 fix(Stripe/Client): N'initialise le client Stripe que si l'environnement n'est pas 'test'
This commit is contained in:
@@ -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.'];
|
||||
|
||||
Reference in New Issue
Block a user