FINERACT-2148: Resolve rounding issue in interest period calculation
This commit is contained in:
committed by
Adam Saghy
parent
2fbdbe9df7
commit
b7e6f356da
+3
-3
@@ -4665,13 +4665,13 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
|
||||
GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(createdLoanId.get());
|
||||
assertEquals(BigDecimal.ZERO, loanDetails.getSummary().getTotalUnpaidPayableDueInterest().stripTrailingZeros());
|
||||
assertEquals(new BigDecimal("0.97"), loanDetails.getSummary().getTotalUnpaidPayableNotDueInterest().stripTrailingZeros());
|
||||
assertEquals(new BigDecimal("0.98"), loanDetails.getSummary().getTotalUnpaidPayableNotDueInterest().stripTrailingZeros());
|
||||
|
||||
// Partial interest repayment
|
||||
addRepaymentForLoan(createdLoanId.get(), 20.50, "30 January 2024");
|
||||
loanDetails = loanTransactionHelper.getLoanDetails(createdLoanId.get());
|
||||
assertEquals(BigDecimal.ZERO, loanDetails.getSummary().getTotalUnpaidPayableDueInterest().stripTrailingZeros());
|
||||
assertEquals(new BigDecimal("0.05"), loanDetails.getSummary().getTotalUnpaidPayableNotDueInterest().stripTrailingZeros());
|
||||
assertEquals(new BigDecimal("0.06"), loanDetails.getSummary().getTotalUnpaidPayableNotDueInterest().stripTrailingZeros());
|
||||
});
|
||||
|
||||
runAt("31 January 2024", () -> {
|
||||
@@ -4704,7 +4704,7 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
|
||||
GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(createdLoanId.get());
|
||||
assertEquals(new BigDecimal("0.12"), loanDetails.getSummary().getTotalUnpaidPayableDueInterest().stripTrailingZeros());
|
||||
assertEquals(new BigDecimal("0.52"), loanDetails.getSummary().getTotalUnpaidPayableNotDueInterest().stripTrailingZeros());
|
||||
assertEquals(new BigDecimal("0.51"), loanDetails.getSummary().getTotalUnpaidPayableNotDueInterest().stripTrailingZeros());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -182,8 +182,8 @@ public class ExternalBusinessEventTest extends BaseLoanIntegrationTest {
|
||||
Assertions.assertNotNull(postLoansLoanIdTransactionsResponse);
|
||||
Assertions.assertNotNull(postLoansLoanIdTransactionsResponse.getResourceId());
|
||||
|
||||
verifyBusinessEvents(new LoanTransactionBusinessEvent("LoanTransactionInterestRefundPostBusinessEvent", "22 January 2021", 5.74,
|
||||
0.0, 5.74, 0.0, 0.0, 0.0));
|
||||
verifyBusinessEvents(new LoanTransactionBusinessEvent("LoanTransactionInterestRefundPostBusinessEvent", "22 January 2021", 5.75,
|
||||
0.0, 5.75, 0.0, 0.0, 0.0));
|
||||
});
|
||||
enableLoanInterestRefundPstBusinessEvent(false);
|
||||
}
|
||||
|
||||
+24
-24
@@ -155,8 +155,8 @@ public class LoanInterestRefundTest extends BaseLoanIntegrationTest {
|
||||
verifyTransactions(loanId, //
|
||||
transaction(1000.0, "Disbursement", "01 January 2021"), //
|
||||
transaction(1000.0, "Payout Refund", "22 January 2021"), //
|
||||
transaction(5.74, "Interest Refund", "22 January 2021"), //
|
||||
transaction(5.74, "Accrual", "22 January 2021")); //
|
||||
transaction(5.75, "Interest Refund", "22 January 2021"), //
|
||||
transaction(5.75, "Accrual", "22 January 2021")); //
|
||||
|
||||
checkTransactionWasNotReverseReplayed(postLoansLoanIdTransactionsResponse.getLoanId(),
|
||||
postLoansLoanIdTransactionsResponse.getResourceId());
|
||||
@@ -165,12 +165,12 @@ public class LoanInterestRefundTest extends BaseLoanIntegrationTest {
|
||||
|
||||
verifyTRJournalEntries(postLoansLoanIdTransactionsResponse.getResourceId(), //
|
||||
journalEntry(1000, fundSource, "DEBIT"), //
|
||||
journalEntry(5.74, interestReceivableAccount, "CREDIT"), //
|
||||
journalEntry(994.26, loansReceivableAccount, "CREDIT"));
|
||||
journalEntry(5.75, interestReceivableAccount, "CREDIT"), //
|
||||
journalEntry(994.25, loansReceivableAccount, "CREDIT"));
|
||||
|
||||
verifyTRJournalEntries(postLoansLoanIdTransactionsResponse.getSubResourceId(),
|
||||
journalEntry(5.74, interestIncomeAccount, "DEBIT"), //
|
||||
journalEntry(5.74, loansReceivableAccount, "CREDIT")); //
|
||||
journalEntry(5.75, interestIncomeAccount, "DEBIT"), //
|
||||
journalEntry(5.75, loansReceivableAccount, "CREDIT")); //
|
||||
});
|
||||
}
|
||||
|
||||
@@ -212,8 +212,8 @@ public class LoanInterestRefundTest extends BaseLoanIntegrationTest {
|
||||
logLoanTransactions(loanId);
|
||||
verifyTransactions(loanId, transaction(1000.0, "Disbursement", "01 January 2021"), //
|
||||
transaction(1000.0, "Merchant Issued Refund", "22 January 2021"), //
|
||||
transaction(5.74, "Accrual", "22 January 2021"), //
|
||||
transaction(5.74, "Interest Refund", "22 January 2021") //
|
||||
transaction(5.75, "Accrual", "22 January 2021"), //
|
||||
transaction(5.75, "Interest Refund", "22 January 2021") //
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -245,8 +245,8 @@ public class LoanInterestRefundTest extends BaseLoanIntegrationTest {
|
||||
logLoanTransactions(loanId);
|
||||
verifyTransactions(loanId, transaction(1000.0, "Disbursement", "01 January 2021"), //
|
||||
transaction(1000.0, "Payout Refund", "22 January 2021"), //
|
||||
transaction(5.74, "Accrual", "22 January 2021"), //
|
||||
transaction(5.74, "Interest Refund", "22 January 2021") //
|
||||
transaction(5.75, "Accrual", "22 January 2021"), //
|
||||
transaction(5.75, "Interest Refund", "22 January 2021") //
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -323,8 +323,8 @@ public class LoanInterestRefundTest extends BaseLoanIntegrationTest {
|
||||
verifyTransactions(loanId, transaction(1000.0, "Disbursement", "01 January 2021"), //
|
||||
transaction(87.89, "Repayment", "01 February 2021"), //
|
||||
transaction(1000.0, "Payout Refund", "09 February 2021"), //
|
||||
transaction(10.49, "Interest Refund", "09 February 2021"), //
|
||||
transaction(10.49, "Accrual", "09 February 2021") //
|
||||
transaction(10.5, "Interest Refund", "09 February 2021"), //
|
||||
transaction(10.5, "Accrual", "09 February 2021") //
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -361,8 +361,8 @@ public class LoanInterestRefundTest extends BaseLoanIntegrationTest {
|
||||
verifyTransactions(loanId, transaction(750.0, "Disbursement", "01 January 2021"), //
|
||||
transaction(250.0, "Disbursement", "01 January 2021"), //
|
||||
transaction(1000.0, "Payout Refund", "22 January 2021"), //
|
||||
transaction(5.74, "Accrual", "22 January 2021"), //
|
||||
transaction(5.74, "Interest Refund", "22 January 2021") //
|
||||
transaction(5.75, "Accrual", "22 January 2021"), //
|
||||
transaction(5.75, "Interest Refund", "22 January 2021") //
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -400,8 +400,8 @@ public class LoanInterestRefundTest extends BaseLoanIntegrationTest {
|
||||
verifyTransactions(loanId, transaction(750.0, "Disbursement", "04 January 2021"), //
|
||||
transaction(250.0, "Disbursement", "01 January 2021"), //
|
||||
transaction(1000.0, "Payout Refund", "22 January 2021"), //
|
||||
transaction(5.13, "Accrual", "22 January 2021"), //
|
||||
transaction(5.13, "Interest Refund", "22 January 2021") //
|
||||
transaction(5.14, "Accrual", "22 January 2021"), //
|
||||
transaction(5.14, "Interest Refund", "22 January 2021") //
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -533,7 +533,7 @@ public class LoanInterestRefundTest extends BaseLoanIntegrationTest {
|
||||
verifyTransactions(loanId, transaction(1000.0, "Disbursement", "01 January 2021"), //
|
||||
transaction(87.89, "Repayment", "01 February 2021"), //
|
||||
transaction(500.0, "Payout Refund", "09 February 2021"), //
|
||||
transaction(5.34, "Interest Refund", "09 February 2021"));
|
||||
transaction(5.35, "Interest Refund", "09 February 2021"));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -568,7 +568,7 @@ public class LoanInterestRefundTest extends BaseLoanIntegrationTest {
|
||||
verifyTransactions(loanId, transaction(250.0, "Disbursement", "01 January 2021"), //
|
||||
transaction(750.0, "Disbursement", "01 January 2021"), //
|
||||
transaction(500.0, "Payout Refund", "22 January 2021"), //
|
||||
transaction(2.87, "Interest Refund", "22 January 2021"));
|
||||
transaction(2.88, "Interest Refund", "22 January 2021"));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -605,7 +605,7 @@ public class LoanInterestRefundTest extends BaseLoanIntegrationTest {
|
||||
verifyTransactions(loanId, transaction(250.0, "Disbursement", "01 January 2021"), //
|
||||
transaction(750.0, "Disbursement", "07 January 2021"), //
|
||||
transaction(500.0, "Payout Refund", "22 January 2021"), //
|
||||
transaction(2.46, "Interest Refund", "22 January 2021"));
|
||||
transaction(2.47, "Interest Refund", "22 January 2021"));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -795,7 +795,7 @@ public class LoanInterestRefundTest extends BaseLoanIntegrationTest {
|
||||
verifyTransactions(loanId, transaction(250.0, "Disbursement", "01 January 2021"), //
|
||||
transaction(750.0, "Disbursement", "01 January 2021"), //
|
||||
transaction(500.0, "Merchant Issued Refund", "22 January 2021"), //
|
||||
transaction(2.87, "Interest Refund", "22 January 2021") //
|
||||
transaction(2.88, "Interest Refund", "22 January 2021") //
|
||||
);
|
||||
});
|
||||
runAt("26 January 2021", () -> {
|
||||
@@ -805,14 +805,14 @@ public class LoanInterestRefundTest extends BaseLoanIntegrationTest {
|
||||
verifyTransactions(loanId, transaction(250.0, "Disbursement", "01 January 2021"), //
|
||||
transaction(750.0, "Disbursement", "01 January 2021"), //
|
||||
transaction(500.0, "Merchant Issued Refund", "22 January 2021"), //
|
||||
transaction(2.87, "Interest Refund", "22 January 2021"), //
|
||||
transaction(2.88, "Interest Refund", "22 January 2021"), //
|
||||
transaction(400.0, "Payout Refund", "26 January 2021"), //
|
||||
transaction(2.73, "Interest Refund", "26 January 2021") //
|
||||
transaction(2.74, "Interest Refund", "26 January 2021") //
|
||||
);
|
||||
});
|
||||
runAt("1 February 2021", () -> {
|
||||
Long loanId = loanIdRef.get();
|
||||
loanTransactionHelper.makeLoanRepayment("Repayment", "1 February 2021", 100.86F, loanId.intValue());
|
||||
loanTransactionHelper.makeLoanRepayment("Repayment", "1 February 2021", 100.85F, loanId.intValue());
|
||||
GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(loanId);
|
||||
Assertions.assertNotNull(loanDetails);
|
||||
Assertions.assertNotNull(loanDetails.getStatus());
|
||||
@@ -867,7 +867,7 @@ public class LoanInterestRefundTest extends BaseLoanIntegrationTest {
|
||||
transaction(250.0, "Merchant Issued Refund", "22 January 2021"), //
|
||||
transaction(1.44, "Interest Refund", "22 January 2021"), //
|
||||
transaction(400.0, "Payout Refund", "26 January 2021"), //
|
||||
transaction(2.57, "Interest Refund", "26 January 2021") //
|
||||
transaction(2.58, "Interest Refund", "26 January 2021") //
|
||||
);
|
||||
});
|
||||
runAt("1 April 2021", () -> {
|
||||
|
||||
Reference in New Issue
Block a user