Merge pull request #1108 from pramodn02/develop
MIFOSX-1595 : corrected interest posting if run 2 times in a period
This commit is contained in:
+28
@@ -768,11 +768,19 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
|
|
||||||
final float FEE_PORTION = 50.0f;
|
final float FEE_PORTION = 50.0f;
|
||||||
final float PENALTY_PORTION = 100.0f;
|
final float PENALTY_PORTION = 100.0f;
|
||||||
|
final float NEXT_FEE_PORTION = 55.0f;
|
||||||
|
final float NEXT_PENALTY_PORTION = 105.0f;
|
||||||
|
|
||||||
Integer flat = ChargesHelper.createCharges(requestSpec, responseSpec,
|
Integer flat = ChargesHelper.createCharges(requestSpec, responseSpec,
|
||||||
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(FEE_PORTION), false));
|
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(FEE_PORTION), false));
|
||||||
Integer flatSpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
|
Integer flatSpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
|
||||||
ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(PENALTY_PORTION), true));
|
ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(PENALTY_PORTION), true));
|
||||||
|
|
||||||
|
Integer flatNext = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
|
||||||
|
ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(NEXT_FEE_PORTION), false));
|
||||||
|
Integer flatSpecifiedDueDateNext = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
|
||||||
|
.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(NEXT_PENALTY_PORTION), true));
|
||||||
|
|
||||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||||
|
|
||||||
@@ -804,12 +812,24 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
dateFormat.format(todayDate.getTime()), String.valueOf(PENALTY_PORTION)));
|
dateFormat.format(todayDate.getTime()), String.valueOf(PENALTY_PORTION)));
|
||||||
todayDate.add(Calendar.DATE, 1);
|
todayDate.add(Calendar.DATE, 1);
|
||||||
String runOndate = dateFormat.format(todayDate.getTime());
|
String runOndate = dateFormat.format(todayDate.getTime());
|
||||||
|
|
||||||
this.loanTransactionHelper
|
this.loanTransactionHelper
|
||||||
.addChargesForLoan(
|
.addChargesForLoan(
|
||||||
loanID,
|
loanID,
|
||||||
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flat), runOndate,
|
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flat), runOndate,
|
||||||
String.valueOf(FEE_PORTION)));
|
String.valueOf(FEE_PORTION)));
|
||||||
|
|
||||||
|
todayDate.add(Calendar.DATE, 1);
|
||||||
|
this.loanTransactionHelper.addChargesForLoan(
|
||||||
|
loanID,
|
||||||
|
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatSpecifiedDueDateNext),
|
||||||
|
dateFormat.format(todayDate.getTime()), String.valueOf(NEXT_PENALTY_PORTION)));
|
||||||
|
|
||||||
|
this.loanTransactionHelper.addChargesForLoan(
|
||||||
|
loanID,
|
||||||
|
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatNext),
|
||||||
|
dateFormat.format(todayDate.getTime()), String.valueOf(NEXT_FEE_PORTION)));
|
||||||
|
|
||||||
// CHECK ACCOUNT ENTRIES
|
// CHECK ACCOUNT ENTRIES
|
||||||
System.out.println("Entries ......");
|
System.out.println("Entries ......");
|
||||||
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
||||||
@@ -844,6 +864,14 @@ public class AccountingScenarioIntegrationTest {
|
|||||||
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(runOndate), INTEREST_3_DAYS, FEE_PORTION,
|
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(runOndate), INTEREST_3_DAYS, FEE_PORTION,
|
||||||
PENALTY_PORTION, loanID);
|
PENALTY_PORTION, loanID);
|
||||||
|
|
||||||
|
runOndate = dateFormat.format(todayDate.getTime());
|
||||||
|
|
||||||
|
this.periodicAccrualAccountingHelper.runPeriodicAccrualAccounting(runOndate);
|
||||||
|
float interestPerDay = totalInterest / totalDaysInPeriod;
|
||||||
|
interestPerDay = new Float(numberFormat.format(interestPerDay));
|
||||||
|
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(runOndate), interestPerDay, NEXT_FEE_PORTION,
|
||||||
|
NEXT_PENALTY_PORTION, loanID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer createLoanProductWithPeriodicAccrualAccountingEnabled(final Account... accounts) {
|
private Integer createLoanProductWithPeriodicAccrualAccountingEnabled(final Account... accounts) {
|
||||||
|
|||||||
-1
@@ -222,7 +222,6 @@ public class LoanAccrualWritePlatformServiceImpl implements LoanAccrualWritePlat
|
|||||||
if (totalAccInterest == null) {
|
if (totalAccInterest == null) {
|
||||||
totalAccInterest = BigDecimal.ZERO;
|
totalAccInterest = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
interestportion = interestportion.subtract(totalAccInterest);
|
|
||||||
amount = amount.add(interestportion);
|
amount = amount.add(interestportion);
|
||||||
totalAccInterest = totalAccInterest.add(interestportion);
|
totalAccInterest = totalAccInterest.add(interestportion);
|
||||||
if (interestportion.compareTo(BigDecimal.ZERO) == 0) {
|
if (interestportion.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user