MIFOSX-1162 : removed overdue loan charge on undo disburse

This commit is contained in:
Pramod Nuthakki
2014-05-03 01:07:01 +05:30
parent 78c0761ae5
commit 29478ca023
4 changed files with 15 additions and 3 deletions
@@ -46,6 +46,7 @@ public class AccountTransferTest {
public static final String TO_SAVINGS_ACCOUNT_TYPE = "2";
public static final String LOAN_APPROVAL_DATE = "01 March 2013";
public static final String LOAN_APPROVAL_DATE_PLUS_ONE = "02 March 2013";
public static final String LOAN_DISBURSAL_DATE = "01 March 2013";
private ResponseSpecification responseSpec;
@@ -651,7 +651,7 @@ public class SchedulerJobsTestResults {
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE, loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(AccountTransferTest.LOAN_DISBURSAL_DATE, loanID);
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(AccountTransferTest.LOAN_APPROVAL_DATE_PLUS_ONE, loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
ArrayList<HashMap> repaymentScheduleDataBefore = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
@@ -669,6 +669,10 @@ public class SchedulerJobsTestResults {
Assert.assertEquals("Verifying From Penalty Charges due fot first Repayment after Successful completion of Scheduler Job",
chargeAmount, (Float) repaymentScheduleDataAfter.get(1).get("penaltyChargesDue"));
loanStatusHashMap = this.loanTransactionHelper.undoDisbursal(loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
}
@@ -2118,7 +2118,11 @@ public class Loan extends AbstractPersistable<Long> {
this.actualDisbursementDate = null;
for (final LoanCharge charge : charges()) {
charge.resetToOriginal(loanCurrency());
if (charge.isOverdueInstallmentCharge()) {
charge.setActive(false);
} else {
charge.resetToOriginal(loanCurrency());
}
}
for (final LoanRepaymentScheduleInstallment currentInstallment : this.repaymentScheduleInstallments) {
@@ -305,7 +305,7 @@ public class LoanCharge extends AbstractPersistable<Long> {
this.paid = false;
this.waived = false;
for (final LoanInstallmentCharge installmentCharge : this.loanInstallmentCharge) {
installmentCharge.resetPaidAmount(currency);
installmentCharge.resetToOriginal(currency);
}
}
@@ -816,6 +816,9 @@ public class LoanCharge extends AbstractPersistable<Long> {
public void setActive(boolean active) {
this.active = active;
if (!active) {
this.overdueInstallmentCharge = null;
}
}
public BigDecimal amountOrPercentage() {