From 4c0557d18805a86dbc82b8077f68de4dd9f9c084 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Fri, 10 Apr 2026 01:36:11 +0100 Subject: [PATCH] Gate paid plugin type behind developer onboarding completion Users must complete developer onboarding (Stripe Connect) before they can select the "Paid" plugin type when creating or editing a draft plugin. The option is visually disabled with a link to the onboarding flow. Co-Authored-By: Claude Opus 4.6 --- app/Livewire/Customer/Plugins/Create.php | 12 + app/Livewire/Customer/Plugins/Show.php | 13 + package-lock.json | 2 +- .../customer/plugins/create.blade.php | 11 +- .../livewire/customer/plugins/show.blade.php | 11 +- .../Customer/PluginPaidOnboardingTest.php | 240 ++++++++++++++++++ .../Customer/PluginStatusTransitionsTest.php | 3 + 7 files changed, 285 insertions(+), 7 deletions(-) create mode 100644 tests/Feature/Livewire/Customer/PluginPaidOnboardingTest.php diff --git a/app/Livewire/Customer/Plugins/Create.php b/app/Livewire/Customer/Plugins/Create.php index 5e7656dd..ab90afa9 100644 --- a/app/Livewire/Customer/Plugins/Create.php +++ b/app/Livewire/Customer/Plugins/Create.php @@ -31,6 +31,12 @@ class Create extends Component public bool $reposLoaded = false; + #[Computed] + public function hasCompletedDeveloperOnboarding(): bool + { + return auth()->user()->developerAccount?->hasCompletedOnboarding() ?? false; + } + #[Computed] public function owners(): array { @@ -142,6 +148,12 @@ function ($attribute, $value, $fail): void { return; } + if ($this->pluginType === 'paid' && ! $this->hasCompletedDeveloperOnboarding) { + session()->flash('error', 'You must complete developer onboarding before creating a paid plugin.'); + + return; + } + $repository = trim($this->repository, '/'); $repositoryUrl = 'https://github.com/'.$repository; [$owner, $repo] = explode('/', $repository); diff --git a/app/Livewire/Customer/Plugins/Show.php b/app/Livewire/Customer/Plugins/Show.php index b10163b8..cd614843 100644 --- a/app/Livewire/Customer/Plugins/Show.php +++ b/app/Livewire/Customer/Plugins/Show.php @@ -9,6 +9,7 @@ use App\Notifications\PluginSubmitted; use App\Services\GitHubUserService; use Illuminate\Support\Facades\Storage; +use Livewire\Attributes\Computed; use Livewire\Attributes\Layout; use Livewire\Attributes\Title; use Livewire\Attributes\Validate; @@ -48,6 +49,12 @@ class Show extends Component public ?string $tier = null; + #[Computed] + public function hasCompletedDeveloperOnboarding(): bool + { + return auth()->user()->developerAccount?->hasCompletedOnboarding() ?? false; + } + public function mount(string $vendor, string $package): void { $this->plugin = Plugin::findByVendorPackageOrFail($vendor, $package); @@ -181,6 +188,12 @@ function (string $attribute, mixed $value, \Closure $fail) { 'tier.required' => 'Please select a pricing tier for your paid plugin.', ]); + if ($this->plugin->isDraft() && $this->pluginType === 'paid' && ! $this->hasCompletedDeveloperOnboarding) { + session()->flash('error', 'You must complete developer onboarding before setting a plugin as paid.'); + + return; + } + $data = [ 'display_name' => $this->displayName ?: null, 'support_channel' => $this->supportChannel, diff --git a/package-lock.json b/package-lock.json index c4c8703b..67cf3e51 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "lazy-podenco", + "name": "hungry-toucan", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/resources/views/livewire/customer/plugins/create.blade.php b/resources/views/livewire/customer/plugins/create.blade.php index dddcede4..1ef23b01 100644 --- a/resources/views/livewire/customer/plugins/create.blade.php +++ b/resources/views/livewire/customer/plugins/create.blade.php @@ -59,14 +59,19 @@ - -