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