Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Ticket Sale: API and database concept

Jacqueline Bronger edited this page Jan 10, 2019 · 31 revisions

Database Tables

TBL1: event

Columns:

event (INT/PK/AI) (=event id) news INTEGER kino INTEGER file (INT/FK) title (STRING) description (STRING) locality (STRING) start (DATETIME) end (DATETIME) link (STRING)

TBL2: ticket_type

Columns:

ticket_type (INT/PK/AI) event (INT/FK) price (INT) contingent (INT) description (STRING) ticket_payment (INT/FK)

TBL3: ticket_history

Columns:

ticket_history (INT/PK/AI) (=ticket id) member (INT/FK) ticket_type (INT/FK) purchase (TIMESTAMP) redemption (TIMESTAMP) created (TIMESTAMP/CT) code (STRING)

TBL4: ticket_payment

Columns:

ticket_payment (INT/PK/AI) name (STRING) min_amount (DOUBLE) max_amount (DOUBLE) config (STRING)

API Endpoints

  1. Event Information
  2. Ticket Information
  3. Ticket Reservation
  4. Ticket Payment
  5. Admin Functions

Event Information

1. Get information for all events.

GET api/event/list/[i:id]?

Parameters:

  • id (optional) -> only return event with the defined ID

Response: List

2. Get information events in the defined timeframe.

GET api/event/list/[i:earliest]/[i:latest]

Parameters:

  • earliest (required) -> only return events that happen at or after the specified timestamp
  • latest (required) -> only return events that happen at or before the specified timestamp

Response: Event

3. Fuzzy search for an event. Only returns information shown in the single cards of the event overview.

GET api/event/list/search/[*:search_string]

Parameters:

  • search_string (required)

Response: List

Ticket Information

4. Get list of purchased tickets for a particular user. Return value for ticketList is null if no tickets have been purchased.

POST api/event/ticket/my/?

Parameters:

none

Response: List

5. Get list of ticket types available for a certain event.

GET api/event/ticket/type/[i:event]

Parameters:

  • event (required) -> event ID that the ticket types should be associated with.

Response: List

6. Check the validity of a ticket for a certain event

POST api/event/ticket/validate

Parameters:

  • event_id (required) -> event that the ticket is associated with
  • code (required) -> ticket code

Response ['valid' => $valid, 'purchase' => $data['purchase'], 'redemption' => $data['redemption'], 'ticket_history' => $data['ticket_history'], 'firstname' => $userdata['firstname'], 'name' => $userdata['surname']]

7. Redeem a ticket that has been validated before

POST api/event/ticket/redeem

Parameters:

  • ticket_history (required) -> ID of the ticket that should be redeemed

Response ['success' => true]

8. Get Ticket Stats, i.e. contingent and number of sold tickets for a certain event.

GET api/event/ticket/status/[i:event]/?

Parameters:

  • event (required): event to return the stats for

Response: [ { "ticket_type": "1", "contingent": "200", "sold": "3" }, { "ticket_type": "2", "contingent": "100", "sold": "0" }, { "ticket_type": "3", "contingent": "500", "sold": "0" }, { "ticket_type": "4", "contingent": "200", "sold": "0" } ]

Ticket Reservation

9. Reserve a ticket when user enters payment process. User will receive a ticket ID that they can use to perform the purchase later on.

POST api/event/ticket/reserve

Parameters:

  • ticket_type (required): ID of ticket type (-> implies eventID)

Response [ “ticket_history” => $ticketID ]

10. Cancel a previous reservation.

POST api/event/ticket/reserve/cancel

Parameters:

  • ticket_history (required) -> ticket ID

Response { “success”: true }

Ticket Payment

11. Buy a ticket that was reserved beforehand.

POST api/event/ticket/payment/stripe/purchase

Parameters:

  • customer_name (required) -> name of credit card holder
  • ticket_history (required) -> ticket ID retrieved before from ticket reservation
  • token (required) -> contains token generated on client side from credit data

Response: [ 'event' => $ticket_data['event'], 'ticket_history' => $ticket_data['ticket_history'], 'code' => $ticket_data['code'], 'ticket_type' => $ticket_data['ticket_type'], ]

12. Generate Stripe ephimeral key

POST api/event/ticket/payment/stripe/ephemeralkey/?

Parameters:

  • api_version (required) -> stripe api version from client

Response: Stripe's Ephimeral Key Object

Admin Functions

POST api/event/ticket/sold/?

Parameters:

  • event (required) -> event to return the ticket data for

Response: [ { "name": "Toni Wampe", "lrz_id": "gr234we", "ticket_type": "5", "ticket_payment": null, "created": "2018-07-08 15:15:21", "purchase": "2018-07-08 15:17:21", "redemption": "2018-07-12 15:15:21" }, { "name": "Max Mustermann", "lrz_id": "gb123er", "ticket_type": "5", "ticket_payment": null, "created": "2018-07-08 15:16:41", "purchase": null, "redemption": null } ]

Clone this wiki locally