Änderungen (relevant):
- Add‑on Checkout auf Transactions + Transaction‑ID speichern: app/Services/Addons/EventAddonCheckoutService.php
- Paket/Marketing Checkout auf Transactions: app/Services/Paddle/PaddleCheckoutService.php
- Gift‑Voucher Checkout: Customer anlegen/finden + Transactions: app/Services/GiftVouchers/
GiftVoucherCheckoutService.php
- Tests aktualisiert: tests/Feature/Tenant/EventAddonCheckoutTest.php, tests/Unit/PaddleCheckoutServiceTest.php,
tests/Unit/GiftVoucherCheckoutServiceTest.php
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { resolveOnboardingRedirect } from './onboardingGuard';
|
||||
import {
|
||||
ADMIN_WELCOME_BASE_PATH,
|
||||
ADMIN_WELCOME_EVENT_PATH,
|
||||
ADMIN_WELCOME_PACKAGES_PATH,
|
||||
ADMIN_WELCOME_SUMMARY_PATH,
|
||||
} from '../../constants';
|
||||
|
||||
@@ -15,6 +15,8 @@ describe('resolveOnboardingRedirect', () => {
|
||||
pathname: '/event-admin/mobile/dashboard',
|
||||
isWelcomePath: false,
|
||||
isBillingPath: false,
|
||||
isOnboardingDismissed: false,
|
||||
isOnboardingCompleted: false,
|
||||
});
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
@@ -24,9 +26,11 @@ describe('resolveOnboardingRedirect', () => {
|
||||
hasEvents: false,
|
||||
hasActivePackage: false,
|
||||
selectedPackageId: null,
|
||||
pathname: ADMIN_WELCOME_PACKAGES_PATH,
|
||||
pathname: ADMIN_WELCOME_BASE_PATH,
|
||||
isWelcomePath: true,
|
||||
isBillingPath: false,
|
||||
isOnboardingDismissed: false,
|
||||
isOnboardingCompleted: false,
|
||||
});
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
@@ -39,6 +43,8 @@ describe('resolveOnboardingRedirect', () => {
|
||||
pathname: '/event-admin/mobile/billing',
|
||||
isWelcomePath: false,
|
||||
isBillingPath: true,
|
||||
isOnboardingDismissed: false,
|
||||
isOnboardingCompleted: false,
|
||||
});
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
@@ -51,6 +57,8 @@ describe('resolveOnboardingRedirect', () => {
|
||||
pathname: '/event-admin/mobile/dashboard',
|
||||
isWelcomePath: false,
|
||||
isBillingPath: false,
|
||||
isOnboardingDismissed: false,
|
||||
isOnboardingCompleted: false,
|
||||
});
|
||||
expect(result).toBe(ADMIN_WELCOME_EVENT_PATH);
|
||||
});
|
||||
@@ -63,11 +71,13 @@ describe('resolveOnboardingRedirect', () => {
|
||||
pathname: '/event-admin/mobile/dashboard',
|
||||
isWelcomePath: false,
|
||||
isBillingPath: false,
|
||||
isOnboardingDismissed: false,
|
||||
isOnboardingCompleted: false,
|
||||
});
|
||||
expect(result).toBe(ADMIN_WELCOME_SUMMARY_PATH);
|
||||
});
|
||||
|
||||
it('redirects to packages when no selection exists', () => {
|
||||
it('redirects to landing when no selection exists', () => {
|
||||
const result = resolveOnboardingRedirect({
|
||||
hasEvents: false,
|
||||
hasActivePackage: false,
|
||||
@@ -75,8 +85,10 @@ describe('resolveOnboardingRedirect', () => {
|
||||
pathname: '/event-admin/mobile/dashboard',
|
||||
isWelcomePath: false,
|
||||
isBillingPath: false,
|
||||
isOnboardingDismissed: false,
|
||||
isOnboardingCompleted: false,
|
||||
});
|
||||
expect(result).toBe(ADMIN_WELCOME_PACKAGES_PATH);
|
||||
expect(result).toBe(ADMIN_WELCOME_BASE_PATH);
|
||||
});
|
||||
|
||||
it('does not redirect when already on target', () => {
|
||||
@@ -84,9 +96,39 @@ describe('resolveOnboardingRedirect', () => {
|
||||
hasEvents: false,
|
||||
hasActivePackage: false,
|
||||
selectedPackageId: null,
|
||||
pathname: ADMIN_WELCOME_PACKAGES_PATH,
|
||||
pathname: ADMIN_WELCOME_BASE_PATH,
|
||||
isWelcomePath: false,
|
||||
isBillingPath: false,
|
||||
isOnboardingDismissed: false,
|
||||
isOnboardingCompleted: false,
|
||||
});
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it('does not redirect when onboarding is dismissed', () => {
|
||||
const result = resolveOnboardingRedirect({
|
||||
hasEvents: false,
|
||||
hasActivePackage: false,
|
||||
selectedPackageId: null,
|
||||
pathname: '/event-admin/mobile/dashboard',
|
||||
isWelcomePath: false,
|
||||
isBillingPath: false,
|
||||
isOnboardingDismissed: true,
|
||||
isOnboardingCompleted: false,
|
||||
});
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it('does not redirect when onboarding is completed', () => {
|
||||
const result = resolveOnboardingRedirect({
|
||||
hasEvents: false,
|
||||
hasActivePackage: false,
|
||||
selectedPackageId: null,
|
||||
pathname: '/event-admin/mobile/dashboard',
|
||||
isWelcomePath: false,
|
||||
isBillingPath: false,
|
||||
isOnboardingDismissed: false,
|
||||
isOnboardingCompleted: true,
|
||||
});
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
ADMIN_WELCOME_BASE_PATH,
|
||||
ADMIN_WELCOME_EVENT_PATH,
|
||||
ADMIN_WELCOME_PACKAGES_PATH,
|
||||
ADMIN_WELCOME_SUMMARY_PATH,
|
||||
} from '../../constants';
|
||||
|
||||
@@ -11,6 +11,8 @@ type OnboardingRedirectInput = {
|
||||
pathname: string;
|
||||
isWelcomePath: boolean;
|
||||
isBillingPath: boolean;
|
||||
isOnboardingDismissed?: boolean;
|
||||
isOnboardingCompleted?: boolean;
|
||||
};
|
||||
|
||||
export function resolveOnboardingRedirect({
|
||||
@@ -20,11 +22,17 @@ export function resolveOnboardingRedirect({
|
||||
pathname,
|
||||
isWelcomePath,
|
||||
isBillingPath,
|
||||
isOnboardingDismissed,
|
||||
isOnboardingCompleted,
|
||||
}: OnboardingRedirectInput): string | null {
|
||||
if (hasEvents) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isOnboardingDismissed || isOnboardingCompleted) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isWelcomePath || isBillingPath) {
|
||||
return null;
|
||||
}
|
||||
@@ -34,7 +42,7 @@ export function resolveOnboardingRedirect({
|
||||
? ADMIN_WELCOME_EVENT_PATH
|
||||
: shouldContinueSummary
|
||||
? ADMIN_WELCOME_SUMMARY_PATH
|
||||
: ADMIN_WELCOME_PACKAGES_PATH;
|
||||
: ADMIN_WELCOME_BASE_PATH;
|
||||
|
||||
if (pathname === target) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user