Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

Fix incorrect stripe account status (#650)

Dave Earleybbc21e92ba9c
diff --git a/backend/app/Services/Application/Handlers/Account/Payment/Stripe/CreateStripeConnectAccountHandler.php b/backend/app/Services/Application/Handlers/Account/Payment/Stripe/CreateStripeConnectAccountHandler.php
index bf3564de8..e921350d3 100644
--- a/backend/app/Services/Application/Handlers/Account/Payment/Stripe/CreateStripeConnectAccountHandler.php
+++ b/backend/app/Services/Application/Handlers/Account/Payment/Stripe/CreateStripeConnectAccountHandler.php
@@ -64,6 +64,11 @@ readonly class CreateStripeConnectAccountHandler
);
if ($response->isConnectSetupComplete) {
+ // If setup is complete, but this isn't reflected in the account, update it.
+ if ($account->getStripeConnectSetupComplete() === false) {
+ $this->updateAccountStripeSetupCompletionStatus($account, $stripeConnectAccount);
+ }
+
return $response;
}
@@ -155,4 +160,25 @@ readonly class CreateStripeConnectAccountHandler
return $accountLink->url;
}
+
+ private function updateAccountStripeSetupCompletionStatus(
+ AccountDomainObject $account,
+ Account $stripeConnectAccount,
+ ): void
+ {
+ $this->accountRepository->updateWhere(
+ attributes: [
+ AccountDomainObjectAbstract::STRIPE_CONNECT_SETUP_COMPLETE => true,
+ ],
+ where: [
+ 'id' => $account->getId(),
+ ]
+ );
+
+ $this->logger->info(sprintf(
+ 'Stripe Connect account setup completed for account %s with Stripe account ID %s',
+ $account->getId(),
+ $stripeConnectAccount->id
+ ));
+ }
}
diff --git a/frontend/src/components/common/StripeConnectButton/index.tsx b/frontend/src/components/common/StripeConnectButton/index.tsx
index 23d4e71ea..645509f59 100644
--- a/frontend/src/components/common/StripeConnectButton/index.tsx
+++ b/frontend/src/components/common/StripeConnectButton/index.tsx
@@ -57,6 +57,11 @@ export const StripeConnectButton: React.FC<StripeConnectButtonProps> = ({
if (!stripeDetails) {
setFetchStripeDetails(true);
} else {
+ if (stripeDetails.is_connect_setup_complete) {
+ showSuccess(t`Stripe setup is already complete.`);
+ return;
+ }
+
if (typeof window !== 'undefined') {
showSuccess(t`Redirecting to Stripe...`);
window.location.href = String(stripeDetails.connect_url);