From a4c8ea671139aafac83e8faa8eadbe43459c6f3e Mon Sep 17 00:00:00 2001 From: Jakub Theimer <5587309+theimerj@users.noreply.github.com> Date: Thu, 14 Mar 2024 21:19:29 +0100 Subject: [PATCH] register custom stripe manager only for testing env --- src/LunarApiStripeAdapterServiceProvider.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/LunarApiStripeAdapterServiceProvider.php b/src/LunarApiStripeAdapterServiceProvider.php index aebb7ff..2ea73f7 100644 --- a/src/LunarApiStripeAdapterServiceProvider.php +++ b/src/LunarApiStripeAdapterServiceProvider.php @@ -23,11 +23,6 @@ public function register(): void */ public function boot(): void { - $this->app->singleton( - 'gc:stripe', - fn (Application $app) => $app->make(StripeManager::class), - ); - $this->loadRoutesFrom(__DIR__.'/../routes/webhooks.php'); StripePaymentAdapter::register(); @@ -41,5 +36,13 @@ public function boot(): void __DIR__.'/../config/stripe-webhooks.php' => config_path('stripe-webhooks.php'), ], 'lunar-api.stripe.config'); } + + // Testing + if ($this->app->environment('testing')) { + $this->app->singleton( + 'gc:stripe', + fn (Application $app) => $app->make(StripeManager::class), + ); + } } }