From ef2c271257075588c711653fa1625e01283aeb3c Mon Sep 17 00:00:00 2001 From: IceToast Date: Wed, 15 Dec 2021 12:24:03 +0100 Subject: [PATCH] =?UTF-8?q?refactor:=20=F0=9F=94=92=EF=B8=8F=20Changed=20g?= =?UTF-8?q?etStripeSecret=20Method=20->=20differentiates=20between=20local?= =?UTF-8?q?/prod?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 5 +++++ .../Controllers/Admin/PaymentController.php | 18 ++++-------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/.env.example b/.env.example index c7016a83..df944b6d 100644 --- a/.env.example +++ b/.env.example @@ -23,6 +23,11 @@ PAYPAL_SECRET= PAYPAL_CLIENT_ID= PAYPAL_EMAIL= + +#stripe details, you only need "test" for testing! you can do this by setting the APP_ENV to local +STRIPE_TEST_SECRET= +STRIPE_SECRET= + #set-up for extra discord verification DISCORD_CLIENT_ID= DISCORD_CLIENT_SECRET= diff --git a/app/Http/Controllers/Admin/PaymentController.php b/app/Http/Controllers/Admin/PaymentController.php index cb7c51a6..12e96168 100644 --- a/app/Http/Controllers/Admin/PaymentController.php +++ b/app/Http/Controllers/Admin/PaymentController.php @@ -345,19 +345,7 @@ class PaymentController extends Controller */ protected function getStripeClient() { - $environment = env('APP_ENV') == 'local' - ? $this->getStripeSecret() - : $this->getStripeSecret(); - - return new \Stripe\StripeClient($environment); - } - - /** - * @return string - */ - protected function getStripeClientId() - { - return env('APP_ENV') == 'local' ? env('PAYPAL_SANDBOX_CLIENT_ID') : env('PAYPAL_CLIENT_ID'); + return new \Stripe\StripeClient($this->getStripeClient()); } /** @@ -365,7 +353,9 @@ class PaymentController extends Controller */ protected function getStripeSecret() { - return env('STRIPE_SECRET'); + return env('APP_ENV') == 'local' + ? env('STRIPE_TEST_SECRET') + : env('STRIPE_SECRET'); }