FINERACT-2181: Fix github actions not failing test runs on failed tests
- added validation for cumulative multidisburse loan applications for interest method - test fixes
This commit is contained in:
+1
-1
@@ -7127,7 +7127,7 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest {
|
||||
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal("1000").withLoanTermFrequency("1")
|
||||
.withLoanTermFrequencyAsMonths().withNumberOfRepayments("1").withRepaymentEveryAfter("1")
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("0").withInterestTypeAsFlatBalance()
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("0").withInterestTypeAsDecliningBalance()
|
||||
.withAmortizationTypeAsEqualPrincipalPayments().withInterestCalculationPeriodTypeSameAsRepaymentPeriod()
|
||||
.withExpectedDisbursementDate("03 September 2022").withSubmittedOnDate("01 September 2022").withLoanType("individual")
|
||||
.build(clientID.toString(), loanProductID.toString(), null);
|
||||
|
||||
+7
-7
@@ -120,7 +120,7 @@ public class ExternalBusinessEventTest extends BaseLoanIntegrationTest {
|
||||
|
||||
loanTransactionHelper.makeLoanRepayment("15 March 2023", 125.0F, loanIdRef.get().intValue());
|
||||
|
||||
verifyBusinessEvents(new LoanBusinessEvent("LoanBalanceChangedBusinessEvent", "15 March 2023", 300, 400.0, 291.04));
|
||||
verifyBusinessEvents(new LoanBusinessEvent("LoanBalanceChangedBusinessEvent", "15 March 2023", 300, 400.0, 289.13));
|
||||
});
|
||||
runAt("1 April 2023", () -> {
|
||||
|
||||
@@ -132,7 +132,7 @@ public class ExternalBusinessEventTest extends BaseLoanIntegrationTest {
|
||||
|
||||
loanTransactionHelper.makeLoanRepayment("15 April 2023", 125.0F, loanIdRef.get().intValue());
|
||||
|
||||
verifyBusinessEvents(new LoanBusinessEvent("LoanBalanceChangedBusinessEvent", "15 April 2023", 300, 1000.0, 770.06));
|
||||
verifyBusinessEvents(new LoanBusinessEvent("LoanBalanceChangedBusinessEvent", "15 April 2023", 300, 1000.0, 758.15));
|
||||
|
||||
deleteAllExternalEvents();
|
||||
|
||||
@@ -146,13 +146,13 @@ public class ExternalBusinessEventTest extends BaseLoanIntegrationTest {
|
||||
|
||||
loanTransactionHelper.reverseRepayment(loanIdRef.get().intValue(), transactionId.intValue(), "15 April 2023");
|
||||
|
||||
verifyBusinessEvents(new LoanBusinessEvent("LoanBalanceChangedBusinessEvent", "15 April 2023", 300, 1000.0, 770.06));
|
||||
verifyBusinessEvents(new LoanBusinessEvent("LoanBalanceChangedBusinessEvent", "15 April 2023", 300, 1000.0, 758.15));
|
||||
|
||||
deleteAllExternalEvents();
|
||||
|
||||
loanTransactionHelper.makeLoanRepayment("15 April 2023", 830.22F, loanIdRef.get().intValue());
|
||||
|
||||
verifyBusinessEvents(new LoanBusinessEvent("LoanBalanceChangedBusinessEvent", "15 April 2023", 600, 1000.0, 0.0));
|
||||
verifyBusinessEvents(new LoanBusinessEvent("LoanBalanceChangedBusinessEvent", "15 April 2023", 700, 1000.0, 0.0));
|
||||
|
||||
disableLoanBalanceChangedBusinessEvent();
|
||||
});
|
||||
@@ -915,7 +915,7 @@ public class ExternalBusinessEventTest extends BaseLoanIntegrationTest {
|
||||
|
||||
PutLoansLoanIdRequest modification = new PutLoansLoanIdRequest().clientId(client.getClientId()).productId(loanProductId)
|
||||
.transactionProcessingStrategyCode(DEFAULT_STRATEGY).interestRatePerPeriod(BigDecimal.valueOf(2)).repaymentEvery(1)
|
||||
.principal(550L).amortizationType(1).interestType(1).interestCalculationPeriodType(0)
|
||||
.principal(550L).amortizationType(1).interestType(0).interestCalculationPeriodType(0)
|
||||
.expectedDisbursementDate("1 March 2024").repaymentFrequencyType(2).numberOfRepayments(4).loanTermFrequency(4)
|
||||
.loanTermFrequencyType(2).loanType("individual").dateFormat("dd MMMM yyyy").locale("en_GB");
|
||||
|
||||
@@ -1097,7 +1097,7 @@ public class ExternalBusinessEventTest extends BaseLoanIntegrationTest {
|
||||
String submittedOnDate, String expectedDisburmentDate) {
|
||||
final PostLoansRequest loanRequest = new PostLoansRequest() //
|
||||
.loanTermFrequency(4).locale("en_GB").loanTermFrequencyType(2).numberOfRepayments(4).repaymentFrequencyType(2)
|
||||
.interestRatePerPeriod(BigDecimal.valueOf(2)).repaymentEvery(1).principal(principal).amortizationType(1).interestType(1)
|
||||
.interestRatePerPeriod(BigDecimal.valueOf(2)).repaymentEvery(1).principal(principal).amortizationType(1).interestType(0)
|
||||
.interestCalculationPeriodType(0).dateFormat("dd MMMM yyyy").transactionProcessingStrategyCode(DEFAULT_STRATEGY)
|
||||
.loanType("individual").submittedOnDate(submittedOnDate).expectedDisbursementDate(expectedDisburmentDate).clientId(clientId)
|
||||
.productId(loanProductId);
|
||||
@@ -1110,7 +1110,7 @@ public class ExternalBusinessEventTest extends BaseLoanIntegrationTest {
|
||||
String submittedOnDate, String expectedDisburmentDate) {
|
||||
final PostLoansRequest loanRequest = new PostLoansRequest() //
|
||||
.loanTermFrequency(4).locale("en_GB").loanTermFrequencyType(2).numberOfRepayments(4).repaymentFrequencyType(2)
|
||||
.interestRatePerPeriod(BigDecimal.valueOf(2)).repaymentEvery(1).principal(principal).amortizationType(1).interestType(1)
|
||||
.interestRatePerPeriod(BigDecimal.valueOf(2)).repaymentEvery(1).principal(principal).amortizationType(1).interestType(0)
|
||||
.interestCalculationPeriodType(0).dateFormat("dd MMMM yyyy").transactionProcessingStrategyCode(DEFAULT_STRATEGY)
|
||||
.loanType("individual").submittedOnDate(submittedOnDate).expectedDisbursementDate(expectedDisburmentDate).clientId(clientId)
|
||||
.productId(loanProductId);
|
||||
|
||||
+2
-2
@@ -1091,7 +1091,7 @@ public class ExternalIdSupportIntegrationTest extends BaseLoanIntegrationTest {
|
||||
final String linkAccountId) {
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal("1000").withLoanTermFrequency("1")
|
||||
.withLoanTermFrequencyAsMonths().withNumberOfRepayments("1").withRepaymentEveryAfter("1")
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("0").withInterestTypeAsFlatBalance()
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("0").withInterestTypeAsDecliningBalance()
|
||||
.withAmortizationTypeAsEqualPrincipalPayments().withInterestCalculationPeriodTypeSameAsRepaymentPeriod()
|
||||
.withExpectedDisbursementDate("03 September 2022").withSubmittedOnDate("01 September 2022").withLoanType("individual")
|
||||
.withExternalId(externalId).build(clientID.toString(), loanProductID.toString(), linkAccountId);
|
||||
@@ -1101,7 +1101,7 @@ public class ExternalIdSupportIntegrationTest extends BaseLoanIntegrationTest {
|
||||
private HashMap applyForLoanApplication(final Integer clientID, final Integer loanProductID, final String externalId) {
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal("1000").withLoanTermFrequency("1")
|
||||
.withLoanTermFrequencyAsMonths().withNumberOfRepayments("1").withRepaymentEveryAfter("1")
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("0").withInterestTypeAsFlatBalance()
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("0").withInterestTypeAsDecliningBalance()
|
||||
.withAmortizationTypeAsEqualPrincipalPayments().withInterestCalculationPeriodTypeSameAsRepaymentPeriod()
|
||||
.withExpectedDisbursementDate("03 September 2022").withSubmittedOnDate("01 September 2022").withLoanType("individual")
|
||||
.withInArrearsTolerance("1001").withExternalId(externalId).build(clientID.toString(), loanProductID.toString(), null);
|
||||
|
||||
+1
-1
@@ -1141,7 +1141,7 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes
|
||||
|
||||
String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal("1000").withLoanTermFrequency("3")
|
||||
.withLoanTermFrequencyAsMonths().withNumberOfRepayments("3").withRepaymentEveryAfter("1")
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("0").withInterestTypeAsFlatBalance()
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("0").withInterestTypeAsDecliningBalance()
|
||||
.withAmortizationTypeAsEqualPrincipalPayments().withInterestCalculationPeriodTypeSameAsRepaymentPeriod()
|
||||
.withExpectedDisbursementDate("07 March 2023").withSubmittedOnDate("03 March 2023").withLoanType("individual")
|
||||
.withExternalId(externalId).build(clientID.toString(), loanProductID.toString(), null);
|
||||
|
||||
+1
-1
@@ -336,7 +336,7 @@ public class LoanAccountChargeReveseReplayWithAdvancedPaymentAllocationTest exte
|
||||
|
||||
String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal("1000").withLoanTermFrequency("30")
|
||||
.withLoanTermFrequencyAsDays().withNumberOfRepayments("1").withRepaymentEveryAfter("30").withRepaymentFrequencyTypeAsDays()
|
||||
.withInterestRatePerPeriod("0").withInterestTypeAsFlatBalance().withAmortizationTypeAsEqualPrincipalPayments()
|
||||
.withInterestRatePerPeriod("0").withInterestTypeAsDecliningBalance().withAmortizationTypeAsEqualPrincipalPayments()
|
||||
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod().withExpectedDisbursementDate("03 September 2022")
|
||||
.withSubmittedOnDate("01 September 2022").withLoanType("individual").withExternalId(externalId)
|
||||
.withRepaymentStrategy(advancedPaymentStrategy ? "advanced-payment-allocation-strategy" : "mifos-standard-strategy")
|
||||
|
||||
+1
-1
@@ -157,7 +157,7 @@ public class LoanAccountDisbursementToSavingsWithAutoDownPaymentTest extends Bas
|
||||
|
||||
String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal("1000").withLoanTermFrequency("45")
|
||||
.withLoanTermFrequencyAsDays().withNumberOfRepayments("3").withRepaymentEveryAfter("15").withRepaymentFrequencyTypeAsDays()
|
||||
.withInterestRatePerPeriod("0").withInterestTypeAsFlatBalance().withAmortizationTypeAsEqualPrincipalPayments()
|
||||
.withInterestRatePerPeriod("0").withInterestTypeAsDecliningBalance().withAmortizationTypeAsEqualPrincipalPayments()
|
||||
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod().withExpectedDisbursementDate("01 March 2023")
|
||||
.withSubmittedOnDate("01 March 2023").withLoanType("individual").withExternalId(externalId)
|
||||
.withCreateStandingInstructionAtDisbursement().build(clientID.toString(), loanProductID.toString(), savingsId.toString());
|
||||
|
||||
+1
-1
@@ -842,7 +842,7 @@ public class LoanAccountPaymentAllocationWithOverlappingDownPaymentInstallmentTe
|
||||
|
||||
String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal("1000").withLoanTermFrequency("2")
|
||||
.withLoanTermFrequencyAsMonths().withNumberOfRepayments("2").withRepaymentEveryAfter("1")
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("0").withInterestTypeAsFlatBalance()
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("0").withInterestTypeAsDecliningBalance()
|
||||
.withAmortizationTypeAsEqualPrincipalPayments().withInterestCalculationPeriodTypeSameAsRepaymentPeriod()
|
||||
.withExpectedDisbursementDate("03 March 2023").withSubmittedOnDate("03 March 2023").withLoanType("individual")
|
||||
.withExternalId(externalId).withRepaymentStrategy(repaymentStartegy)
|
||||
|
||||
+1
-1
@@ -850,7 +850,7 @@ public class LoanAccrualTransactionOnChargeSubmittedDateTest extends BaseLoanInt
|
||||
|
||||
String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal("1000").withLoanTermFrequency("30")
|
||||
.withLoanTermFrequencyAsDays().withNumberOfRepayments("10").withRepaymentEveryAfter("3").withRepaymentFrequencyTypeAsDays()
|
||||
.withInterestRatePerPeriod("0").withInterestTypeAsFlatBalance().withAmortizationTypeAsEqualPrincipalPayments()
|
||||
.withInterestRatePerPeriod("0").withInterestTypeAsDecliningBalance().withAmortizationTypeAsEqualPrincipalPayments()
|
||||
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod().withExpectedDisbursementDate("03 March 2023")
|
||||
.withSubmittedOnDate("03 March 2023").withLoanType("individual").withExternalId(externalId)
|
||||
.build(clientID.toString(), loanProductID.toString(), null);
|
||||
|
||||
+1
-1
@@ -243,7 +243,7 @@ public class LoanAccrualTransactionReversalTest extends BaseLoanIntegrationTest
|
||||
|
||||
String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal("1000").withLoanTermFrequency("1")
|
||||
.withLoanTermFrequencyAsMonths().withNumberOfRepayments("1").withRepaymentEveryAfter("1")
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("0").withInterestTypeAsFlatBalance()
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("0").withInterestTypeAsDecliningBalance()
|
||||
.withAmortizationTypeAsEqualPrincipalPayments().withInterestCalculationPeriodTypeSameAsRepaymentPeriod()
|
||||
.withExpectedDisbursementDate("03 September 2022").withSubmittedOnDate("01 September 2022").withLoanType("individual")
|
||||
.withExternalId(externalId).build(clientID.toString(), loanProductID.toString(), null);
|
||||
|
||||
+1
-1
@@ -221,7 +221,7 @@ public class LoanMultipleDisbursementRepaymentScheduleTest extends BaseLoanInteg
|
||||
|
||||
String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal("1000").withLoanTermFrequency("30")
|
||||
.withLoanTermFrequencyAsDays().withNumberOfRepayments("1").withRepaymentEveryAfter("30").withRepaymentFrequencyTypeAsDays()
|
||||
.withInterestRatePerPeriod("0").withInterestTypeAsFlatBalance().withAmortizationTypeAsEqualPrincipalPayments()
|
||||
.withInterestRatePerPeriod("0").withInterestTypeAsDecliningBalance().withAmortizationTypeAsEqualPrincipalPayments()
|
||||
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod().withExpectedDisbursementDate("07 July 2023")
|
||||
.withSubmittedOnDate("07 July 2023").withLoanType("individual").withExternalId(externalId)
|
||||
.build(clientID.toString(), loanProductID.toString(), null);
|
||||
|
||||
+1
-1
@@ -1108,7 +1108,7 @@ public class LoanPostChargeOffScenariosTest extends BaseLoanIntegrationTest {
|
||||
|
||||
String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal("1000").withLoanTermFrequency("30")
|
||||
.withLoanTermFrequencyAsDays().withNumberOfRepayments("1").withRepaymentEveryAfter("30").withRepaymentFrequencyTypeAsDays()
|
||||
.withInterestRatePerPeriod("0").withInterestTypeAsFlatBalance().withAmortizationTypeAsEqualPrincipalPayments()
|
||||
.withInterestRatePerPeriod("0").withInterestTypeAsDecliningBalance().withAmortizationTypeAsEqualPrincipalPayments()
|
||||
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod().withExpectedDisbursementDate("03 September 2022")
|
||||
.withSubmittedOnDate("01 September 2022").withLoanType("individual").withExternalId(externalId)
|
||||
.build(clientID.toString(), loanProductID.toString(), null);
|
||||
|
||||
+3
-3
@@ -261,7 +261,7 @@ public class LoanProductRepaymentStartDateConfigurationTest {
|
||||
assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod());
|
||||
assertEquals(LocalDate.of(2023, 3, 3), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate());
|
||||
assertEquals(LocalDate.of(2023, 4, 3), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate());
|
||||
assertEquals(166.67,
|
||||
assertEquals(333.33,
|
||||
Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()));
|
||||
|
||||
// second period [2023-04-03 to 2023-05-03]
|
||||
@@ -275,7 +275,7 @@ public class LoanProductRepaymentStartDateConfigurationTest {
|
||||
assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(4).getPeriod());
|
||||
assertEquals(LocalDate.of(2023, 5, 3), loanDetails.getRepaymentSchedule().getPeriods().get(4).getFromDate());
|
||||
assertEquals(LocalDate.of(2023, 6, 3), loanDetails.getRepaymentSchedule().getPeriods().get(4).getDueDate());
|
||||
assertEquals(500.00,
|
||||
assertEquals(333.34,
|
||||
Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod()));
|
||||
|
||||
} finally {
|
||||
@@ -475,7 +475,7 @@ public class LoanProductRepaymentStartDateConfigurationTest {
|
||||
|
||||
String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal("1000").withLoanTermFrequency("3")
|
||||
.withLoanTermFrequencyAsMonths().withNumberOfRepayments("3").withRepaymentEveryAfter("1")
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("0").withInterestTypeAsFlatBalance()
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("0").withInterestTypeAsDecliningBalance()
|
||||
.withAmortizationTypeAsEqualPrincipalPayments().withInterestCalculationPeriodTypeSameAsRepaymentPeriod()
|
||||
.withExpectedDisbursementDate("07 March 2023").withSubmittedOnDate("03 March 2023").withLoanType("individual")
|
||||
.withExternalId(externalId).build(clientID.toString(), loanProductID.toString(), null);
|
||||
|
||||
+14
-11
@@ -695,7 +695,7 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio
|
||||
Double expectedDownPaymentAmount = 250.00;
|
||||
LocalDate expectedDownPaymentDueDate = LocalDate.of(2022, 9, 3);
|
||||
Double expectedRepaymentAmount = 750.00;
|
||||
Double expectedTotalDueForRepaymentInstallment = 770.0;
|
||||
Double expectedTotalDueForRepaymentInstallment = 767.50;
|
||||
LocalDate expectedRepaymentDueDate = LocalDate.of(2022, 10, 3);
|
||||
|
||||
assertTrue(periods.stream() //
|
||||
@@ -708,7 +708,7 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio
|
||||
&& expectedRepaymentAmount.equals(Utils.getDoubleValue(period.getPrincipalDue())) //
|
||||
&& expectedRepaymentDueDate.equals(period.getDueDate()) //
|
||||
&& feeAmount.equals(Utils.getDoubleValue(period.getFeeChargesDue())) //
|
||||
&& Double.valueOf(10.0).equals(Utils.getDoubleValue(period.getInterestDue()))));
|
||||
&& Double.valueOf(7.5).equals(Utils.getDoubleValue(period.getInterestDue()))));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -769,9 +769,12 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio
|
||||
Double expectedSecondDownPaymentAmount = 75.00;
|
||||
LocalDate expectedSecondDownPaymentDueDate = LocalDate.of(2022, 9, 4);
|
||||
Double expectedRepaymentAmount = 250.00;
|
||||
Double expectedRepaymentAmountWithInterest = 260.00;
|
||||
Double expectedRepaymentInterest = 10.0;
|
||||
Double expectedRepaymentTotalDueWithChargeAndInterest = 270.0;
|
||||
Double expectedRepaymentAmountWithInterest = 255.0;
|
||||
Double expectedRepaymentAmountWithInterest2 = 252.5;
|
||||
Double expectedRepaymentInterest = 7.42;
|
||||
Double expectedRepaymentInterest2 = 5.0;
|
||||
Double expectedRepaymentInterest3 = 2.5;
|
||||
Double expectedRepaymentTotalDueWithChargeAndInterest = 267.42;
|
||||
LocalDate expectedFirstRepaymentDueDate = LocalDate.of(2022, 10, 3);
|
||||
Double outstandingBalanceOnFirstRepayment = 500.00;
|
||||
LocalDate expectedSecondRepaymentDueDate = LocalDate.of(2022, 11, 3);
|
||||
@@ -813,13 +816,13 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio
|
||||
assertEquals(expectedRepaymentAmountWithInterest, Utils.getDoubleValue(secondRepaymentPeriod.getTotalDueForPeriod()));
|
||||
assertEquals(expectedSecondRepaymentDueDate, secondRepaymentPeriod.getDueDate());
|
||||
assertEquals(outstandingBalanceOnSecondRepayment, Utils.getDoubleValue(secondRepaymentPeriod.getPrincipalLoanBalanceOutstanding()));
|
||||
assertEquals(expectedRepaymentInterest, Utils.getDoubleValue(secondRepaymentPeriod.getInterestDue()));
|
||||
assertEquals(expectedRepaymentInterest2, Utils.getDoubleValue(secondRepaymentPeriod.getInterestDue()));
|
||||
|
||||
GetLoansLoanIdRepaymentPeriod thirdRepaymentPeriod = periods.get(6);
|
||||
assertEquals(expectedRepaymentAmountWithInterest, Utils.getDoubleValue(thirdRepaymentPeriod.getTotalDueForPeriod()));
|
||||
assertEquals(expectedRepaymentAmountWithInterest2, Utils.getDoubleValue(thirdRepaymentPeriod.getTotalDueForPeriod()));
|
||||
assertEquals(expectedThirdRepaymentDueDate, thirdRepaymentPeriod.getDueDate());
|
||||
assertEquals(outstandingBalanceOnThirdRepayment, Utils.getDoubleValue(thirdRepaymentPeriod.getPrincipalLoanBalanceOutstanding()));
|
||||
assertEquals(expectedRepaymentInterest, Utils.getDoubleValue(thirdRepaymentPeriod.getInterestDue()));
|
||||
assertEquals(expectedRepaymentInterest3, Utils.getDoubleValue(thirdRepaymentPeriod.getInterestDue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1737,7 +1740,7 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio
|
||||
|
||||
String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal("1000").withLoanTermFrequency("30")
|
||||
.withLoanTermFrequencyAsDays().withNumberOfRepayments("1").withRepaymentEveryAfter("30").withRepaymentFrequencyTypeAsDays()
|
||||
.withInterestRatePerPeriod("0").withInterestTypeAsFlatBalance().withAmortizationTypeAsEqualPrincipalPayments()
|
||||
.withInterestRatePerPeriod("0").withInterestTypeAsDecliningBalance().withAmortizationTypeAsEqualPrincipalPayments()
|
||||
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod().withExpectedDisbursementDate("03 March 2023")
|
||||
.withSubmittedOnDate("03 March 2023").withLoanType("individual").withExternalId(externalId)
|
||||
.build(clientID.toString(), loanProductID.toString(), null);
|
||||
@@ -1816,7 +1819,7 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio
|
||||
|
||||
String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal("1000").withLoanTermFrequency(numberOfRepayments)
|
||||
.withLoanTermFrequencyAsMonths().withNumberOfRepayments(numberOfRepayments).withRepaymentEveryAfter("1")
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod(interestRate).withInterestTypeAsFlatBalance()
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod(interestRate).withInterestTypeAsDecliningBalance()
|
||||
.withAmortizationTypeAsEqualPrincipalPayments().withInterestCalculationPeriodTypeSameAsRepaymentPeriod()
|
||||
.withExpectedDisbursementDate("03 September 2022").withSubmittedOnDate("01 September 2022").withLoanType("individual")
|
||||
.withExternalId(externalId).build(clientID.toString(), loanProductID.toString(), null);
|
||||
@@ -1839,7 +1842,7 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio
|
||||
|
||||
String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal("1000").withLoanTermFrequency(numberOfRepayments)
|
||||
.withLoanTermFrequencyAsMonths().withNumberOfRepayments(numberOfRepayments).withRepaymentEveryAfter("1")
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod(interestRate).withInterestTypeAsFlatBalance()
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod(interestRate).withInterestTypeAsDecliningBalance()
|
||||
.withAmortizationTypeAsEqualPrincipalPayments().withInterestCalculationPeriodTypeSameAsRepaymentPeriod()
|
||||
.withExpectedDisbursementDate("04 September 2022").withSubmittedOnDate("01 September 2022").withLoanType("individual")
|
||||
.withExternalId(externalId).build(clientID.toString(), loanProductID.toString(), null);
|
||||
|
||||
+1
-1
@@ -572,7 +572,7 @@ public class LoanRescheduleRequestTest extends BaseLoanIntegrationTest {
|
||||
String submittedOnDate, String expectedDisburmentDate) {
|
||||
final PostLoansRequest loanRequest = new PostLoansRequest() //
|
||||
.loanTermFrequency(4).locale("en_GB").loanTermFrequencyType(2).numberOfRepayments(4).repaymentFrequencyType(2)
|
||||
.interestRatePerPeriod(BigDecimal.valueOf(2)).repaymentEvery(1).principal(principal).amortizationType(1).interestType(1)
|
||||
.interestRatePerPeriod(BigDecimal.valueOf(2)).repaymentEvery(1).principal(principal).amortizationType(1).interestType(0)
|
||||
.interestCalculationPeriodType(0).dateFormat("dd MMMM yyyy").transactionProcessingStrategyCode(DEFAULT_STRATEGY)
|
||||
.loanType("individual").submittedOnDate(submittedOnDate).expectedDisbursementDate(expectedDisburmentDate).clientId(clientId)
|
||||
.productId(loanProductId);
|
||||
|
||||
+25
-25
@@ -1075,18 +1075,18 @@ public class LoanTransactionAccrualActivityPostingTest extends BaseLoanIntegrati
|
||||
|
||||
addRepaymentForLoan(loanId.get(), 650.0, repaymentDate1);
|
||||
|
||||
verifyTransactions(loanId.get(), transaction(109.45, "Accrual", repaymentDate1, 0.0, 0.0, 39.45, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(109.45, "Accrual Activity", repaymentDate1, 0.0, 0.0, 39.45, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(650.0, "Repayment", repaymentDate1, 0.0, 500.0, 39.45, 40.0, 30.0, 0.0, 40.55, false), //
|
||||
verifyTransactions(loanId.get(), transaction(94.9, "Accrual", repaymentDate1, 0.0, 0.0, 24.9, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(94.9, "Accrual Activity", repaymentDate1, 0.0, 0.0, 24.9, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(650.0, "Repayment", repaymentDate1, 0.0, 500.0, 24.9, 40.0, 30.0, 0.0, 55.1, false), //
|
||||
transaction(500.0, "Disbursement", disbursementDay, 500.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false)); //
|
||||
});
|
||||
runAt(repaymentPeriod1CloseDate, () -> {
|
||||
|
||||
inlineLoanCOBHelper.executeInlineCOB(List.of(loanId.get()));
|
||||
|
||||
verifyTransactions(loanId.get(), transaction(109.45, "Accrual", repaymentDate1, 0.0, 0.0, 39.45, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(109.45, "Accrual Activity", repaymentDate1, 0.0, 0.0, 39.45, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(650.0, "Repayment", repaymentDate1, 0.0, 500.0, 39.45, 40.0, 30.0, 0.0, 40.55, false), //
|
||||
verifyTransactions(loanId.get(), transaction(94.9, "Accrual", repaymentDate1, 0.0, 0.0, 24.9, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(94.9, "Accrual Activity", repaymentDate1, 0.0, 0.0, 24.9, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(650.0, "Repayment", repaymentDate1, 0.0, 500.0, 24.9, 40.0, 30.0, 0.0, 55.1, false), //
|
||||
transaction(500.0, "Disbursement", disbursementDay, 500.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false)); //
|
||||
|
||||
loanTransactionHelper.disburseLoan(loanId.get(), new PostLoansLoanIdRequest().actualDisbursementDate(disbursementDay2)
|
||||
@@ -1094,9 +1094,9 @@ public class LoanTransactionAccrualActivityPostingTest extends BaseLoanIntegrati
|
||||
|
||||
verifyTransactions(loanId.get(),
|
||||
transaction(500.0, "Disbursement", disbursementDay, 500.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false), //
|
||||
transaction(89.72, "Accrual Activity", repaymentPeriod1DueDate, 0.0, 0.0, 19.72, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(500.0, "Disbursement", disbursementDay2, 479.16, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false), //
|
||||
transaction(650.0, "Repayment", repaymentDate1, 0.0, 520.84, 59.16, 40.0, 30.0, 0.0, 0.0, false)); //
|
||||
transaction(82.49, "Accrual Activity", repaymentPeriod1DueDate, 0.0, 0.0, 12.49, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(500.0, "Disbursement", disbursementDay2, 456.52, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false), //
|
||||
transaction(650.0, "Repayment", repaymentDate1, 0.0, 543.48, 36.52, 40.0, 30.0, 0.0, 0.0, false)); //
|
||||
|
||||
});
|
||||
}
|
||||
@@ -1185,37 +1185,37 @@ public class LoanTransactionAccrualActivityPostingTest extends BaseLoanIntegrati
|
||||
chargeFee(loanId.get(), 40.0, repaymentPeriod1DueDate);
|
||||
addRepaymentForLoan(loanId.get(), 650.0, repaymentDate1);
|
||||
verifyTransactions(loanId.get(),
|
||||
transaction(650.0, "Repayment", repaymentDate1, 0.0, 500.0, 39.45, 40.0, 30.0, 0.0, 40.55, false),
|
||||
transaction(109.45, "Accrual Activity", repaymentDate1, 0.0, 0.0, 39.45, 40.0, 30.0, 0.0, 0.0, false),
|
||||
transaction(109.45, "Accrual", repaymentDate1, 0.0, 0.0, 39.45, 40.0, 30.0, 0.0, 0.0, false),
|
||||
transaction(650.0, "Repayment", repaymentDate1, 0.0, 500.0, 24.9, 40.0, 30.0, 0.0, 55.1, false),
|
||||
transaction(94.90, "Accrual Activity", repaymentDate1, 0.0, 0.0, 24.9, 40.0, 30.0, 0.0, 0.0, false),
|
||||
transaction(94.90, "Accrual", repaymentDate1, 0.0, 0.0, 24.9, 40.0, 30.0, 0.0, 0.0, false),
|
||||
transaction(500.0, "Disbursement", disbursementDay, 500.0, 0, 0, 0, 0, 0, 0, false));
|
||||
});
|
||||
runAt(repaymentPeriod1CloseDate, () -> {
|
||||
inlineLoanCOBHelper.executeInlineCOB(List.of(loanId.get()));
|
||||
verifyTransactions(loanId.get(),
|
||||
transaction(650.0, "Repayment", repaymentDate1, 0.0, 500.0, 39.45, 40.0, 30.0, 0.0, 40.55, false), //
|
||||
transaction(109.45, "Accrual Activity", repaymentDate1, 0.0, 0.0, 39.45, 40.0, 30.0, 0.0, 0.0, false),
|
||||
transaction(109.45, "Accrual", repaymentDate1, 0.0, 0.0, 39.45, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(650.0, "Repayment", repaymentDate1, 0.0, 500.0, 24.9, 40.0, 30.0, 0.0, 55.1, false), //
|
||||
transaction(94.90, "Accrual Activity", repaymentDate1, 0.0, 0.0, 24.9, 40.0, 30.0, 0.0, 0.0, false),
|
||||
transaction(94.90, "Accrual", repaymentDate1, 0.0, 0.0, 24.9, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(500.0, "Disbursement", disbursementDay, 500.0, 0, 0, 0, 0, 0, 0, false) //
|
||||
);
|
||||
loanTransactionHelper.disburseLoan(loanId.get(), new PostLoansLoanIdRequest().actualDisbursementDate(disbursementDay2)
|
||||
.dateFormat(DATETIME_PATTERN).transactionAmount(BigDecimal.valueOf(500.0)).locale("en"));
|
||||
verifyTransactions(loanId.get(),
|
||||
transaction(500.0, "Disbursement", disbursementDay2, 479.16, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false), //
|
||||
transaction(650.0, "Repayment", repaymentDate1, 0.0, 520.84, 59.16, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(89.72, "Accrual Activity", repaymentPeriod1DueDate, 0.0, 0.0, 19.72, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(500.0, "Disbursement", disbursementDay2, 453.79, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false), //
|
||||
transaction(650.0, "Repayment", repaymentDate1, 0.0, 546.21, 33.79, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(80.19, "Accrual Activity", repaymentPeriod1DueDate, 0.0, 0.0, 10.19, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(500.0, "Disbursement", disbursementDay, 500.0, 0, 0, 0, 0, 0, 0, false) //
|
||||
);
|
||||
});
|
||||
runAt(repaymentPeriod2CloseDate, () -> {
|
||||
inlineLoanCOBHelper.executeInlineCOB(List.of(loanId.get()));
|
||||
verifyTransactions(loanId.get(),
|
||||
transaction(500.0, "Disbursement", disbursementDay2, 479.16, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false), //
|
||||
transaction(650.0, "Repayment", repaymentDate1, 0.0, 520.84, 59.16, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(89.72, "Accrual Activity", repaymentPeriod1DueDate, 0.0, 0.0, 19.72, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(89.72, "Accrual", repaymentPeriod1DueDate, 0.0, 0.0, 19.72, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(19.72, "Accrual", repaymentPeriod2DueDate, 0.0, 0.0, 19.72, 0.0, 0.0, 0.0, 0.0, false), //
|
||||
transaction(19.72, "Accrual Activity", repaymentPeriod2DueDate, 0.0, 0.0, 19.72, 0.0, 0.0, 0.0, 0.0, false), //
|
||||
transaction(500.0, "Disbursement", disbursementDay2, 453.79, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false), //
|
||||
transaction(650.0, "Repayment", repaymentDate1, 0.0, 546.21, 33.79, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(80.19, "Accrual Activity", repaymentPeriod1DueDate, 0.0, 0.0, 10.19, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(80.19, "Accrual", repaymentPeriod1DueDate, 0.0, 0.0, 10.19, 40.0, 30.0, 0.0, 0.0, false), //
|
||||
transaction(13.43, "Accrual", repaymentPeriod2DueDate, 0.0, 0.0, 13.43, 0.0, 0.0, 0.0, 0.0, false), //
|
||||
transaction(13.43, "Accrual Activity", repaymentPeriod2DueDate, 0.0, 0.0, 13.43, 0.0, 0.0, 0.0, 0.0, false), //
|
||||
transaction(500.0, "Disbursement", disbursementDay, 500.0, 0, 0, 0, 0, 0, 0, false) //
|
||||
);
|
||||
});
|
||||
@@ -1648,7 +1648,7 @@ public class LoanTransactionAccrualActivityPostingTest extends BaseLoanIntegrati
|
||||
String applicationDisbursementDate, String applicationDisbursementDate2) {
|
||||
final PostLoansRequest loanRequest = new PostLoansRequest() //
|
||||
.loanTermFrequency(4).locale("en_GB").loanTermFrequencyType(2).numberOfRepayments(4).repaymentFrequencyType(2)
|
||||
.interestRatePerPeriod(BigDecimal.valueOf(2)).repaymentEvery(1).principal(principal).amortizationType(1).interestType(1)
|
||||
.interestRatePerPeriod(BigDecimal.valueOf(2)).repaymentEvery(1).principal(principal).amortizationType(1).interestType(0)
|
||||
.interestCalculationPeriodType(0).dateFormat("dd MMMM yyyy").transactionProcessingStrategyCode(DEFAULT_STRATEGY)
|
||||
.loanType("individual").submittedOnDate(applicationDisbursementDate).expectedDisbursementDate(applicationDisbursementDate2)
|
||||
.clientId(clientID).productId(loanProductID);
|
||||
|
||||
Reference in New Issue
Block a user