Fix: Fee Charge Amount Issue
This commit is contained in:
+5
-1
@@ -223,6 +223,10 @@ public final class LoanRepaymentScheduleInstallment extends AbstractAuditableCus
|
||||
return Money.of(currency, this.principalCompleted);
|
||||
}
|
||||
|
||||
public void updateLoanRepaymentSchedule(final BigDecimal amountWaived) {
|
||||
this.feeChargesWaived = this.feeChargesWaived.subtract(amountWaived);
|
||||
}
|
||||
|
||||
public Money getPrincipalWrittenOff(final MonetaryCurrency currency) {
|
||||
return Money.of(currency, this.principalWrittenOff);
|
||||
}
|
||||
@@ -841,7 +845,7 @@ public final class LoanRepaymentScheduleInstallment extends AbstractAuditableCus
|
||||
}
|
||||
|
||||
public void setFeeChargesWaived(final BigDecimal newFeeChargesCharged) {
|
||||
this.feeChargesCharged = newFeeChargesCharged;
|
||||
this.feeChargesWaived = newFeeChargesCharged;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+12
@@ -166,6 +166,18 @@ public class LoanTransaction extends AbstractPersistableCustom {
|
||||
createdDate, appUser);
|
||||
}
|
||||
|
||||
public void setLoanTransactionToRepaymentScheduleMappings(final Integer installmentId, final BigDecimal chargePerInstallment) {
|
||||
for (LoanTransactionToRepaymentScheduleMapping loanTransactionToRepaymentScheduleMapping : this.loanTransactionToRepaymentScheduleMappings) {
|
||||
final LoanRepaymentScheduleInstallment loanRepaymentScheduleInstallment = loanTransactionToRepaymentScheduleMapping
|
||||
.getLoanRepaymentScheduleInstallment();
|
||||
if (loanRepaymentScheduleInstallment.getInstallmentNumber().equals(installmentId)) {
|
||||
loanRepaymentScheduleInstallment.updateLoanRepaymentSchedule(chargePerInstallment);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static LoanTransaction recoveryRepayment(final Office office, final Money amount, final PaymentDetail paymentDetail,
|
||||
final LocalDate paymentDate, final String externalId, final LocalDateTime createdDate, final AppUser appUser) {
|
||||
return new LoanTransaction(null, office, LoanTransactionType.RECOVERY_REPAYMENT, paymentDetail, amount.getAmount(), paymentDate,
|
||||
|
||||
+16
-3
@@ -1670,15 +1670,15 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
// Reverse waived transaction
|
||||
loanTransaction.setReversed();
|
||||
|
||||
// Get installment amount waived.
|
||||
BigDecimal amountWaived = chargePerInstallment.getAmountWaived(loan.getCurrency()).getAmount();
|
||||
|
||||
// Set manually adjusted value to `1`
|
||||
loanTransaction.setManuallyAdjustedOrReversed();
|
||||
|
||||
// Save updated data
|
||||
this.loanTransactionRepository.saveAndFlush(loanTransaction);
|
||||
|
||||
// Get installment amount waived.
|
||||
BigDecimal amountWaived = chargePerInstallment.getAmountWaived(loan.getCurrency()).getAmount();
|
||||
|
||||
// Get installment outstanding amount
|
||||
BigDecimal amountOutstandingPerInstallment = chargePerInstallment.getAmountOutstanding();
|
||||
|
||||
@@ -1730,6 +1730,19 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
|
||||
loan.updateLoanSummaryForUndoWaiveCharge(amountWaived);
|
||||
|
||||
// Set reschedule installment
|
||||
|
||||
// final List<LoanRepaymentScheduleInstallment> loanRepaymentScheduleInstallments =
|
||||
// loan.getRepaymentScheduleInstallments();
|
||||
// for (LoanRepaymentScheduleInstallment loanRepaymentScheduleInstallment :
|
||||
// loanRepaymentScheduleInstallments) {
|
||||
// if (loanRepaymentScheduleInstallment.getInstallmentNumber().equals(installmentNumber)) {
|
||||
// loanRepaymentScheduleInstallment.updateLoanRepaymentSchedule(amountWaived);
|
||||
// this.repaymentScheduleInstallmentRepository.saveAndFlush(loanRepaymentScheduleInstallment);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
changes.put("amount", amountWaived);
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user