Class PaymentService
java.lang.Object
com.example.vehicletaxsystem.services.PaymentService
Service class to handle the logic for payment queries.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.slf4j.Loggerprivate final TaxPaymentRepositoryprivate final VehicleRepository -
Constructor Summary
ConstructorsConstructorDescriptionPaymentService(TaxPaymentRepository taxPaymentRepository, VehicleRepository vehicleRepository) -
Method Summary
Modifier and TypeMethodDescriptionaddTaxPayment(TaxPaymentDTO taxPaymentDTO) If one of the saves fail, the method rolls back (e.g.private LocalDatecalculateNewTaxDueDate(String paymentCategory) Helper method to increment tax due dates based on current date
Reads the payment date from within the taxpaymentDTO parameterised objectprivate TaxPaymentconvertToPayment(TaxPaymentDTO taxPaymentDTO) private TaxPaymentDTOconvertToTaxPaymentDTO(TaxPayment taxPayment) getTaxPaymentDTOByID(int id)
-
Field Details
-
logger
private final org.slf4j.Logger logger -
taxPaymentRepository
-
vehicleRepository
-
-
Constructor Details
-
PaymentService
public PaymentService(TaxPaymentRepository taxPaymentRepository, VehicleRepository vehicleRepository)
-
-
Method Details
-
convertToTaxPaymentDTO
-
convertToPayment
-
getAllTaxPaymentDTO
-
getTaxPaymentDTOByID
-
addTaxPayment
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
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
-