fix setup flow stale state and Stripe URL issues
All checks were successful
deploy / deploy (push) Successful in 1m9s

Onboarding: re-fetch setup_status() after provider/Stripe connect instead
of manually patching the local assigns, which could miss admin_created and
leave users stuck on the setup page with no way forward.

Dev config: respect PHX_HOST for endpoint URL so Stripe checkout redirects
to the correct host instead of always using localhost.

Stripe setup: detect private/LAN IPs (10.x, 172.16-31.x, 192.168.x) as
unreachable, not just localhost — prevents creating webhook endpoints that
Stripe can never reach.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-22 16:51:44 +00:00
parent 2bd2e613c7
commit e26a02a0fb
3 changed files with 21 additions and 16 deletions

View File

@@ -150,12 +150,7 @@ defmodule BerrypodWeb.Setup.Onboarding do
case Products.create_provider_connection(params) do
{:ok, connection} ->
Products.enqueue_sync(connection)
setup = %{
socket.assigns.setup
| provider_connected: true,
provider_type: type
}
setup = Setup.setup_status()
{:noreply,
socket
@@ -183,14 +178,7 @@ defmodule BerrypodWeb.Setup.Onboarding do
case StripeSetup.connect(api_key) do
{:ok, _result} ->
setup = %{socket.assigns.setup | stripe_connected: true}
setup =
if setup.admin_created and setup.provider_connected do
%{setup | setup_complete: true}
else
setup
end
setup = Setup.setup_status()
{:noreply,
socket