<aside> 👋 I am Faiz Mohammad , I will try my best to explain Event Booking Rest APIs I’ve built you can find the repo here
This Blog contains an overview of how you can design and test different Scenarios for Event booking APIs
📩 Contact Me 📩
</aside>
Version: [v1.0.0] Date: 15/08/2024
Event Booking RESTFul APIs which follows HTTP Protocols. It is design to Book event by passing various attributes like Total no of tickets, Event Id, User details etc.
Admin: To restrict users and secure event database “Admin” will automatically generated with data passed during database creation using Environment Variables
Environment Variables: Instead of exposing any secrete key , id , data I used .env where user can create runtime environment variables on server which is a part of security to protect private data. Data protected like
.env (file)
ADMIN_EMAI
ADMIN_USERNAME
ADMIN_PASSWORD
DATABASE_URL
JWT_SECRET_KEY
ALGORITHM
JWT_REFRESH_TOKEN_KEY
ACCESS_TOKEN_EXPIRE_MINUTES = 30
GOOGLE_MAPS_API_KEY
PAYPAL_SECRET_KEY
PAYPAL_CLIENT_ID
PAYPAL_ENV = "sandbox" #sandbox or live Paypal envoirnment
PAYPAL_API_BASE_URL = "<https://sandbox.paypal.com>"
HOST = "<http://127.0.0.1:8000>"
JWT: To give secure access for multiple end points like “booking events” and “adding events” to role based users
To book any event should full fill following scenarios and conditions:
API endpoint :
POST Request
/event/{event_id}/book/?ticket_quantity=6
Book Event Flow:
Flow to book event
1. Check if Ticket quantity is present is args else set default 1
2. Check if Event exisit with the same event id in Url
3. Check if event date is not passed and should be a furture event
4. IMP - Check if user has pending or processing payments with other or same events
5. Check if ticket available based on requested tickets
(Manage locking tickets system)
6. Deduct required tickets from total ticket and add it in reserve tickets
7. Add booking and set status to Processing
8. Genetate payment url (add success , cancel payment url's)
Payment URL :
Security
Database refresh using time or Message broker
Limitation