handling changes to stripe account where owner needs to provide information
This commit is contained in:
@@ -3,12 +3,14 @@ import React from "react";
|
||||
interface EarningsStatusProps {
|
||||
hasStripeAccount: boolean;
|
||||
isOnboardingComplete?: boolean;
|
||||
payoutsEnabled?: boolean;
|
||||
onSetupClick: () => void;
|
||||
}
|
||||
|
||||
const EarningsStatus: React.FC<EarningsStatusProps> = ({
|
||||
hasStripeAccount,
|
||||
isOnboardingComplete = false,
|
||||
payoutsEnabled = true,
|
||||
onSetupClick,
|
||||
}) => {
|
||||
// No Stripe account exists
|
||||
@@ -55,7 +57,29 @@ const EarningsStatus: React.FC<EarningsStatusProps> = ({
|
||||
);
|
||||
}
|
||||
|
||||
// Account exists and is fully set up
|
||||
// Account exists, onboarding complete, but payouts disabled
|
||||
if (!payoutsEnabled) {
|
||||
return (
|
||||
<div className="text-center">
|
||||
<div className="mb-3">
|
||||
<i
|
||||
className="bi bi-exclamation-triangle text-danger"
|
||||
style={{ fontSize: "2.5rem" }}
|
||||
></i>
|
||||
</div>
|
||||
<h6 className="text-danger">Action Required</h6>
|
||||
<p className="text-muted small mb-3">
|
||||
Additional verification is needed to continue receiving payouts.
|
||||
Please complete the required steps to resume your earnings.
|
||||
</p>
|
||||
<button className="btn btn-danger" onClick={onSetupClick}>
|
||||
Complete Verification
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Account exists and is fully set up with payouts enabled
|
||||
return (
|
||||
<div className="text-center">
|
||||
<div className="mb-3">
|
||||
|
||||
@@ -125,6 +125,11 @@ const EarningsDashboard: React.FC = () => {
|
||||
|
||||
const hasStripeAccount = !!userProfile?.stripeConnectedAccountId;
|
||||
const isOnboardingComplete = accountStatus?.detailsSubmitted ?? false;
|
||||
const payoutsEnabled = accountStatus?.payoutsEnabled ?? true;
|
||||
|
||||
// Show setup card if: no account, onboarding incomplete, or payouts disabled
|
||||
const showSetupCard =
|
||||
!hasStripeAccount || !isOnboardingComplete || !payoutsEnabled;
|
||||
|
||||
return (
|
||||
<div className="container mt-4">
|
||||
@@ -147,8 +152,8 @@ const EarningsDashboard: React.FC = () => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Earnings Setup - only show if not fully set up */}
|
||||
{(!hasStripeAccount || !isOnboardingComplete) && (
|
||||
{/* Earnings Setup - show if not fully set up or payouts disabled */}
|
||||
{showSetupCard && (
|
||||
<div className="card mb-4">
|
||||
<div className="card-header">
|
||||
<h5 className="mb-0">Earnings Setup</h5>
|
||||
@@ -157,6 +162,7 @@ const EarningsDashboard: React.FC = () => {
|
||||
<EarningsStatus
|
||||
hasStripeAccount={hasStripeAccount}
|
||||
isOnboardingComplete={isOnboardingComplete}
|
||||
payoutsEnabled={payoutsEnabled}
|
||||
onSetupClick={() => setShowOnboarding(true)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user