From 6a230d5e9f99e49d845317dc80a9aa7a1d0b02eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Drunen?= Date: Sun, 24 Dec 2023 21:57:11 +0100 Subject: [PATCH] Get rid of plans --- .env.ci | 8 --- .env.docker | 8 --- .env.example | 8 --- app/Actions/CreateStripeCheckoutAction.php | 42 ------------ app/Actions/CreateStripeCustomerAction.php | 30 --------- app/Actions/FetchStripeSubscriptionAction.php | 31 --------- app/Console/Kernel.php | 7 -- app/Exceptions/UserStripelessException.php | 10 --- app/Helper.php | 5 -- app/Http/Controllers/SettingsController.php | 59 ----------------- app/Http/Controllers/SpaceController.php | 6 -- .../Controllers/SpaceInviteController.php | 9 --- app/Http/Kernel.php | 1 - .../Middleware/RedirectIfStripeAbsent.php | 25 -------- app/Jobs/SendWeeklyReports.php | 6 -- app/Jobs/SyncStripeSubscriptions.php | 55 ---------------- app/Models/User.php | 6 -- app/Policies/SpaceInvitePolicy.php | 17 ----- app/Policies/SpacePolicy.php | 17 ----- app/Providers/AppServiceProvider.php | 2 - composer.json | 1 - composer.lock | 64 +------------------ config/plans.php | 11 ---- config/stripe.php | 7 -- ..._plan_related_columns_from_users_table.php | 22 +++++++ lang/en/general.php | 1 - lang/es/general.php | 1 - lang/it/general.php | 1 - lang/ru/general.php | 1 - resources/views/settings/billing.blade.php | 27 -------- resources/views/settings/layout.blade.php | 3 - resources/views/space_invites/show.blade.php | 3 - resources/views/spaces/create.blade.php | 3 - .../views/stripe_checkout_redirect.blade.php | 17 ----- routes/web.php | 3 - tests/Feature/PlanExceededTest.php | 60 ----------------- 36 files changed, 24 insertions(+), 553 deletions(-) delete mode 100644 app/Actions/CreateStripeCheckoutAction.php delete mode 100644 app/Actions/CreateStripeCustomerAction.php delete mode 100644 app/Actions/FetchStripeSubscriptionAction.php delete mode 100644 app/Exceptions/UserStripelessException.php delete mode 100644 app/Http/Middleware/RedirectIfStripeAbsent.php delete mode 100644 app/Jobs/SyncStripeSubscriptions.php delete mode 100644 config/plans.php delete mode 100644 config/stripe.php create mode 100644 database/migrations/2023_12_24_210952_remove_stripe_and_plan_related_columns_from_users_table.php delete mode 100644 resources/views/settings/billing.blade.php delete mode 100644 resources/views/stripe_checkout_redirect.blade.php delete mode 100644 tests/Feature/PlanExceededTest.php diff --git a/.env.ci b/.env.ci index 907c5c7c..aa9fbe06 100644 --- a/.env.ci +++ b/.env.ci @@ -34,12 +34,4 @@ PUSHER_APP_SECRET= SUGGESTION_BOX_ENABLED=false -PLANS_ENABLED=true -PLANS_STANDARD_MAXIMUM_SPACES=2 -PLANS_PREMIUM_MAXIMUM_SPACES=null - -STRIPE_KEY= -STRIPE_SECRET= -STRIPE_PREMIUM_PLAN_PRICE_ID= - DISABLE_REGISTRATION=false diff --git a/.env.docker b/.env.docker index 8f62e451..7d6eb028 100644 --- a/.env.docker +++ b/.env.docker @@ -33,11 +33,3 @@ PUSHER_APP_KEY= PUSHER_APP_SECRET= SUGGESTION_BOX_ENABLED=false - -PLANS_ENABLED=false -PLANS_STANDARD_MAXIMUM_SPACES=2 -PLANS_PREMIUM_MAXIMUM_SPACES=null - -STRIPE_KEY= -STRIPE_SECRET= -STRIPE_PREMIUM_PLAN_PRICE_ID= diff --git a/.env.example b/.env.example index 38c4fac5..1cce72e7 100644 --- a/.env.example +++ b/.env.example @@ -34,12 +34,4 @@ PUSHER_APP_SECRET= SUGGESTION_BOX_ENABLED=false -PLANS_ENABLED=false -PLANS_STANDARD_MAXIMUM_SPACES=2 -PLANS_PREMIUM_MAXIMUM_SPACES=null - -STRIPE_KEY= -STRIPE_SECRET= -STRIPE_PREMIUM_PLAN_PRICE_ID= - DISABLE_REGISTRATION=false diff --git a/app/Actions/CreateStripeCheckoutAction.php b/app/Actions/CreateStripeCheckoutAction.php deleted file mode 100644 index 5bbf6aac..00000000 --- a/app/Actions/CreateStripeCheckoutAction.php +++ /dev/null @@ -1,42 +0,0 @@ -stripe_customer_id) { - throw new UserStripelessException(); - } - - $stripe = new StripeClient(config('stripe.secret')); - - $stripeCheckout = $stripe->checkout->sessions->create([ - 'success_url' => route('settings.billing'), - 'cancel_url' => route('settings.billing'), - 'mode' => 'subscription', - 'payment_method_types' => ['card'], - 'customer' => $user->stripe_customer_id, - 'line_items' => [ - [ - 'price' => config('stripe.premium_plan_price_id'), - 'quantity' => 1 - ] - ] - ]); - - return $stripeCheckout->id; - } -} diff --git a/app/Actions/CreateStripeCustomerAction.php b/app/Actions/CreateStripeCustomerAction.php deleted file mode 100644 index a2ea50bc..00000000 --- a/app/Actions/CreateStripeCustomerAction.php +++ /dev/null @@ -1,30 +0,0 @@ -customers->create([ - 'name' => $user->name, - 'email' => $user->email - ]); - - $user->update([ - 'stripe_customer_id' => $customer->id - ]); - } -} diff --git a/app/Actions/FetchStripeSubscriptionAction.php b/app/Actions/FetchStripeSubscriptionAction.php deleted file mode 100644 index f0986f6c..00000000 --- a/app/Actions/FetchStripeSubscriptionAction.php +++ /dev/null @@ -1,31 +0,0 @@ -stripe_customer_id) { - throw new UserStripelessException(); - } - - $stripe = new StripeClient(config('stripe.secret')); - - $stripeCustomer = $stripe->customers->retrieve($user->stripe_customer_id); - - return $stripeCustomer->subscriptions->first(); - } -} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 74092695..5be0eaef 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -2,11 +2,9 @@ namespace App\Console; -use App\Helper; use App\Jobs\FetchConversionRates; use App\Jobs\ProcessRecurrings; use App\Jobs\SendWeeklyReports; -use App\Jobs\SyncStripeSubscriptions; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; @@ -29,11 +27,6 @@ class Kernel extends ConsoleKernel */ protected function schedule(Schedule $schedule) { - $schedule->job(new SyncStripeSubscriptions())->everyMinute()->when(function () { - return Helper::arePlansEnabled(); - }); - - // Daily $schedule->job(new ProcessRecurrings())->daily(); $schedule->job(new FetchConversionRates())->daily(); diff --git a/app/Exceptions/UserStripelessException.php b/app/Exceptions/UserStripelessException.php deleted file mode 100644 index e77aaa2b..00000000 --- a/app/Exceptions/UserStripelessException.php +++ /dev/null @@ -1,10 +0,0 @@ -user(); - $stripeSubscription = null; - - try { - $stripeSubscription = (new FetchStripeSubscriptionAction())->execute($user->id); - } catch (UserStripelessException $e) { - // Don't worry, $stripeSubscription will simply be `null` - } - - return view('settings.billing', [ - 'user' => $user, - 'stripeSubscription' => $stripeSubscription - ]); - } - - public function postUpgrade(Request $request) - { - $user = $request->user(); - - if (!$user->stripe_customer_id) { - (new CreateStripeCustomerAction())->execute($user->id); - } - - $stripeSubscription = (new FetchStripeSubscriptionAction())->execute($user->id); - - if ($stripeSubscription) { - return redirect()->route('settings.billing'); - } - - $stripeCheckoutId = (new CreateStripeCheckoutAction())->execute($user->id); - - return view('stripe_checkout_redirect', ['stripeCheckoutId' => $stripeCheckoutId]); - } - - public function postCancel(Request $request) - { - $user = $request->user(); - - if (!$user->stripe_customer_id) { - return redirect()->route('settings.billing'); - } - - $stripeSubscription = (new FetchStripeSubscriptionAction())->execute($user->id); - - if (!$stripeSubscription) { - return redirect()->route('settings.billing'); - } - - $stripeSubscription->cancel(); - - return redirect()->route('settings.billing'); - } } diff --git a/app/Http/Controllers/SpaceController.php b/app/Http/Controllers/SpaceController.php index 77bb07fc..f2838551 100644 --- a/app/Http/Controllers/SpaceController.php +++ b/app/Http/Controllers/SpaceController.php @@ -31,12 +31,6 @@ public function store(Request $request) 'currency_id' => 'required|exists:currencies,id' ]); - if (!$request->user()->can('create', Space::class)) { - $request->session()->flash('maximum_reached', true); - - return redirect()->route('spaces.create'); - } - (new CreateSpaceAction())->execute($request->name, $request->currency_id, Auth::id()); return redirect()->route('settings.spaces.index'); diff --git a/app/Http/Controllers/SpaceInviteController.php b/app/Http/Controllers/SpaceInviteController.php index 9b82506c..d4ff5b6e 100644 --- a/app/Http/Controllers/SpaceInviteController.php +++ b/app/Http/Controllers/SpaceInviteController.php @@ -39,15 +39,6 @@ public function accept(Request $request, Space $space, SpaceInvite $invite) abort(410); } - if (!$request->user()->can('accept', SpaceInvite::class)) { - $request->session()->flash('maximum_reached', true); - - return redirect()->route('space_invites.show', [ - 'space' => $space->id, - 'invite' => $invite->id - ]); - } - (new AcceptSpaceInviteAction())->execute($invite->id); return redirect()->route('settings.spaces.index'); diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index fdbd5738..44f10f06 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -61,7 +61,6 @@ class Kernel extends HttpKernel 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 'resolve-api-key' => \App\Http\Middleware\ResolveApiKey::class, 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, - 'stripe' => \App\Http\Middleware\RedirectIfStripeAbsent::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, ]; diff --git a/app/Http/Middleware/RedirectIfStripeAbsent.php b/app/Http/Middleware/RedirectIfStripeAbsent.php deleted file mode 100644 index c1a0ea7a..00000000 --- a/app/Http/Middleware/RedirectIfStripeAbsent.php +++ /dev/null @@ -1,25 +0,0 @@ -route('dashboard'); - } - - return $next($request); - } -} diff --git a/app/Jobs/SendWeeklyReports.php b/app/Jobs/SendWeeklyReports.php index ff5a8622..43a0edb4 100644 --- a/app/Jobs/SendWeeklyReports.php +++ b/app/Jobs/SendWeeklyReports.php @@ -2,7 +2,6 @@ namespace App\Jobs; -use App\Helper; use App\Mail\WeeklyReport; use App\Models\Space; use Illuminate\Bus\Queueable; @@ -50,11 +49,6 @@ public function handle() ORDER BY spendings.amount DESC LIMIT 1', [$space->id, $lastWeekDate, $currentDate]); foreach ($space->users as $user) { - // If plans are enabled, weekly reports can only be sent to users with a premium plan - if (Helper::arePlansEnabled() && $user->plan === 'standard') { - continue; - } - // Only send if user wants to receive report if ($user->weekly_report) { Mail::to($user->email)->queue(new WeeklyReport( diff --git a/app/Jobs/SyncStripeSubscriptions.php b/app/Jobs/SyncStripeSubscriptions.php deleted file mode 100644 index 6f6a6bc6..00000000 --- a/app/Jobs/SyncStripeSubscriptions.php +++ /dev/null @@ -1,55 +0,0 @@ -customers->all() as $stripeCustomer) { - $user = User::where('stripe_customer_id', $stripeCustomer->id)->first(); - - if (!$user) { - continue; - } - - $hasPremiumPlan = false; - - foreach ($stripeCustomer->subscriptions as $stripeSubscription) { - if ($stripeSubscription->status !== 'active') { - continue; - } - - $hasPremiumPlan = true; - } - - if ($user->plan === 'standard' && $hasPremiumPlan) { - $user->update(['plan' => 'premium']); - } - - if ($user->plan === 'premium' && !$hasPremiumPlan) { - $user->update(['plan' => 'standard']); - } - } - } -} diff --git a/app/Models/User.php b/app/Models/User.php index 1802c9db..5a0977d3 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -18,18 +18,12 @@ class User extends Authenticatable 'password', 'verification_token', 'last_verification_mail_sent_at', - 'stripe_customer_id', - 'plan' ]; protected $hidden = [ 'password', 'remember_token', ]; - protected $attributes = [ - 'plan' => 'standard' - ]; - // public static function getValidationRulesForRegistration(): array { diff --git a/app/Policies/SpaceInvitePolicy.php b/app/Policies/SpaceInvitePolicy.php index ec833b63..5abaabfa 100644 --- a/app/Policies/SpaceInvitePolicy.php +++ b/app/Policies/SpaceInvitePolicy.php @@ -2,7 +2,6 @@ namespace App\Policies; -use App\Helper; use App\Models\SpaceInvite; use App\Models\User; use Illuminate\Auth\Access\HandlesAuthorization; @@ -15,20 +14,4 @@ public function access(User $user, SpaceInvite $invite) { return $invite->invitee_user_id === $user->id; } - - public function accept(User $user): bool - { - $maximumSpaces = config('plans.' . $user->plan . '.maximum_spaces'); - - if ( - Helper::arePlansEnabled() - && $user->plan === 'standard' - && $maximumSpaces - && $user->spaces->count() >= $maximumSpaces - ) { - return false; - } - - return true; - } } diff --git a/app/Policies/SpacePolicy.php b/app/Policies/SpacePolicy.php index 7c7f584f..391ca956 100644 --- a/app/Policies/SpacePolicy.php +++ b/app/Policies/SpacePolicy.php @@ -2,7 +2,6 @@ namespace App\Policies; -use App\Helper; use App\Models\Space; use App\Models\User; use Illuminate\Auth\Access\HandlesAuthorization; @@ -11,22 +10,6 @@ class SpacePolicy { use HandlesAuthorization; - public function create(User $user): bool - { - $maximumSpaces = config('plans.' . $user->plan . '.maximum_spaces'); - - if ( - Helper::arePlansEnabled() - && $user->plan === 'standard' - && $maximumSpaces - && $user->spaces->count() >= $maximumSpaces - ) { - return false; - } - - return true; - } - public function edit(User $user, Space $space): bool { $usersSpace = $user->spaces diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 69a3a4f2..5c44c269 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,7 +2,6 @@ namespace App\Providers; -use App\Helper; use App\Models\Space; use Illuminate\Http\Resources\Json\JsonResource; use Illuminate\Support\ServiceProvider; @@ -24,7 +23,6 @@ public function boot() 'userName' => Auth::check() ? Auth::user()->name : null, 'currency' => $selectedSpace ? $selectedSpace->currency->symbol : '-', 'selectedSpace' => $selectedSpace, - 'arePlansEnabled' => Helper::arePlansEnabled(), 'suggestionBoxEnabled' => env('SUGGESTION_BOX_ENABLED', false), 'versionNumber' => $versionNumber ]); diff --git a/composer.json b/composer.json index dbdd1e04..2563682a 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,6 @@ "laravel/tinker": "^2.7", "livewire/livewire": "^2.3", "nesbot/carbon": "^2.32", - "stripe/stripe-php": "^7.44", "symfony/dom-crawler": "^5.1", "symfony/process": "^6.0" }, diff --git a/composer.lock b/composer.lock index ef9819f8..25b260c6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3a8730487804548d046557f3d6e4b6b4", + "content-hash": "4a6da7ea20188428945defce6417ccb7", "packages": [ { "name": "brick/math", @@ -3667,66 +3667,6 @@ ], "time": "2023-04-15T23:01:58+00:00" }, - { - "name": "stripe/stripe-php", - "version": "v7.128.0", - "source": { - "type": "git", - "url": "https://github.com/stripe/stripe-php.git", - "reference": "c704949c49b72985c76cc61063aa26fefbd2724e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/stripe/stripe-php/zipball/c704949c49b72985c76cc61063aa26fefbd2724e", - "reference": "c704949c49b72985c76cc61063aa26fefbd2724e", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*", - "php": ">=5.6.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "3.5.0", - "phpstan/phpstan": "^1.2", - "phpunit/phpunit": "^5.7 || ^9.0", - "squizlabs/php_codesniffer": "^3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "psr-4": { - "Stripe\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Stripe and contributors", - "homepage": "https://github.com/stripe/stripe-php/contributors" - } - ], - "description": "Stripe PHP Library", - "homepage": "https://stripe.com/", - "keywords": [ - "api", - "payment processing", - "stripe" - ], - "support": { - "issues": "https://github.com/stripe/stripe-php/issues", - "source": "https://github.com/stripe/stripe-php/tree/v7.128.0" - }, - "time": "2022-05-05T17:18:02+00:00" - }, { "name": "symfony/console", "version": "v6.3.2", @@ -8505,5 +8445,5 @@ "ext-calendar": "*" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/config/plans.php b/config/plans.php deleted file mode 100644 index c805d4b3..00000000 --- a/config/plans.php +++ /dev/null @@ -1,11 +0,0 @@ - [ - 'maximum_spaces' => env('PLANS_STANDARD_MAXIMUM_SPACES') - ], - - 'premium' => [ - 'maximum_spaces' => env('PLANS_PREMIUM_MAXIMUM_SPACES') - ] -]; diff --git a/config/stripe.php b/config/stripe.php deleted file mode 100644 index 9de20823..00000000 --- a/config/stripe.php +++ /dev/null @@ -1,7 +0,0 @@ - env('STRIPE_KEY'), - 'secret' => env('STRIPE_SECRET'), - 'premium_plan_price_id' => env('STRIPE_PREMIUM_PLAN_PRICE_ID') -]; diff --git a/database/migrations/2023_12_24_210952_remove_stripe_and_plan_related_columns_from_users_table.php b/database/migrations/2023_12_24_210952_remove_stripe_and_plan_related_columns_from_users_table.php new file mode 100644 index 00000000..a03cf241 --- /dev/null +++ b/database/migrations/2023_12_24_210952_remove_stripe_and_plan_related_columns_from_users_table.php @@ -0,0 +1,22 @@ +dropColumn(['stripe_customer_id', 'plan']); + }); + } + + public function down(): void + { + Schema::table('users', function (Blueprint $table) { + // There's no going back + }); + } +}; diff --git a/lang/en/general.php b/lang/en/general.php index cd3a1ded..fe2f07f8 100644 --- a/lang/en/general.php +++ b/lang/en/general.php @@ -18,7 +18,6 @@ 'profile' => 'Profile', 'account' => 'Account', 'preferences' => 'Preferences', - 'billing' => 'Billing', 'general' => 'General', 'members' => 'Members', diff --git a/lang/es/general.php b/lang/es/general.php index eda49487..70116184 100644 --- a/lang/es/general.php +++ b/lang/es/general.php @@ -18,7 +18,6 @@ 'profile' => 'Perfil', 'account' => 'Cuenta', 'preferences' => 'Preferencias', - 'billing' => 'Facturación', 'general' => 'General', 'members' => 'Miembros', diff --git a/lang/it/general.php b/lang/it/general.php index a89fae5a..0f37f879 100644 --- a/lang/it/general.php +++ b/lang/it/general.php @@ -18,7 +18,6 @@ 'profile' => 'Profilo', 'account' => 'Account', 'preferences' => 'Impostazioni', - 'billing' => 'Fatturazione', 'general' => 'Generali', 'members' => 'Membri', diff --git a/lang/ru/general.php b/lang/ru/general.php index affbfc19..84279ea1 100644 --- a/lang/ru/general.php +++ b/lang/ru/general.php @@ -18,7 +18,6 @@ 'profile' => 'Профиль', 'account' => 'Учетная запись', 'preferences' => 'Предпочтения', - 'billing' => 'Биллинг', 'general' => 'Общее', 'members' => 'Члены', diff --git a/resources/views/settings/billing.blade.php b/resources/views/settings/billing.blade.php deleted file mode 100644 index ef42da62..00000000 --- a/resources/views/settings/billing.blade.php +++ /dev/null @@ -1,27 +0,0 @@ -@extends('settings.layout') - -@section('settings_title') -

{{ __('general.billing') }}

-@endsection - -@section('settings_body_formless') -
-
-
-
{{ $stripeSubscription ? 'Premium' : 'Standard' }}
- @if (!$stripeSubscription) -
- {{ csrf_field() }} - -
- @else -
- {{ csrf_field() }} - -
- @endif -
- € {{ $stripeSubscription ? \App\Helper::formatNumber($stripeSubscription->plan->amount / 100) : '0.00' }} per month @if ($stripeSubscription)· Next payment due on {{ date('Y-m-d', $stripeSubscription->current_period_end) }}@endif -
-
-@endsection diff --git a/resources/views/settings/layout.blade.php b/resources/views/settings/layout.blade.php index f3c18bfb..9693cebe 100644 --- a/resources/views/settings/layout.blade.php +++ b/resources/views/settings/layout.blade.php @@ -11,9 +11,6 @@
  • {{ __('general.account') }}
  • {{ __('general.preferences') }}
  • {{ __('general.dashboard') }}
  • - @if ($arePlansEnabled) -
  • {{ __('general.billing') }}
  • - @endif
  • {{ __('models.spaces') }}
  • diff --git a/resources/views/space_invites/show.blade.php b/resources/views/space_invites/show.blade.php index ad0c3a2f..f4c5efd2 100644 --- a/resources/views/space_invites/show.blade.php +++ b/resources/views/space_invites/show.blade.php @@ -5,9 +5,6 @@ @section('body')

    {{ __('general.invite') }}

    - @if (Session::get('maximum_reached') === true) -
    You have reached the maximum amount of spaces you can be part of.
    - @endif

    {{ __('general.invited_to') }} "{{ $invite->space->name }}"

    diff --git a/resources/views/spaces/create.blade.php b/resources/views/spaces/create.blade.php index 8d115655..a5bb2c09 100644 --- a/resources/views/spaces/create.blade.php +++ b/resources/views/spaces/create.blade.php @@ -5,9 +5,6 @@ @section('body')

    {{ __('actions.create') }} {{ __('models.space') }}

    - @if (Session::get('maximum_reached') === true) -
    You have reached the maximum amount of spaces you can be part of.
    - @endif
    {{ csrf_field() }} diff --git a/resources/views/stripe_checkout_redirect.blade.php b/resources/views/stripe_checkout_redirect.blade.php deleted file mode 100644 index b81ee42b..00000000 --- a/resources/views/stripe_checkout_redirect.blade.php +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - diff --git a/routes/web.php b/routes/web.php index f7f5673c..051f2a2d 100644 --- a/routes/web.php +++ b/routes/web.php @@ -105,9 +105,6 @@ Route::get('/settings/account', [SettingsController::class, 'getAccount'])->name('account'); Route::get('/settings/preferences', [SettingsController::class, 'getPreferences'])->name('preferences'); Route::get('/settings/dashboard', [SettingsController::class, 'getDashboard'])->name('dashboard'); - Route::get('/settings/billing', [SettingsController::class, 'getBilling'])->name('billing')->middleware('stripe'); - Route::post('/settings/billing/upgrade', [SettingsController::class, 'postUpgrade'])->name('billing.upgrade')->middleware('stripe'); - Route::post('/settings/billing/cancel', [SettingsController::class, 'postCancel'])->name('billing.cancel')->middleware('stripe'); Route::get('/settings/spaces', [SettingsController::class, 'getSpaces'])->name('spaces.index'); }); diff --git a/tests/Feature/PlanExceededTest.php b/tests/Feature/PlanExceededTest.php deleted file mode 100644 index ba53b880..00000000 --- a/tests/Feature/PlanExceededTest.php +++ /dev/null @@ -1,60 +0,0 @@ -create(); - $firstSpace = Space::factory()->create(['currency_id' => Currency::all()->random()->id]); - $secondSpace = Space::factory()->create(['currency_id' => Currency::all()->random()->id]); - $thirdSpace = Space::factory()->create(['currency_id' => Currency::all()->random()->id]); - - // User should be part of 2 spaces - $user->spaces()->sync([$firstSpace->id, $secondSpace->id]); - - // Invite user for third space - $invite = SpaceInvite::factory()->create(['space_id' => $thirdSpace->id, 'invitee_user_id' => $user->id]); - - $response = $this - ->followingRedirects() - ->actingAs($user) - ->withSession(['space_id' => $firstSpace->id]) - ->post('/spaces/' . $thirdSpace->id . '/invites/' . $invite->id . '/accept'); - - $response - ->assertStatus(200) - ->assertSeeText('You have reached the maximum amount of spaces you can be part of.'); - } - - public function testMaximumSpacesExcdeedForPremiumPlan(): void - { - $user = User::factory()->create(['plan' => 'premium']); - $firstSpace = Space::factory()->create(['currency_id' => Currency::all()->random()->id]); - $secondSpace = Space::factory()->create(['currency_id' => Currency::all()->random()->id]); - $thirdSpace = Space::factory()->create(['currency_id' => Currency::all()->random()->id]); - - // User should be part of 2 spaces - $user->spaces()->sync([$firstSpace->id, $secondSpace->id]); - - // Invite user for third space - $invite = SpaceInvite::factory()->create(['space_id' => $thirdSpace->id, 'invitee_user_id' => $user->id]); - - $response = $this - ->followingRedirects() - ->actingAs($user) - ->withSession(['space_id' => $firstSpace->id]) - ->post('/spaces/' . $thirdSpace->id . '/invites/' . $invite->id . '/accept'); - - $response - ->assertStatus(200) - ->assertDontSeeText('You have reached the maximum amount of spaces you can be part of.'); - } -}