Class PhoneNumberBillPaymentMethod

java.lang.Object
com.prog3.ipt.Model.PaymentMethodClasses.PhoneNumberBillPaymentMethod
All Implemented Interfaces:
PaymentMethodStrategy

public class PhoneNumberBillPaymentMethod extends Object implements PaymentMethodStrategy
PhoneNumberBillPaymentMethod is a concrete class that implements PaymentMethodStrategy interface. This class represents a phone number bill payment
  • Field Details

    • phoneNumber

      private String phoneNumber
  • Constructor Details

    • PhoneNumberBillPaymentMethod

      public PhoneNumberBillPaymentMethod(String phoneNumber)
      PhoneNumberBillPaymentMethod constructor
      Parameters:
      phoneNumber - Phone number associated with phoneNumber bill payment
  • Method Details

    • setPhoneNumber

      private void setPhoneNumber(String phoneNumber)
    • getPhoneNumber

      public String getPhoneNumber()
    • pay

      public boolean pay(double paymentAmount)
      Makes the payment by the user
      Specified by:
      pay in interface PaymentMethodStrategy
      Parameters:
      paymentAmount - Total amount to be paid by the user
      Returns:
      true if transaction was successful, otherwise false
    • checkPaymentMethodData

      public boolean checkPaymentMethodData()
      Checks that the data entered by the user for the payment have been made successfully
      Specified by:
      checkPaymentMethodData in interface PaymentMethodStrategy
      Returns:
      True if data are valid, otherwise false
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object