Files
aperonight/checkout-implementation-summary.md

47 lines
1.6 KiB
Markdown
Executable File

# Checkout Process Implementation Summary
## Database Changes
1. **Migration**: Added `first_name` and `last_name` fields to the `tickets` table
- File: `db/migrate/20250828143000_add_names_to_tickets.rb`
## Model Changes
1. **Ticket Model**:
- Added validations for `first_name` and `last_name` when required by ticket type
- Added `requires_names?` method to check if names are required based on ticket type
## Controller Changes
1. **Events Controller**:
- Modified `checkout` action to redirect to name collection when tickets require names
- Added `collect_names` action to display form for collecting ticket holder names
- Added `process_names` action to handle submitted names and proceed to payment
- Updated `payment_success` action to create tickets with names when provided
## View Changes
1. **Events Show View**:
- Added `change` event listener to quantity inputs in ticket cards
2. **Ticket Card Component**:
- Added `change` event listener to quantity inputs
3. **New View**:
- Created `app/views/events/collect_names.html.erb` for collecting ticket holder names
## Route Changes
1. **New Routes**:
- `GET events/:slug.:id/names` - Collect names for tickets requiring identification
- `POST events/:slug.:id/names` - Process submitted names and proceed to payment
## JavaScript Changes
1. **Ticket Cart Controller**:
- No changes needed as name collection is handled server-side
## Outstanding Tasks
1. Run the database migration in the Docker environment once gem issues are resolved
2. Test the complete checkout flow with name collection