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 ⭐️
PHP attendize-alternativedoor-managementevent-check-inevent-managementevent-registrationevent-ticketingeventbrite-alternativeeventslaravelopen-sourcephpreactself-hostedsell-ticketssell-tickets-onlineticket-sellingticketing-systemtickettailor-alternativetito-alternative
Fix: Publish modal blocks paid events on Stripe Connect in non-SaaS mode (#1348)
Dave Earley399229b111dd
diff --git a/e2e/tests/management/event-lifecycle.spec.ts b/e2e/tests/management/event-lifecycle.spec.tsindex 50934e3a6..a6699689b 100644--- a/e2e/tests/management/event-lifecycle.spec.ts+++ b/e2e/tests/management/event-lifecycle.spec.ts@@ -1,7 +1,8 @@import { test, expect } from '../../fixtures';import { EventSettingsPage } from '../../pages/event-settings.page';-import { createDraftEvent, createLiveEventWithFreeTicket } from '../../api/factory';+import { createDraftEvent, createDraftEventWithTicket, createLiveEventWithFreeTicket } from '../../api/factory';import { uniqueName } from '../../utils/unique';+import { nonSaasOnly, saasOnly } from '../../utils/mode';test.describe('event lifecycle', () => {test('an organizer publishes a draft event and reverts it to draft', { tag: '@smoke' }, async ({ authedPage, api, account }) => {@@ -27,6 +28,43 @@ test.describe('event lifecycle', () => {await expect(statusToggle).toContainText('Draft');});+ test('a self-hosted organizer publishes a paid event without connecting Stripe', { tag: '@smoke' }, async ({ authedPage, api, account }) => {+ nonSaasOnly();+ const event = await createDraftEventWithTicket(api, account.organizerId, { price: 25 });++ await authedPage.goto(`/manage/event/${event.eventId}/dashboard`);+ await authedPage.waitForLoadState('networkidle');++ const statusToggle = authedPage.getByTestId('event-status-toggle');+ await statusToggle.click();+ await expect(authedPage.getByText('Ready to go live?')).toBeVisible();++ const publishButton = authedPage.getByTestId('publish-event-confirm-button');+ await expect(publishButton).toHaveText('Publish Event');+ await expect(authedPage.getByText('Connect Stripe to accept payments')).toHaveCount(0);+ await publishButton.click();++ await expect(authedPage.getByText('Your event is live!')).toBeVisible();+ await authedPage.getByRole('button', { name: 'Done' }).click();+ await expect(statusToggle).toContainText('Live');+ });++ test('a SaaS organizer without Stripe is blocked from publishing a paid event', async ({ authedPage, api, account }) => {+ saasOnly();+ const event = await createDraftEventWithTicket(api, account.organizerId, { price: 25 });++ await authedPage.goto(`/manage/event/${event.eventId}/dashboard`);+ await authedPage.waitForLoadState('networkidle');++ await authedPage.getByTestId('event-status-toggle').click();+ await expect(authedPage.getByText('Ready to go live?')).toBeVisible();++ await expect(authedPage.getByText('Connect Stripe to accept payments')).toBeVisible();+ const publishButton = authedPage.getByTestId('publish-event-confirm-button');+ await expect(publishButton).toHaveText('Fix issues to publish');+ await expect(publishButton).toBeDisabled();+ });+test('an organizer duplicates an event and sees the copy as a draft', async ({ authedPage, api, account }) => {const event = await createLiveEventWithFreeTicket(api, account.organizerId);const duplicateTitle = uniqueName('E2E Duplicate');diff --git a/frontend/src/components/modals/PublishEventModal/index.tsx b/frontend/src/components/modals/PublishEventModal/index.tsxindex 03a1c28a5..e6d935a59 100644--- a/frontend/src/components/modals/PublishEventModal/index.tsx+++ b/frontend/src/components/modals/PublishEventModal/index.tsx@@ -5,6 +5,7 @@ import {t} from "@lingui/macro";import {useNavigate} from "react-router";import {BouncingEmoji} from "../../common/BouncingEmoji";import {Event, EventType, Product, ProductPriceType} from "../../../types.ts";+import {useGetAccount} from "../../../queries/useGetAccount.ts";import {useGetEventSettings} from "../../../queries/useGetEventSettings.ts";import {useGetOrganizer} from "../../../queries/useGetOrganizer.ts";import {useGetEventProductCategories} from "../../../queries/useGetProductCategories.ts";@@ -48,6 +49,7 @@ export const PublishEventModal = ({opened, onClose, event, onSuccess}: PublishEvconst organizerId = event.organizer_id ?? event.organizer?.id;const isRecurring = event.type === EventType.RECURRING;+ const {data: account, isFetched: isAccountFetched} = useGetAccount();const {data: eventSettings, isFetched: isSettingsFetched} = useGetEventSettings(eventId);const {data: organizer, isFetched: isOrganizerFetched} = useGetOrganizer(organizerId);const {data: productCategories, isFetched: isProductsFetched} = useGetEventProductCategories(eventId);@@ -58,18 +60,20 @@ export const PublishEventModal = ({opened, onClose, event, onSuccess}: PublishEvconst products = productCategories?.data?.flatMap((category) => category.products ?? []) ?? [];const hasProducts = products.length > 0;const hasPaidProducts = products.some(productRequiresPayment);+ const isSaasMode = !!account?.is_saas_mode_enabled;const isStripeEnabled = !!eventSettings?.payment_providers?.includes('STRIPE');const isStripeConnected = !!organizer?.stripe_connect_setup_complete;const hasOccurrences = (occurrencesQuery.data?.data?.length ?? 0) > 0;- const checksLoaded = isSettingsFetched+ const checksLoaded = isAccountFetched+ && isSettingsFetched&& isOrganizerFetched&& isProductsFetched&& (!isRecurring || occurrencesQuery.isFetched);const checks: PublishCheck[] = [];- if (hasPaidProducts && isStripeEnabled && !isStripeConnected) {+ if (isSaasMode && hasPaidProducts && isStripeEnabled && !isStripeConnected) {checks.push({key: 'stripe',blocking: true,