Class PaymentService

java.lang.Object
com.example.vehicletaxsystem.services.PaymentService

@Service public class PaymentService extends Object
Service class to handle the logic for payment queries.
  • Field Details

    • logger

      private final org.slf4j.Logger logger
    • taxPaymentRepository

      private final TaxPaymentRepository taxPaymentRepository
    • vehicleRepository

      private final VehicleRepository vehicleRepository
  • Constructor Details

  • Method Details

    • convertToTaxPaymentDTO

      private TaxPaymentDTO convertToTaxPaymentDTO(TaxPayment taxPayment)
    • convertToPayment

      private TaxPayment convertToPayment(TaxPaymentDTO taxPaymentDTO)
    • getAllTaxPaymentDTO

      public List<TaxPaymentDTO> getAllTaxPaymentDTO()
    • getTaxPaymentDTOByID

      public TaxPaymentDTO getTaxPaymentDTOByID(int id)
    • addTaxPayment

      public TaxPaymentDTO addTaxPayment(TaxPaymentDTO taxPaymentDTO)
      If one of the saves fail, the method rolls back (e.g. if the tax payment can't be saved, then the update to the vehicle tax due date wont be saved either)
    • calculateNewTaxDueDate

      private LocalDate calculateNewTaxDueDate(String paymentCategory)
      Helper method to increment tax due dates based on current date
      Reads the payment date from within the taxpaymentDTO parameterised object
      Parameters:
      paymentCategory - string value indicating the type of payment made e.g. monthly direct debit - see final string fields in class.
      Returns:
      date stamp x months forward from the date on which this method is called