Files
aperonight/README-checkout-implementation.md

1.5 KiB
Executable File

Checkout Process Implementation

This document describes the implementation of the checkout process with name collection for tickets that require identification.

Implementation Details

The implementation includes:

  1. Database migration to add first_name and last_name fields to tickets
  2. Updates to the Ticket model to validate names when required
  3. New routes and controller actions for name collection
  4. A new view for collecting ticket holder names
  5. Updates to the existing JavaScript controller

Running the Migration

Once the Docker environment is fixed, run the following command to apply the database migration:

docker compose exec rails bundle exec rails db:migrate

Testing the Implementation

  1. Start the Docker containers:

    docker compose up -d
    
  2. Visit an event page and select tickets that require identification

  3. The checkout process should redirect to the name collection page

  4. After submitting names, the user should be redirected to the payment page

  5. After successful payment, tickets should be created with the provided names

Code Structure

  • Migration: db/migrate/20250828143000_add_names_to_tickets.rb
  • Model: app/models/ticket.rb
  • Controller: app/controllers/events_controller.rb
  • Views:
    • app/views/events/collect_names.html.erb (new)
    • app/views/events/show.html.erb (updated)
    • app/views/components/_ticket_card.html.erb (updated)
  • Routes: config/routes.rb (updated)
  • JavaScript: app/javascript/controllers/ticket_cart_controller.js (no changes needed)