adamsaghy commented on code in PR #4235:
URL: https://github.com/apache/fineract/pull/4235#discussion_r1899460157
##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/interestpauses/service/InterestPauseWritePlatformServiceImpl.java:
##########
@@ -68,6 +69,38 @@ public CommandProcessingResult createInterestPause(Long
loanId, String startDate
locale);
}
+ @Override
+ public CommandProcessingResult deleteInterestPause(Long loanId, Long
variationId) {
+ LoanTermVariations variation =
loanTermVariationsRepository.findByIdAndLoanId(variationId, loanId).orElseThrow(
+ () -> new
GeneralPlatformDomainRuleException("error.msg.variation.not.found", "Variation
not found for the given loan ID"));
+
+ loanTermVariationsRepository.delete(variation);
+
+ return new
CommandProcessingResultBuilder().withEntityId(variationId).build();
+ }
+
+ @Override
+ public CommandProcessingResult updateInterestPause(Long loanId, Long
variationId, String startDateString, String endDateString,
+ String dateFormat, String locale) {
+ Loan loan = loanRepositoryWrapper.findOneWithNotFoundDetection(loanId);
+
+ LocalDate startDate = parseDate(startDateString, dateFormat, locale);
+ LocalDate endDate = parseDate(endDateString, dateFormat, locale);
+
+ validateInterestPauseDates(loan, startDate, endDate, dateFormat,
locale);
+
+ LoanTermVariations variation =
loanTermVariationsRepository.findByIdAndLoanId(variationId, loanId).orElseThrow(
+ () -> new
GeneralPlatformDomainRuleException("error.msg.variation.not.found", "Variation
not found for the given loan ID"));
+
+ variation.setTermApplicableFrom(startDate);
+ variation.setDateValue(endDate);
+
+ LoanTermVariations updatedVariation =
loanTermVariationsRepository.saveAndFlush(variation);
Review Comment:
Immediate save and flush is not needed...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]