Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripe Connect Onboarding Integration #528

Merged
merged 9 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import Playground from "./components/pages/Playground";
import PrivacyPolicy from "./components/pages/PrivacyPolicy";
import ResearchPage from "./components/pages/ResearchPage";
import SellerOnboarding from "./components/pages/SellerOnboarding";
import SellerOnboardingContinued from "./components/pages/SellerOnboardingContinued";
import Terminal from "./components/pages/Terminal";
import TermsOfService from "./components/pages/TermsOfService";

Expand Down Expand Up @@ -87,21 +86,18 @@ const App = () => {
<Route path="/privacy" element={<PrivacyPolicy />} />

<Route
path="/seller-onboarding"
path="/sell/onboarding"
element={<SellerOnboarding />}
/>
<Route
path="/seller-onboarding-continued"
element={<SellerOnboardingContinued />}
/>
<Route
path="/seller-dashboard"
path="/sell/dashboard"
element={<SellerDashboard />}
/>
<Route
path="/delete-connect"
element={<DeleteConnect />}
/>

<Route path="/success" element={<OrderSuccess />} />
<Route path="/orders" element={<OrdersPage />} />

Expand Down
10 changes: 3 additions & 7 deletions frontend/src/components/pages/DeleteConnect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ export default function DeleteConnect() {
return;
}

// Only allow access in development
if (process.env.NODE_ENV !== "development") {
if (!auth.currentUser?.permissions?.includes("is_admin")) {
navigate("/");
return;
}
Expand All @@ -27,7 +26,7 @@ export default function DeleteConnect() {
const handleDeleteTestAccounts = async () => {
try {
const { data, error } = await auth.client.POST(
"/stripe/connect-account/delete-test-accounts",
"/stripe/connect/delete/accounts",
{},
);

Expand All @@ -38,7 +37,7 @@ export default function DeleteConnect() {

addAlert(`Successfully deleted ${data.count} test accounts`, "success");
setTimeout(() => {
navigate("/seller-onboarding");
navigate("/sell/onboarding");
}, 2000);
} catch (error) {
addErrorAlert(`Failed to delete test accounts: ${error}`);
Expand Down Expand Up @@ -68,9 +67,6 @@ export default function DeleteConnect() {
This action will delete all test Stripe Connect accounts associated
with this environment. This operation cannot be undone.
</p>
<p className="text-red-700 mb-4">
This functionality is only available in development mode.
</p>
</div>

<button
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/pages/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ export const RenderProfile = (props: RenderProfileProps) => {
{!user.stripe_connect_account_id ? (
<Tooltip content="Start seller onboarding" position="bottom">
<Button
onClick={() => navigate("/seller-onboarding")}
onClick={() => navigate("/sell/onboarding")}
variant="outline"
>
Sell Robots
Expand All @@ -406,15 +406,15 @@ export const RenderProfile = (props: RenderProfileProps) => {
) : !user.stripe_connect_onboarding_completed ? (
<Tooltip content="Continue seller onboarding" position="bottom">
<Button
onClick={() => navigate("/seller-onboarding-continued")}
onClick={() => navigate("/sell/onboarding")}
variant="outline"
>
Complete Seller Setup
</Button>
</Tooltip>
) : (
<Button
onClick={() => navigate("/seller-dashboard")}
onClick={() => navigate("/sell/dashboard")}
variant="outline"
>
Seller Dashboard
Expand Down
14 changes: 9 additions & 5 deletions frontend/src/components/pages/SellerDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useEffect } from "react";
import { useNavigate } from "react-router-dom";

import { useAuthentication } from "@/hooks/useAuth";
import { Check } from "lucide-react";

export default function SellerDashboard() {
const navigate = useNavigate();
Expand All @@ -21,7 +22,7 @@ export default function SellerDashboard() {

// Redirect to onboarding if not completed
if (!auth.currentUser?.stripe_connect_onboarding_completed) {
navigate("/seller-onboarding");
navigate("/sell/onboarding");
return;
}
}, [auth.isLoading, auth.isAuthenticated, auth.currentUser]);
Expand All @@ -43,10 +44,13 @@ export default function SellerDashboard() {

<div className="bg-white rounded-lg shadow p-6">
<h2 className="text-xl font-semibold mb-4">Account Status</h2>
<p className="text-green-600 mb-4">
✓ Your K-Scale seller account is active and ready to receive
payments.
</p>
<div className="flex gap-2 text-green-600">
<Check />
<p>
Your K-Scale seller account is active and ready to receive
payments.
</p>
</div>

<div className="mt-6">
<a
Expand Down
Loading
Loading