Class PaymentManager

Object
PaymentManager

public class PaymentManager extends Object
Controller for handling all logic related to Payment
Version:
1.0
Author:
Ci Hui
  • Constructor Details

    • PaymentManager

      public PaymentManager()
      Constructor
  • Method Details

    • createQRCodePayment

      public static Payment createQRCodePayment(String transactionID, double movieTicketPrice)
      Method to create a Payment 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 Goer
      movieTicketPrice - is the total price of the Movie Tickets booked by Movie Goer
      Returns:
      the created Payment instance
    • createBankTransactioPayment

      public static Payment createBankTransactioPayment(String transactionID, double movieTicketPrice)
      Method to create a Payment 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 Goer
      movieTicketPrice - is the total price of the Movie Tickets booked by Movie Goer
      Returns:
      the created Payment instance
    • createCardPayment

      public static Payment createCardPayment(String transactionID, double movieTicketPrice)
      Method to create a Payment 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 Goer
      movieTicketPrice - 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 the MovieGoer who booked the Movie Ticket
      cinemaUUID - is the unique ID of the Cinema chosen by the Movie Goer
      movieUUID - is the unique ID of the Movie chosen by the Movie Goer
      seatUUID - is the unique ID of the Seat chosen by the Movie Goer
      showingTime - is the DateTime of Showing Time of the Movie chosen by the Movie Goer
      Returns:
      the calculated price of the Movie Ticket
    • generateTransactionId

      public static 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)
      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

      public static Payment getPaymentByUUID(String paymentUUID)
      Method to obtain a Payment by its UUID
      Parameters:
      paymentUUID - is the target Payment's UUID
      Returns:
      the target Payment
    • calculateHolidayWeekendPrice

      public static double calculateHolidayWeekendPrice(DateTime showingTime)
      Method to calculate the Price Weight when the day is a special day ie. Weekends or Holidays
      Parameters:
      showingTime - is the DateTime of the Showing Time of the Movie chosen by the Movie Goer
      Returns:
      the Price Weight of Special Day (Weekend or Holiday)