adamsaghy commented on code in PR #4828:
URL: https://github.com/apache/fineract/pull/4828#discussion_r2210154054
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java:
##########
@@ -3009,6 +3014,37 @@ public CommandProcessingResult makeRefund(final Long
loanId, final LoanTransacti
.build();
}
+ @Override
+ public CommandProcessingResult modifyLoanApprovedAmount(final Long loanId,
final JsonCommand command) {
+ // API rule validations
+
this.loanApprovedAmountValidator.validateLoanApprovedAmountModification(command);
+
+ final Map<String, Object> changes = new LinkedHashMap<>();
+ changes.put("newApprovedAmount",
command.stringValueOfParameterNamed(LoanApiConstants.amountParameterName));
+ changes.put("locale", command.locale());
+
+ Loan loan = this.loanAssembler.assembleFrom(loanId);
+ changes.put("oldApprovedAmount", loan.getApprovedPrincipal());
+
+ BigDecimal newApprovedAmount =
command.bigDecimalValueOfParameterNamed(LoanApiConstants.amountParameterName);
+
+ LoanApprovedAmountHistory loanApprovedAmountHistory = new
LoanApprovedAmountHistory(loan, newApprovedAmount,
+ loan.getApprovedPrincipal());
+ loan.setApprovedPrincipal(newApprovedAmount);
+
+ loan = saveAndFlushLoanWithDataIntegrityViolationChecks(loan);
Review Comment:
No need for this, loan entity is already managed.
--
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]