BMIT3173 Integrative Programming Report
BMIT3173 Integrative Programming Report
ASSIGNMENT 202505
Student ID : 23WMR14023
Programme : RSWY2S3
Tutorial Group : G2
Declaration
● I confirm that I have read and complied with all the terms and conditions
of Tunku Abdul Rahman University of Management and technology’s
plagiarism policy.
● I declare that this assignment is free from all forms of plagiarism and for
all intents and purposes is my own properly derived work.
2 of 56
I, Wo Jia Qian, 2314023, RSW Y2S3 G2 confirm that the submitted work are all my own
Signature: ________________
Date: 5/7/2025
3 of 56
Table of Contents
Furthermore, the system’s availability ensures that customers can book at any time,
anywhere, thereby boosting accessibility and convenience. For CCCWH, the system is
implemented through a robust web platform built with modern technologies, ensuring
reliability during peak booking periods. By modernising ticketing, reducing wait times, and
offering personalised experiences, the system positions CCCWH as a leader in the cinema
7 of 56
industry, delivering value to both customers and the organisation while driving sustainable
business growth.
2. Module Description
In a nutshell, the booking module is a complete, end-to-end e-commerce solution for selling
movie tickets online. It's designed to manage the entire process, from helping a user find a
show to collecting payments and generating a confirmation. Its core functions are:
Functionalities:
The movie ticket booking process at CCCWH theatres starts from the click of the “Buy
Tickets” button. The buttons which are located at the movie details page where the user
attempts to know more about the details of a specific movie or directly on the homepage on
each shown “now-showing” movie card components. Once clicked, the user will be redirected
to the first step of booking — selecting the date and showtimes.
Figure 1: Buy Tickets button at the bottom right of Movie Details Page
9 of 56
Figure 2: Buy Tickets button at the bottom of the Movie Card Components at Home Page
Important authentication of user identity is done before the user can start creating new
bookings, so that only authenticated logged in users are allowed to carry out actions related to
booking.
The authenticated user can start creating movie tickets by choosing their desired date and time
as the first step of creating a new booking of the specific movie. The user can choose from the
available line of options of dates displayed and their desired showtimes available based on the
selected day they want to watch the movie at our theatres.
10 of 56
Once the user selects their desired date and showtime, the user is redirected to a multi-step
form which signifies the beginning of creating a booking. It provides a guided, step-by-step
user experience for booking a movie ticket. This process handles the entire flow, from initial
selection to final confirmation. The entire process is a single page involves going from the
first step to the second step and finally the third step is booking is successfully created.
By default, the seats are not displayed if the user didn’t select any showtimes. Only if the user
selects a showtime, the seat layout dynamically changes based on which hall did that schedule
link to. Depending on which schedule the user selects, the seat layout related to the selected
schedule will be displayed under the schedule, below the screen image.
As shown in Figure 8-11, comparing Figure 9 and Figure 11, by default, the number of seats
selected is not displayed nor updated, as no seats are yet to be selected by the user. The seats
shaded dark grey signifies that these seats are already booked by other users on this date and
showtime.
Once the user selects the showtime, the user can start selecting the seats desired based on the
seat layout displayed. The number of seats will be updated, and a button will be displayed
from below the screen displaying the selected seat names and the button to confirm the
selection of seats. By default the book now button is not visible until the user has selected any
seats that is available.
14 of 56
Once the user decides the seats, when the user clicks on the “book seat(s)” button below, a
modal box will show up, displaying the seats selected by the user again for confirmation, and
the price of each seats depending on the type of seat.
15 of 56
As shown in the modal box, the selected movie title, selected date, selected showtime,
selected seats are displayed. Here, the user can select which type the tickets belong to, which
varies in terms of prices, choosing from Adult, Child and Oku.
Validation is done in which regardless of what type of tickets that the user selects, the number
of ticket types must match to the number of seats selected. For example, I have selected 2
seats, which by default, the system assumes the two seats belong to 2 adults. The validation
check works in a way as shown below:
16 of 56
9. Error if Number of Tickets did not match Number of Selected Seats
As shown in Figure 14-15, if the user tries to decrease the number of tickets while having the
number of tickets not matching the number of seats selected, an error message shows, not
allowing the user to proceed to checkout unless the number of tickets matches the number of
seats selected.
If the user desires to reconsider the seats, the user is allowed to click on “edit seats” which
will close the modal box, and allow the user to update the seats, which will update the selected
18 of 56
seats and number of tickets in the modal box when the user clicks on “book seat(s)” again.
11.Proceed To Checkout
After the user has selected the seats and ready to move on to the next step, the user clicks on
the “Proceed to Checkout” button which will redirect the user to step 2 —- Order
Confirmation. This page will display the hall name that belongs to the schedule, the selected
date, the selected seats, and the price of the tickets.
If the user attempts to redecide which seats to select at the Order Details Confirmation page,
the user can click on the “Edit Seats” button which will redirect the user back to the first step
which is selecting seats and update the ticket types again.
22 of 56
Figure 21: User attempts to Edit Seat by Clicking Edit Seats button
Once the user confirms the order details and is ready to confirm the booking, the user can
press the “Checkout” button and proceed to finalize the booking process.
At the Order Success page, there is a button of “My Bookings” coloured in red which will link
to the My Bookings page.
23 of 56
At the My Bookings page, users are able to view all past and present bookings, with the basic
details of each booking being displayed including the movie booked, the cinema hall name,
the date and showtime, the selected seats and the price.
24 of 56
At the My Bookings page, users can click the “View Receipt” button to check the receipt of
the booking, which will contain the selected movie, the prices of each tickets, selected seats,
and a unique qr code which contain a unique code that links to the code that is stored in the
database.
The generated qr code is actually a unique code stored within the qr code that is the same as
the code stored to the database record to that booking. This can be useful for the theatre
counter staff to use the code scanned for ticket authenticity checking.
The admin view booking page provides a one page dashboard showing the overall CCCWH
theatre revenue and total bookings made in the system.
The view bookings page for admin allows them to sort and filter displayed bookings records
of all users based on their needs. By default, the booking records are not filtered, but it is
sorted by the latest booking date by default.
Figure 33: Sorting Booking Order by Total Price Admin View Bookings
This allows the admin to filter the displayed booking transactions based on price by setting the
minimum price and maximum price. The result will be displaying booking transactions that
result in total amount within the set minimum and maximum price.
Figure 34: Filtering Bookings based on Minimum and Maximum Price Admin View
Bookings
29 of 56
This allows the admin to filter the displayed booking transactions based on movies available
in the system. This can be helpful for admin to see trends in the popularity of a particular
movie and how well a particular movie is accepted by the public, which is useful for decision
making for developing marketing strategies based on trends in bookings of movies.
30 of 56
3. Entity Classes
Figure 38: CCCWH Movie Ticket Booking System Analysis Class Diagram
4. Design Pattern
The Facade design pattern is a structural pattern that provides a simplified, higher-level
interface to a complex subsystem. Its primary goal is to hide the complexity of that
subsystem from the client code. Instead of the client having to interact with many
different classes and objects to perform a single task, it interacts with one, unified Facade
class.
In your movie ticket booking module, the BookingController acts as the client, and the
various models and database transactions (Booking, BookingSeat, Schedule, DB) make
up the complex subsystem. Your BookingFacade acts as the intermediary.
2. Simplified Call: The controller doesn't contain any database logic. It makes a single,
clean method call: $this→bookingFacade→cancelBooking($booking). The controller
is now free from the "how" and is only concerned with the "what."
3. Facade Orchestration: The BookingFacade method receives this request. It then
orchestrates all the necessary lower-level actions to complete the task. This includes:
a. Accessing the Booking model.
b. Iterating through the bookingSeats collection.
c. Calling the updateExistingPivot method on the schedule relationship.
d. Enclosing all of this in a database transaction to ensure atomicity.
4. Result Return: The facade returns a simple, final result (true or false) to the
controller, which then uses this to determine the next step (e.g., redirecting to a
success page or showing an error).
Using the Facade pattern to the CCCWH Movie Ticket Booking system provides significant
benefits that make the code more robust, scalable, and maintainable. Without a facade, the
BookingController would be bloated with logic for every step. It would have
DB::beginTransaction(), looping through the seats, pivot table updates, and error handling
with DB::rollBack() [Link] is difficult to read and manage. With the use of Facade pattern,
the controller's code is clean and adheres to the Single Responsibility Principle. It only
handles the HTTP request and response flow, leaving the business logic to the facade. This
makes the controller's purpose immediately clear to any developer.
The Facade encapsulates all the complex business logic in one central place. All code related
to canceling a booking (transaction management, seat updates, status changes) is in a single
method. This makes the CCCWH Movie Ticket Booking system more reliable because you
have a single source of truth for how a cancellation should occur. If a bug is found, you know
exactly where to fix it.
33 of 56
The UML diagram clearly shows that both of the clients (BookingController and
AdminBookingController) are completely decoupled from the underlying complexity of
your system. They only interact with the BookingFacade, which acts as a powerful, central
orchestrator.
The facade, in turn, manages all the different subsystems, including your Eloquent models
(Booking, Schedule, Movie, etc.) and Laravel's own facades for database transactions (DB),
logging (Log), and HTTP requests (Request).
By putting all the complex logic inside the BookingFacade, you have created a system that is:
● Highly Reusable: The same facade methods are used for two different purposes
(user-facing booking and admin reporting). This is true because as seen in the class
diagram, there are two clients to the facade, demonstrating that the facade's
functionality is not tied to a single user context. It provides a consistent, logical API
for booking-related operations across the entire application. For example: for the filter
and sorting bookings, The facade abstracts away a remarkable amount of complexity,
while also including subsystems like Laravel’s DB facade, as the
filterAndSortingBookings method relies heavily on its low-level query builder to
construct a complex subquery.
● Easy to Maintain: All booking-related logic is in one place. If you need to change
how you store or retrieve a booking, you only have to modify the facade. The
controller remains completely untouched, saving developers a tremendous amount of
refactoring effort. Also, the Facade encapsulates all the complex business logic in one
central place. All code related to finalizing a booking (transaction management, seat
updates, status changes) is in a single method. This makes your system more reliable
because we have a single source of truth for how a booking creation should occur. If a
35 of 56
bug is found, we know exactly where to fix it
● Clean and Readable: The Facade design pattern makes your code more readable by
perfectly aligning with the Single Responsibility Principle. Your Controller now has a
single, clear responsibility: handling the HTTP request-response cycle. All the
complex, behind-the-scenes booking logic is delegated to the Facade, which has its
own single responsibility. This separation of concerns makes your code incredibly
easy to read, debug, and maintain.
5. Software Security
The two terms often go hand-in-hand. An attacker might tamper with data to trick the
system into granting them privileges they shouldn't have. In the CCCWH movie booking
system, this threat could happen at the point where a user confirms their booking. The
step-to-step breakdown of a possible attack on Tampering Data:
1) A Legitimate User “Alice” Starts a booking, logs in and selects two seats for a movie.
Her browser, and the front-end code, correctly identifies her account_id (e.g., 123).
2) An attacker, "Mellow," is watching the network traffic. When Alice's browser sends the
POST request to our reserve tickets API endpoint to finalize the booking, Mallory
intercepts the request payload.
3) The payload contains all the booking details, including the account_id. The attacker
tampers with this data, changing the account_id from Alice's (123) to a different account
ID they want to exploit, perhaps a higher-privileged account.
4) The System is Fooled: If your system's finalizeBooking method blindly trusts the
account_id sent in the request, it will create the new booking record and associate it with
the account the hacker tampered with and modified.
38 of 56
As a result, the booking record is now incorrectly associated with another account, corrupting
your data, meaning data is tampered with. Plus, the target injected account (the attacker's
target) now has an unauthorized booking in their name. Since CCCWH theatres provide
features (like a digital ticket, a QR code) based on bookings, the attacker has successfully
gained access to these services without having paid for them or performed the action
themselves. This is a classic example of an Injection Attack where malicious data
(account_id) is "injected" into a legitimate request to bypass security controls.
A Denial of Service (DoS) attack is a significant threat to any web application, and it's
especially dangerous for a booking system where the availability of resources (like movie
seats) is critical.
A DoS attack is an attempt to make a machine or network resource unavailable to its intended
users. This is typically done by temporarily or indefinitely disrupting the services of a host
connected to the [Link] most common way to do this is to overwhelm the target machine
with a flood of traffic, forcing it to consume all its resources (CPU, memory, database
connections) trying to handle the flood, leaving no resources for legitimate users.
In the context of the CCCWH booking system, an attacker doesn't necessarily need to be a
skilled hacker; they just need a simple script. Here's how a DoS attack could unfold using the
finalizeBooking endpoint:
2) The Attack: An attacker could write a simple script that sends thousands of simultaneous
API requests to finalizeBooking, all attempting to reserve the same set of seats that they
know are already taken or invalid.
3) The Overload: Each of these requests will trigger a DB::beginTransaction() and an
attempt to lock the seats. Since the seats are unavailable, each transaction will fail, and
your catch block will be executed, triggering a DB::rollBack()
4) The Result: The server is now spending all its resources (CPU cycles, memory, and
database connections) on starting and immediately rolling back thousands of database
transactions. This becomes an extremely resource-intensive process. Legitimate users who
try to book a ticket will find the system slow or completely unresponsive because the
server is too busy processing the malicious, failed transactions. The service is effectively
denied to paying customers.
5.2.2 Error Handling & Logging - Logging All Events & Exceptions (Threat 2)
An attacker could program a script to rapidly send a large number of booking requests with
invalid or already-taken seat IDs. This could cause the booking system to repeatedly start and
then roll back database transactions, consuming significant server resources and potentially
leading to a resource bottleneck or a system crash. The Booking Facade’s finalizeBooking
facade method explicitly logs an error when a transaction is rolled back due to an exception
(e.g., "One or more selected seats are no longer available"). An administrator monitoring the
logs would quickly see a high volume of these specific error messages originating from a
single IP address, providing the necessary data to identify and block the malicious user before
the system is overwhelmed. Without this logging, the failed attacks would be invisible,
making the system vulnerable.
Think of it as a smoke detector. It doesn't put out the fire, but it alerts you to the danger so you
can take action.
1) Early Detection: The detailed error logging for the Booking module is a powerful
monitoring tool. The Log::error calls inside your try...catch blocks will record a clear,
consistent error message for every failed booking attempt.
2) Pattern Recognition: An administrator monitoring the logs would see an unusually
high volume of specific error messages, such as "One or more selected seats are no
longer available." or "Database transaction rolled back." This pattern—many
identical errors in a short period—is a strong indicator of a malicious attack, not just a
normal user error.
3) Rapid Response: Once the pattern is identified, the administrator can quickly find the
source of the attack by checking the IP addresses associated with the logged requests.
They can then implement a firewall rule to block the malicious IP, effectively stopping
the attack.
Without robust logging, the system would simply become slow and unresponsive, and we
wouldn't know why. We would be blind to the attack until it was too late.
42 of 56
6. Web Services
6.1 Overview
The choice to use a RESTful API for the Booking Module is highly beneficial, as it adheres to
the Interface Agreement (IFA) standards and offers several advantages, which includes
statelessness, in which each API request from the Booking Module to the Review Module or
other modules is self-contained. The RESTful architecture ensures that the Booking Module
is not tightly tied to the internal implementation of other modules. If the Movie or Schedule
Management Modules change their database schemas, as long as their API endpoints remain
the same, the Booking Module will continue to function correctly. This is the very definition
of a modular and scalable system.
47 of 56
The Booking Module exposes several RESTful API endpoints to enable other modules to
interact with booking data. These endpoints are defined in your API routes and managed by
the BookingController. They are primarily consumed by the Review Module and other
internal services.
Webservice Mechanism
Item Description
Protocol RESTFUL
URL [Link]
Code Snippets
In [Link]
Item Description
Protocol RESTFUL
Function Retrieves a boolean for validating if the current user has made bookings of a
Description specific movie
URL [Link]
Code Snippets
50 of 56
In [Link]
Webservice Mechanism
Item Description
Protocol RESTFUL
URL [Link]
Function Name -
7. Index
LIST OF FIGURES
No Tittle Page
1. Introduction to the System 4
2. Module Description 5
Figure 1: Buy Tickets button at the bottom right of Movie Details Page 6
Figure 2: Buy Tickets button at the bottom of the Movie Card Components at Home Page
7
Figure 3: Logging in Required before able to Create Bookings 7
Figure 4: Choosing Desired Dates and Showtime 8
Figure 5: Step 1 – Selecting Seats 8
Figure 6: Step 2 – Checking Out 9
Figure 7: Step 3 – Success Message if Booking Success 9
Figure 8: Seat Layout before Schedule selected (part 1) 9
Figure 9: Seat Layout before Schedule selected (part 2) 10
Figure 10: Seat Layout after Schedule selected (part 1) 10
Figure 11: Seat Layout after Schedule selected (part 2) 11
Figure 12: Select Seats page after Selected Seats 12
Figure 13: Modal Box for Seats Tickets Confirmation 13
Figure 14: User attempts to decrease the number of tickets for seats 14
Figure 15: Error Message shows when User Clicks on “Go to Checkout” 15
Figure 16: User attempts to edit Seats Selected by clicking on Edit Seats button 16
Figure 17: User update the seats selected and clicks on the Book Seat(s) button 17
Figure 18: The Modal box is updated with the selected seats, user selects 1 adult, 1 child
and 1 oku 18
Figure 19: Order Details Confirmation Page (Part 1) 18
Figure 20: Order Details Confirmation Page (Part 2) 19
Figure 21: User attempts to Edit Seat by Clicking Edit Seats button 20
Figure 22: Step 3 – Confirms Booking Success 20
Figure 23: User clicks on the My Bookings button 21
Figure 24: User is redirected to My Bookings page 21
Figure 25: Each Booking Record item in My Bookings page 22
Figure 26: Receipt page of a Specific Selected Booking 22
Figure 27: QR code generated upon successful booking at view ticket page 23
Figure 28: QR code scanned via phone 23
Figure 29: QR code scanned via phone matching the code stored in database 24
Figure 30: Admin Manage Bookings Page (Part 1) 24
55 of 56