Merge pull request #1312 from pramodn02/develop
MIFOSX-1884 : corrected test cases
This commit is contained in:
+15
-24
@@ -3206,7 +3206,7 @@ public class ClientLoanIntegrationTest {
|
|||||||
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2482.76", "46.15", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2482.76", "46.15", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2505.67", "23.24", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2505.67", "23.24", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2517.24", "11.67", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2528.81", "11.67", "0.0", "0.0");
|
||||||
|
|
||||||
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
||||||
|
|
||||||
@@ -3300,7 +3300,7 @@ public class ClientLoanIntegrationTest {
|
|||||||
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "4.62", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "4.62", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2482.76", "46.15", "4.62", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2482.76", "46.15", "4.62", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2505.67", "23.24", "2.32", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2505.67", "23.24", "2.32", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2517.24", "11.67", "1.17", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2528.81", "11.67", "1.17", "0.0");
|
||||||
|
|
||||||
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
||||||
|
|
||||||
@@ -3391,8 +3391,7 @@ public class ClientLoanIntegrationTest {
|
|||||||
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2482.54", "46.37", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2482.54", "46.37", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2505.67", "23.24", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2505.67", "23.24", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2517.24", "11.67", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2529.03", "11.67", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "11.79", "0.05", "0.0", "0.0");
|
|
||||||
|
|
||||||
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
||||||
|
|
||||||
@@ -3401,8 +3400,7 @@ public class ClientLoanIntegrationTest {
|
|||||||
todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 0, "4965.3", "92.52", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 0, "4965.3", "92.52", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2505.67", "23.24", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2505.67", "23.24", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2517.24", "11.67", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2529.03", "11.67", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "11.79", "0.05", "0.0", "0.0");
|
|
||||||
|
|
||||||
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues, 0);
|
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues, 0);
|
||||||
|
|
||||||
@@ -3499,8 +3497,7 @@ public class ClientLoanIntegrationTest {
|
|||||||
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "100.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "100.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2486.04", "42.87", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2486.04", "42.87", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2497.5", "31.41", "200", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2497.5", "31.41", "200", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2508.98", "19.93", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2533.7", "19.93", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "24.72", "8.38", "0.0", "0.0");
|
|
||||||
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
||||||
|
|
||||||
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
|
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
|
||||||
@@ -3518,8 +3515,7 @@ public class ClientLoanIntegrationTest {
|
|||||||
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "100.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "100.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2482.57", "46.34", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2482.57", "46.34", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2497.49", "31.42", "200", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2497.49", "31.42", "200", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2508.96", "19.95", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2537.18", "19.95", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "28.22", "8.4", "0.0", "0.0");
|
|
||||||
|
|
||||||
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
||||||
|
|
||||||
@@ -3535,8 +3531,7 @@ public class ClientLoanIntegrationTest {
|
|||||||
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "100.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "100.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2486.04", "42.87", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2486.04", "42.87", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2497.5", "31.41", "200", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2497.5", "31.41", "200", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2508.98", "19.93", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2533.7", "19.93", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "24.72", "8.38", "0.0", "0.0");
|
|
||||||
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
||||||
|
|
||||||
Float earlyPayment = new Float("5100");
|
Float earlyPayment = new Float("5100");
|
||||||
@@ -3551,8 +3546,7 @@ public class ClientLoanIntegrationTest {
|
|||||||
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "100.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "100.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "5057.13", "42.87", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "5057.13", "42.87", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "0", "19.55", "200", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "0", "19.55", "200", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2349.13", "11.35", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2460.11", "11.35", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "110.98", "8.26", "0.0", "0.0");
|
|
||||||
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
||||||
|
|
||||||
HashMap prepayDetail = this.loanTransactionHelper.getPrepayAmount(this.requestSpec, this.responseSpec, loanID);
|
HashMap prepayDetail = this.loanTransactionHelper.getPrepayAmount(this.requestSpec, this.responseSpec, loanID);
|
||||||
@@ -3625,8 +3619,7 @@ public class ClientLoanIntegrationTest {
|
|||||||
addRepaymentValues(expectedvalues, todaysDate, -2, "2482.76", "46.15", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, -2, "2482.76", "46.15", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2482.54", "46.37", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2482.54", "46.37", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2482.33", "46.58", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2482.33", "46.58", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2517.13", "11.78", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2552.37", "11.78", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "35.24", "0.16", "0.0", "0.0");
|
|
||||||
|
|
||||||
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
||||||
|
|
||||||
@@ -3639,7 +3632,7 @@ public class ClientLoanIntegrationTest {
|
|||||||
addRepaymentValues(expectedvalues, todaysDate, -2, "2482.76", "46.15", "0.0", "252.89");
|
addRepaymentValues(expectedvalues, todaysDate, -2, "2482.76", "46.15", "0.0", "252.89");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2481.38", "47.53", "0.0", "252.89");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2481.38", "47.53", "0.0", "252.89");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2479.99", "48.92", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2479.99", "48.92", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2517.11", "11.8", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2555.87", "11.8", "0.0", "0.0");
|
||||||
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
||||||
|
|
||||||
Calendar repaymentDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
Calendar repaymentDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
||||||
@@ -3655,7 +3648,7 @@ public class ClientLoanIntegrationTest {
|
|||||||
addRepaymentValues(expectedvalues, todaysDate, -2, "2482.76", "46.15", "0.0", "252.89");
|
addRepaymentValues(expectedvalues, todaysDate, -2, "2482.76", "46.15", "0.0", "252.89");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2493.05", "35.86", "0.0", "252.89");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2493.05", "35.86", "0.0", "252.89");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2491.72", "37.19", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2491.72", "37.19", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2517.22", "11.69", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2532.47", "11.69", "0.0", "0.0");
|
||||||
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
||||||
|
|
||||||
repaymentDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
repaymentDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
||||||
@@ -3670,7 +3663,7 @@ public class ClientLoanIntegrationTest {
|
|||||||
addRepaymentValues(expectedvalues, todaysDate, -2, "2482.76", "46.15", "0.0", "252.89");
|
addRepaymentValues(expectedvalues, todaysDate, -2, "2482.76", "46.15", "0.0", "252.89");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2493.05", "35.86", "0.0", "252.89");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2493.05", "35.86", "0.0", "252.89");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2491.72", "37.19", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2491.72", "37.19", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2517.22", "11.69", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2532.47", "11.69", "0.0", "0.0");
|
||||||
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3731,7 +3724,7 @@ public class ClientLoanIntegrationTest {
|
|||||||
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2482.76", "46.15", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2482.76", "46.15", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2505.67", "23.24", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2505.67", "23.24", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2517.24", "11.67", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2528.81", "11.67", "0.0", "0.0");
|
||||||
|
|
||||||
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
||||||
|
|
||||||
@@ -3824,8 +3817,7 @@ public class ClientLoanIntegrationTest {
|
|||||||
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2482.54", "46.37", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2482.54", "46.37", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2505.67", "23.24", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2505.67", "23.24", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2517.24", "11.67", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2529.03", "11.67", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "11.79", "0.05", "0.0", "0.0");
|
|
||||||
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
||||||
|
|
||||||
todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
||||||
@@ -3902,8 +3894,7 @@ public class ClientLoanIntegrationTest {
|
|||||||
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, -1, "2482.76", "46.15", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2482.54", "46.37", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2482.54", "46.37", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2505.67", "23.24", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2505.67", "23.24", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "2517.24", "11.67", "0.0", "0.0");
|
addRepaymentValues(expectedvalues, todaysDate, 1, "2529.03", "11.67", "0.0", "0.0");
|
||||||
addRepaymentValues(expectedvalues, todaysDate, 1, "11.79", "0.05", "0.0", "0.0");
|
|
||||||
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
verifyLoanRepaymentSchedule(loanSchedule, expectedvalues);
|
||||||
|
|
||||||
todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
|
||||||
|
|||||||
+8
-7
@@ -226,9 +226,10 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
|
|||||||
// date
|
// date
|
||||||
PrincipalInterest principalInterestForThisPeriod = calculatePrincipalInterestComponentsForPeriod(
|
PrincipalInterest principalInterestForThisPeriod = calculatePrincipalInterestComponentsForPeriod(
|
||||||
this.paymentPeriodsInOneYearCalculator, interestCalculationGraceOnRepaymentPeriodFraction,
|
this.paymentPeriodsInOneYearCalculator, interestCalculationGraceOnRepaymentPeriodFraction,
|
||||||
totalCumulativePrincipal, totalCumulativeInterest, totalInterestChargedForFullLoanTerm,
|
totalCumulativePrincipal.minus(reducePrincipal), totalCumulativeInterest,
|
||||||
totalOutstandingInterestPaymentDueToGrace, outstandingBalanceAsPerRest, loanApplicationTerms,
|
totalInterestChargedForFullLoanTerm, totalOutstandingInterestPaymentDueToGrace,
|
||||||
periodNumber, mc, mergeLateAndPaymentMaps(principalPortionMap, latePaymentMap, disburseDetailMap),
|
outstandingBalanceAsPerRest, loanApplicationTerms, periodNumber, mc,
|
||||||
|
mergeLateAndPaymentMaps(principalPortionMap, latePaymentMap, disburseDetailMap),
|
||||||
periodStartDateApplicableForInterest, detail.getTransactionDate(),
|
periodStartDateApplicableForInterest, detail.getTransactionDate(),
|
||||||
daysInPeriodApplicableForInterest);
|
daysInPeriodApplicableForInterest);
|
||||||
interestForThisinstallment = principalInterestForThisPeriod.interest();
|
interestForThisinstallment = principalInterestForThisPeriod.interest();
|
||||||
@@ -331,9 +332,9 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
|
|||||||
|
|
||||||
// 5 determine principal,interest of repayment period
|
// 5 determine principal,interest of repayment period
|
||||||
PrincipalInterest principalInterestForThisPeriod = calculatePrincipalInterestComponentsForPeriod(
|
PrincipalInterest principalInterestForThisPeriod = calculatePrincipalInterestComponentsForPeriod(
|
||||||
this.paymentPeriodsInOneYearCalculator, interestCalculationGraceOnRepaymentPeriodFraction, totalCumulativePrincipal,
|
this.paymentPeriodsInOneYearCalculator, interestCalculationGraceOnRepaymentPeriodFraction,
|
||||||
totalCumulativeInterest, totalInterestChargedForFullLoanTerm, totalOutstandingInterestPaymentDueToGrace,
|
totalCumulativePrincipal.minus(reducePrincipal), totalCumulativeInterest, totalInterestChargedForFullLoanTerm,
|
||||||
outstandingBalanceAsPerRest, loanApplicationTerms, periodNumber, mc,
|
totalOutstandingInterestPaymentDueToGrace, outstandingBalanceAsPerRest, loanApplicationTerms, periodNumber, mc,
|
||||||
mergeLateAndPaymentMaps(principalPortionMap, latePaymentMap, disburseDetailMap), periodStartDateApplicableForInterest,
|
mergeLateAndPaymentMaps(principalPortionMap, latePaymentMap, disburseDetailMap), periodStartDateApplicableForInterest,
|
||||||
scheduledDueDate, daysInPeriodApplicableForInterest);
|
scheduledDueDate, daysInPeriodApplicableForInterest);
|
||||||
|
|
||||||
@@ -350,7 +351,7 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
|
|||||||
totalOutstandingInterestPaymentDueToGrace = principalInterestForThisPeriod.interestPaymentDueToGrace();
|
totalOutstandingInterestPaymentDueToGrace = principalInterestForThisPeriod.interestPaymentDueToGrace();
|
||||||
Money principalForThisPeriod = principalInterestForThisPeriod.principal();
|
Money principalForThisPeriod = principalInterestForThisPeriod.principal();
|
||||||
|
|
||||||
if(principalForThisPeriod.isZero()){
|
if (principalForThisPeriod.isZero()) {
|
||||||
loanApplicationTerms.resetFixedEmiAmount();
|
loanApplicationTerms.resetFixedEmiAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+25
-19
@@ -54,27 +54,27 @@ public class DecliningBalanceInterestLoanScheduleGenerator extends AbstractLoanS
|
|||||||
Money balanceForInterestCalculation = outstandingBalance;
|
Money balanceForInterestCalculation = outstandingBalance;
|
||||||
Money cumulatingInterestDueToGrace = cumulatingInterestPaymentDueToGrace;
|
Money cumulatingInterestDueToGrace = cumulatingInterestPaymentDueToGrace;
|
||||||
final int daysInPeriodApplicableForInterest = Days.daysBetween(periodStartDate, periodEndDate).getDays();
|
final int daysInPeriodApplicableForInterest = Days.daysBetween(periodStartDate, periodEndDate).getDays();
|
||||||
if(principalVariation != null){
|
if (principalVariation != null) {
|
||||||
for (Map.Entry<LocalDate, Money> principal : principalVariation.entrySet()) {
|
for (Map.Entry<LocalDate, Money> principal : principalVariation.entrySet()) {
|
||||||
if (!principal.getKey().isAfter(periodEndDate)) {
|
if (!principal.getKey().isAfter(periodEndDate)) {
|
||||||
int interestForDays = Days.daysBetween(interestStartDate, principal.getKey()).getDays();
|
int interestForDays = Days.daysBetween(interestStartDate, principal.getKey()).getDays();
|
||||||
if (interestForDays > 0) {
|
if (interestForDays > 0) {
|
||||||
final PrincipalInterest result = loanApplicationTerms.calculateTotalInterestForPeriod(calculator,
|
final PrincipalInterest result = loanApplicationTerms.calculateTotalInterestForPeriod(calculator,
|
||||||
interestCalculationGraceOnRepaymentPeriodFraction, periodNumber, mc, cumulatingInterestDueToGrace,
|
interestCalculationGraceOnRepaymentPeriodFraction, periodNumber, mc, cumulatingInterestDueToGrace,
|
||||||
interestForDays, balanceForInterestCalculation);
|
interestForDays, balanceForInterestCalculation);
|
||||||
if (loanApplicationTerms.getInterestCalculationPeriodMethod().isDaily()) {
|
if (loanApplicationTerms.getInterestCalculationPeriodMethod().isDaily()) {
|
||||||
interestForThisInstallment = interestForThisInstallment.plus(result.interest());
|
interestForThisInstallment = interestForThisInstallment.plus(result.interest());
|
||||||
} else {
|
} else {
|
||||||
interestForThisInstallment = interestForThisInstallment.plus(calculateInterestForDays(daysForInterestInFullPeriod,
|
interestForThisInstallment = interestForThisInstallment.plus(calculateInterestForDays(
|
||||||
result.interest().getAmount(), interestForDays));
|
daysForInterestInFullPeriod, result.interest().getAmount(), interestForDays));
|
||||||
|
}
|
||||||
|
cumulatingInterestDueToGrace = result.interestPaymentDueToGrace();
|
||||||
|
interestStartDate = principal.getKey();
|
||||||
}
|
}
|
||||||
cumulatingInterestDueToGrace = result.interestPaymentDueToGrace();
|
balanceForInterestCalculation = balanceForInterestCalculation.plus(principal.getValue());
|
||||||
interestStartDate = principal.getKey();
|
|
||||||
}
|
}
|
||||||
balanceForInterestCalculation = balanceForInterestCalculation.plus(principal.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int interestForDays = Days.daysBetween(interestStartDate, periodEndDate).getDays();
|
int interestForDays = Days.daysBetween(interestStartDate, periodEndDate).getDays();
|
||||||
|
|
||||||
@@ -88,8 +88,14 @@ public class DecliningBalanceInterestLoanScheduleGenerator extends AbstractLoanS
|
|||||||
.interest().getAmount(), interestForDays));
|
.interest().getAmount(), interestForDays));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Money interestForPeriod = interestForThisInstallment;
|
||||||
|
if (interestForPeriod.isGreaterThanZero()) {
|
||||||
|
interestForPeriod = interestForPeriod.minus(cumulatingInterestPaymentDueToGrace);
|
||||||
|
}else{
|
||||||
|
interestForPeriod = result.interestPaymentDueToGrace().minus(cumulatingInterestPaymentDueToGrace);
|
||||||
|
}
|
||||||
Money principalForThisInstallment = loanApplicationTerms.calculateTotalPrincipalForPeriod(calculator,
|
Money principalForThisInstallment = loanApplicationTerms.calculateTotalPrincipalForPeriod(calculator,
|
||||||
daysInPeriodApplicableForInterest, outstandingBalance, periodNumber, mc);
|
daysInPeriodApplicableForInterest, outstandingBalance, periodNumber, mc, interestForPeriod);
|
||||||
|
|
||||||
// update cumulative fields for principal & interest
|
// update cumulative fields for principal & interest
|
||||||
final Money interestBroughtFowardDueToGrace = result.interestPaymentDueToGrace();
|
final Money interestBroughtFowardDueToGrace = result.interestPaymentDueToGrace();
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ public class FlatInterestLoanScheduleGenerator extends AbstractLoanScheduleGener
|
|||||||
@SuppressWarnings("unused") int daysForInterestInFullPeriod) {
|
@SuppressWarnings("unused") int daysForInterestInFullPeriod) {
|
||||||
final int daysInPeriodApplicableForInterest = Days.daysBetween(periodStartDate, periodEndDate).getDays();
|
final int daysInPeriodApplicableForInterest = Days.daysBetween(periodStartDate, periodEndDate).getDays();
|
||||||
Money principalForThisInstallment = loanApplicationTerms.calculateTotalPrincipalForPeriod(calculator,
|
Money principalForThisInstallment = loanApplicationTerms.calculateTotalPrincipalForPeriod(calculator,
|
||||||
daysInPeriodApplicableForInterest, outstandingBalance, periodNumber, mc);
|
daysInPeriodApplicableForInterest, outstandingBalance, periodNumber, mc, null);
|
||||||
|
|
||||||
final PrincipalInterest result = loanApplicationTerms.calculateTotalInterestForPeriod(calculator,
|
final PrincipalInterest result = loanApplicationTerms.calculateTotalInterestForPeriod(calculator,
|
||||||
interestCalculationGraceOnRepaymentPeriodFraction, periodNumber, mc, cumulatingInterestPaymentDueToGrace,
|
interestCalculationGraceOnRepaymentPeriodFraction, periodNumber, mc, cumulatingInterestPaymentDueToGrace,
|
||||||
|
|||||||
+5
-9
@@ -422,7 +422,7 @@ public final class LoanApplicationTerms {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Money calculateTotalPrincipalForPeriod(final PaymentPeriodsInOneYearCalculator calculator, final int daysInPeriod,
|
public Money calculateTotalPrincipalForPeriod(final PaymentPeriodsInOneYearCalculator calculator, final int daysInPeriod,
|
||||||
final Money outstandingBalance, final int periodNumber, final MathContext mc) {
|
final Money outstandingBalance, final int periodNumber, final MathContext mc, Money interestForThisInstallment) {
|
||||||
|
|
||||||
Money principalForInstallment = this.principal.zero();
|
Money principalForInstallment = this.principal.zero();
|
||||||
|
|
||||||
@@ -444,8 +444,8 @@ public final class LoanApplicationTerms {
|
|||||||
DaysInMonthType.DAYS_30, DaysInYearType.DAYS_365);
|
DaysInMonthType.DAYS_30, DaysInYearType.DAYS_365);
|
||||||
Money totalPmtForThisInstallment = calculateTotalDueForEqualInstallmentRepaymentPeriod(
|
Money totalPmtForThisInstallment = calculateTotalDueForEqualInstallmentRepaymentPeriod(
|
||||||
periodicInterestRateForRepaymentPeriod, outstandingBalance, periodsElapsed);
|
periodicInterestRateForRepaymentPeriod, outstandingBalance, periodsElapsed);
|
||||||
principalForInstallment = calculatePrincipalDueForInstallment(calculator, mc, periodNumber,
|
principalForInstallment = calculatePrincipalDueForInstallment(periodNumber, totalPmtForThisInstallment,
|
||||||
totalPmtForThisInstallment, daysInPeriod, outstandingBalance);
|
interestForThisInstallment);
|
||||||
break;
|
break;
|
||||||
case EQUAL_PRINCIPAL:
|
case EQUAL_PRINCIPAL:
|
||||||
principalForInstallment = calculateEqualPrincipalDueForInstallment(mc, periodNumber);
|
principalForInstallment = calculateEqualPrincipalDueForInstallment(mc, periodNumber);
|
||||||
@@ -882,13 +882,9 @@ public final class LoanApplicationTerms {
|
|||||||
return principal;
|
return principal;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Money calculatePrincipalDueForInstallment(final PaymentPeriodsInOneYearCalculator calculator, final MathContext mc,
|
private Money calculatePrincipalDueForInstallment(final int periodNumber, final Money totalDuePerInstallment, final Money periodInterest) {
|
||||||
final int periodNumber, final Money totalDuePerInstallment, final int daysInPeriod, final Money outstandingBalance) {
|
|
||||||
|
|
||||||
final Money interestForThisInstallmentBeforeGrace = calculateDecliningInterestDueForInstallmentBeforeApplyingGrace(calculator, mc,
|
Money principal = totalDuePerInstallment.minus(periodInterest);
|
||||||
daysInPeriod, outstandingBalance);
|
|
||||||
|
|
||||||
Money principal = totalDuePerInstallment.minus(interestForThisInstallmentBeforeGrace);
|
|
||||||
if (isPrincipalGraceApplicableForThisPeriod(periodNumber)) {
|
if (isPrincipalGraceApplicableForThisPeriod(periodNumber)) {
|
||||||
principal = principal.zero();
|
principal = principal.zero();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user