MIFOSX-1421 : corrected loan charges
This commit is contained in:
+1
@@ -2387,6 +2387,7 @@ public class Loan extends AbstractPersistable<Long> {
|
||||
&& (!reprocess || !this.repaymentScheduleDetail().isInterestRecalculationEnabled())) {
|
||||
loanRepaymentScheduleTransactionProcessor.handleTransaction(loanTransaction, getCurrency(), this.repaymentScheduleInstallments,
|
||||
charges());
|
||||
reprocess = false;
|
||||
if (this.repaymentScheduleDetail().isInterestRecalculationEnabled()) {
|
||||
if (currentInstallment == null || currentInstallment.isNotFullyPaidOff()) {
|
||||
reprocess = true;
|
||||
|
||||
+2
-3
@@ -698,7 +698,7 @@ public class LoanCharge extends AbstractPersistable<Long> {
|
||||
amountPaidToDate = amountPaidToDate.plus(amountOutstanding);
|
||||
this.amountPaid = amountPaidToDate.getAmount();
|
||||
this.amountOutstanding = BigDecimal.ZERO;
|
||||
Money waivedAmount = Money.of(processAmount.getCurrency(), this.amountWaived);
|
||||
Money waivedAmount = getAmountWaived(processAmount.getCurrency());
|
||||
if (waivedAmount.isGreaterThanZero()) {
|
||||
this.waived = true;
|
||||
} else {
|
||||
@@ -868,13 +868,12 @@ public class LoanCharge extends AbstractPersistable<Long> {
|
||||
this.paid = false;
|
||||
this.waived = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Money waivedAmount = Money.of(currency, this.amountWaived);
|
||||
if (waivedAmount.isGreaterThanZero()) {
|
||||
|
||||
if (waivedAmount.isGreaterThan(this.getAmount(currency))) {
|
||||
this.amountWaived = this.getAmount(currency).getAmount();
|
||||
this.amountOutstanding = BigDecimal.ZERO;
|
||||
|
||||
+6
-5
@@ -174,7 +174,8 @@ public class LoanInstallmentCharge extends AbstractPersistable<Long> {
|
||||
}
|
||||
this.amountThroughChargePayment = amountFromChargePayment.getAmount();
|
||||
if (determineIfFullyPaid()) {
|
||||
if (this.amountWaived.compareTo(BigDecimal.ZERO) == 1) {
|
||||
Money waivedAmount = getAmountWaived(incrementBy.getCurrency());
|
||||
if (waivedAmount.isGreaterThanZero()) {
|
||||
this.waived = true;
|
||||
} else {
|
||||
this.paid = true;
|
||||
@@ -208,14 +209,14 @@ public class LoanInstallmentCharge extends AbstractPersistable<Long> {
|
||||
}
|
||||
|
||||
public Money updateWaivedAmount(final MonetaryCurrency currency) {
|
||||
if (this.amountWaived.compareTo(BigDecimal.ZERO) == 1) {
|
||||
int comparedValue = this.amountWaived.compareTo(this.getAmount());
|
||||
if (comparedValue == 1) {
|
||||
Money waivedAmount = getAmountWaived(currency);
|
||||
if (waivedAmount.isGreaterThanZero()) {
|
||||
if (waivedAmount.isGreaterThan(this.getAmount(currency))) {
|
||||
this.amountWaived = this.getAmount();
|
||||
this.amountOutstanding = BigDecimal.ZERO;
|
||||
this.paid = false;
|
||||
this.waived = true;
|
||||
} else if (comparedValue == -1) {
|
||||
} else if (waivedAmount.isLessThan(this.getAmount(currency))) {
|
||||
this.paid = false;
|
||||
this.waived = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user