Package src.controller
Class PaymentManager
Object
PaymentManager
Controller for handling all logic related to
Payment
- Version:
- 1.0
- Author:
- Ci Hui
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
calculateHolidayWeekendPrice
(DateTime showingTime) Method to calculate the Price Weight when the day is a special day ie.static double
calculateMovieTicketPrice
(MovieGoer movieGoer, String cinemaUUID, String movieUUID, String seatUUID, DateTime showingTime) Method to calculate the price of a Movie Ticketstatic Payment
createBankTransactioPayment
(String transactionID, double movieTicketPrice) Method to create aPayment
instance with Payment Type of Bank Transaction and save to databasestatic Payment
createCardPayment
(String transactionID, double movieTicketPrice) Method to create aPayment
instance with Payment Type of Card Payment and save to databasestatic Payment
createQRCodePayment
(String transactionID, double movieTicketPrice) Method to create aPayment
instance with Payment Type of QR Code and save to databasestatic String
generateTransactionId
(String cinemaCode) Method to generate Transaction ID of the Payment Format of Transaction ID: XXXYYYYMMDDhhmm (XXX: Cinema Code in letters, YYYY: year, MM: month, DD: day, hh: hour, mm: minutes)static Payment
getPaymentByUUID
(String paymentUUID) Method to obtain a Payment by its UUID
-
Constructor Details
-
PaymentManager
public PaymentManager()Constructor
-
-
Method Details
-
createQRCodePayment
Method to create aPayment
instance with Payment Type of QR Code and save to database- Parameters:
transactionID
- is the transaction ID of Payment generated when payment is made by Movie GoermovieTicketPrice
- is the total price of the Movie Tickets booked by Movie Goer- Returns:
- the created
Payment
instance
-
createBankTransactioPayment
Method to create aPayment
instance with Payment Type of Bank Transaction and save to database- Parameters:
transactionID
- is the transaction ID of Payment generated when payment is made by Movie GoermovieTicketPrice
- is the total price of the Movie Tickets booked by Movie Goer- Returns:
- the created
Payment
instance
-
createCardPayment
Method to create aPayment
instance with Payment Type of Card Payment and save to database- Parameters:
transactionID
- is the transaction ID of Payment generated when payment is made by Movie GoermovieTicketPrice
- is the total price of the Movie Tickets booked by Movie Goer- Returns:
- the created
Payment
instance
-
calculateMovieTicketPrice
public static double calculateMovieTicketPrice(MovieGoer movieGoer, String cinemaUUID, String movieUUID, String seatUUID, DateTime showingTime) Method to calculate the price of a Movie Ticket- Parameters:
movieGoer
- is theMovieGoer
who booked the Movie TicketcinemaUUID
- is the unique ID of the Cinema chosen by the Movie GoermovieUUID
- is the unique ID of the Movie chosen by the Movie GoerseatUUID
- is the unique ID of the Seat chosen by the Movie GoershowingTime
- is theDateTime
of Showing Time of the Movie chosen by the Movie Goer- Returns:
- the calculated price of the Movie Ticket
-
generateTransactionId
Method to generate Transaction ID of the Payment Format of Transaction ID: XXXYYYYMMDDhhmm (XXX: Cinema Code in letters, YYYY: year, MM: month, DD: day, hh: hour, mm: minutes)- Parameters:
cinemaCode
- is the Cinema Code of the chosen Cinema, obtained from the last 3 characters of the Cinema UUID- Returns:
- the Transaction ID
-
getPaymentByUUID
Method to obtain a Payment by its UUID- Parameters:
paymentUUID
- is the target Payment's UUID- Returns:
- the target
Payment
-
calculateHolidayWeekendPrice
Method to calculate the Price Weight when the day is a special day ie. Weekends or Holidays- Parameters:
showingTime
- is theDateTime
of the Showing Time of the Movie chosen by the Movie Goer- Returns:
- the Price Weight of Special Day (Weekend or Holiday)
-