fix: 🚑️ changed the payment setup detection

This commit is contained in:
IceToast 2021-12-20 18:50:18 +01:00
parent 7989ff57b9
commit b775ce6cc7
4 changed files with 20 additions and 24 deletions

View file

@ -21,11 +21,16 @@ class CreditProductController extends Controller
*/
public function index(Request $request)
{
$isPaypalSetup = false;
if (env('PAYPAL_SECRET') && env('PAYPAL_CLIENT_ID')) $isPaypalSetup = true;
$isPaymentSetup = false;
if (
env('APP_ENV') == 'local' ||
env('PAYPAL_SECRET') && env('PAYPAL_CLIENT_ID') ||
env('STRIPE_SECRET') && env('STRIPE_ENDPOINT_SECRET') && env('STRIPE_METHODS')
) $isPaymentSetup = true;
return view('admin.store.index', [
'isPaypalSetup' => $isPaypalSetup
'isPaymentSetup' => $isPaymentSetup
]);
}

View file

@ -11,15 +11,13 @@ class StoreController extends Controller
/** Display a listing of the resource. */
public function index()
{
$isPaypalSetup = false;
$isStripeSetup = false;
$isPaymentSetup = false;
if (env('PAYPAL_SECRET') && env('PAYPAL_CLIENT_ID')) $isPaypalSetup = true;
if (env('APP_ENV', 'local') == 'local') {
$isPaypalSetup = true;
$isStripeSetup = true;
}
if (env('STRIPE_SECRET') && env('STRIPE_ENDPOINT_SECRET') && env('STRIPE_METHODS')) $isStripeSetup = true;
if (
env('APP_ENV') == 'local' ||
env('PAYPAL_SECRET') && env('PAYPAL_CLIENT_ID') ||
env('STRIPE_SECRET') && env('STRIPE_ENDPOINT_SECRET') && env('STRIPE_METHODS')
) $isPaymentSetup = true;
//Required Verification for creating an server
if (Configuration::getValueByKey('FORCE_EMAIL_VERIFICATION', false) === 'true' && !Auth::user()->hasVerifiedEmail()) {
@ -33,8 +31,7 @@ class StoreController extends Controller
return view('store.index')->with([
'products' => CreditProduct::where('disabled', '=', false)->orderBy('price', 'asc')->get(),
'isPaypalSetup' => $isPaypalSetup,
'isStripeSetup' => $isStripeSetup
'isPaymentSetup' => $isPaymentSetup,
]);
}
}

View file

@ -26,20 +26,14 @@
<div class="row">
<div class="col-lg-4">
@if ($isPaypalSetup == false)
@if ($isPaymentSetup == false)
<div class="callout callout-danger">
<h4>{{ __('Paypal is not configured.') }}</h4>
<p>{{ __('To configure PayPal, head to the .env and add your PayPals client id and secret.') }}
</p>
</div>
@endif
@if ($isStripeSetup == false)
<div class="callout callout-danger">
<h4>{{ __('Stripe is not configured.') }}</h4>
<p>{{ __('To configure Stripe, head to the .env and add your Stripüe Secret, Endpoint and supported Payment Methods.') }}
<h4>{{ __('No payment method is configured.') }}</h4>
<p>{{ __('To configure your payment methods, head to the .env and add the required options for your prefered payment method.') }}
</p>
</div>
@endif
</div>
</div>

View file

@ -32,7 +32,7 @@
</button>
</div>
@if ($isPaypalSetup && $products->count() > 0)
@if ($isPaymentSetup && $products->count() > 0)
<div class="card">
<div class="card-header">