Skip to content

Commit bbc21e9

Browse files
authored
Fix incorrect stripe account status (#650)
1 parent bd27f2f commit bbc21e9

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

backend/app/Services/Application/Handlers/Account/Payment/Stripe/CreateStripeConnectAccountHandler.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ private function createOrGetStripeConnectAccount(CreateStripeConnectAccountDTO $
6464
);
6565

6666
if ($response->isConnectSetupComplete) {
67+
// If setup is complete, but this isn't reflected in the account, update it.
68+
if ($account->getStripeConnectSetupComplete() === false) {
69+
$this->updateAccountStripeSetupCompletionStatus($account, $stripeConnectAccount);
70+
}
71+
6772
return $response;
6873
}
6974

@@ -155,4 +160,25 @@ private function getStripeAccountSetupUrl(Account $stripAccount, AccountDomainOb
155160

156161
return $accountLink->url;
157162
}
163+
164+
private function updateAccountStripeSetupCompletionStatus(
165+
AccountDomainObject $account,
166+
Account $stripeConnectAccount,
167+
): void
168+
{
169+
$this->accountRepository->updateWhere(
170+
attributes: [
171+
AccountDomainObjectAbstract::STRIPE_CONNECT_SETUP_COMPLETE => true,
172+
],
173+
where: [
174+
'id' => $account->getId(),
175+
]
176+
);
177+
178+
$this->logger->info(sprintf(
179+
'Stripe Connect account setup completed for account %s with Stripe account ID %s',
180+
$account->getId(),
181+
$stripeConnectAccount->id
182+
));
183+
}
158184
}

frontend/src/components/common/StripeConnectButton/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ export const StripeConnectButton: React.FC<StripeConnectButtonProps> = ({
5757
if (!stripeDetails) {
5858
setFetchStripeDetails(true);
5959
} else {
60+
if (stripeDetails.is_connect_setup_complete) {
61+
showSuccess(t`Stripe setup is already complete.`);
62+
return;
63+
}
64+
6065
if (typeof window !== 'undefined') {
6166
showSuccess(t`Redirecting to Stripe...`);
6267
window.location.href = String(stripeDetails.connect_url);

0 commit comments

Comments
 (0)