refactor: 🔒️ Changed getStripeSecret Method -> differentiates between local/prod

This commit is contained in:
IceToast 2021-12-15 12:24:03 +01:00
parent 45b7d703a5
commit ef2c271257
2 changed files with 9 additions and 14 deletions

View file

@ -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=

View file

@ -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');
}