Skip to main content

Voucher System

Overview

The Voucher System provides passcode-based access control for the photobooth. When enabled, users must scan a QR code or enter a passcode before they can access the frame selection and proceed with their photo session.

Configuration Settings

interface VoucherSettings {
active: boolean; // Enable/disable voucher requirement
passcode: string; // Required passcode (configurable by vendor)
}

User Flow

  1. Frame Selection: User arrives at /frame-selection
  2. Voucher Check: System checks if settings.voucher.active === true
  3. Prompt: If active, user sees voucher scan prompt (QR scanner or passcode input)
  4. Verification: User scans QR or enters passcode
  5. Validation: VoucherProvider.verify() checks against stored passcode
  6. Access Granted: On success, sessionStorage['photobooth-voucher-verified'] = true
  7. Proceed: User can now select frames and continue normally

Provider: VoucherProvider

Location: apps/web/providers/voucher-provider.tsx

interface VoucherContextType {
isVerified: boolean; // Current verification state
verify: (passcode: string) => boolean; // Verify passcode, returns success
clearVerification: () => void; // Clear verification (for new session)
}

State Management

  • In-memory state: isVerified boolean
  • Persistence: sessionStorage['photobooth-voucher-verified'] (boolean)
  • Settings source: SettingsProvider via useSettings()

Verification Logic

const verify = (passcode: string): boolean => {
if (!voucherActive || !storedPasscode) return false;
const matches = passcode.trim() === storedPasscode.trim();
if (matches) {
writeVoucherVerification(true); // Persist to sessionStorage
setIsVerified(true);
}
return matches;
};

Integration Points

ComponentUsage
routes/frame-selection.tsxChecks useVoucher().isVerified before showing frames
hooks/use-voucher-settings.tsLoads voucher configuration
lib/workflow-session.tsreadVoucherVerification() / writeVoucherVerification()

Configuration Location

Vendor configures in /customizationVoucher Settings Tab:

  • Toggle: Enable/disable voucher system
  • Passcode: Set required passcode (alphanumeric)

Security Notes

  • Passcode is stored in plain text in settings (acceptable for event-based access)
  • Verification state is per-session (cleared when browser tab closes)
  • Manual "clear" available via clearVerification() for new sessions