FINERACT-2311: Buy Down fees - External business events

- buy down fee reversal fix
- added more listeners for buy down fee amortization on closed loans
This commit is contained in:
adam.magyari
2025-08-06 13:53:04 +02:00
committed by Adam Saghy
parent aa68f251d3
commit 6a198de0cc
17 changed files with 223 additions and 287 deletions
@@ -172,16 +172,15 @@ public final class ErrorMessageHelper {
}
public static String addCapitalizedIncomeUndoFailureTransactionTypeNonReversal() {
return "Only (non-reversed) transactions of type repayment, waiver, accrual, credit balance refund, capitalized income, capitalized income adjustment or buy down fee adjustment can be adjusted.";
return "Only (non-reversed) transactions of type repayment, waiver, accrual, credit balance refund, capitalized income, capitalized income adjustment, buy down fee or buy down fee adjustment can be adjusted.";
}
public static String addCapitalizedIncomeUndoFailureAdjustmentExists() {
return "Capitalized income transaction cannot be reversed when non-reversed adjustment exists for it.";
}
public static String buyDownFeeUndoFailureAdjustmentExists(Long loanId) {
String loanIdStr = String.valueOf(loanId);
return String.format("Undo Loan Transaction: %s is not allowed. Loan transaction has not reversed transaction related", loanIdStr);
public static String buyDownFeeUndoFailureAdjustmentExists() {
return "Buy down fee transaction cannot be reversed when non-reversed adjustment exists for it.";
}
public static String wrongAmountInRepaymentSchedule(int line, BigDecimal actual, BigDecimal expected) {
@@ -539,8 +539,7 @@ public class LoanRepaymentStepDef extends AbstractStepDef {
Response<PostLoansLoanIdTransactionsResponse> transactionUndoResponse = loanTransactionsApi
.adjustLoanTransaction(loanId, targetTransaction.getId(), transactionUndoRequest, "").execute();
if (transactionType.equals("Buy Down Fee")) {
checkMakeTransactionForbidden(transactionUndoResponse, 403,
ErrorMessageHelper.buyDownFeeUndoFailureAdjustmentExists(targetTransaction.getId()));
checkMakeTransactionForbidden(transactionUndoResponse, 403, ErrorMessageHelper.buyDownFeeUndoFailureAdjustmentExists());
} else if (transactionType.equals("Capitalized Income")) {
checkMakeTransactionForbidden(transactionUndoResponse, 403,
ErrorMessageHelper.addCapitalizedIncomeUndoFailureAdjustmentExists());
@@ -17,7 +17,7 @@ Feature:Feature: Buy Down Fees
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 66.86 | 33.14 | 0.58 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 2 | 29 | 01 March 2024 | | 33.53 | 33.33 | 0.39 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 100.0 | 1.17 | 0.0 | 0.0 | 101.17 | 0.0 | 0.0 | 0.0 | 101.17 |
@@ -38,7 +38,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Repayment | 33.72 | 33.14 | 0.58 | 0.0 | 0.0 | 66.86 | false |
When Admin sets the business date to "1 March 2024"
And Customer makes "AUTOPAY" repayment on "01 March 2024" with 33.72 EUR transaction amount
@@ -49,7 +49,7 @@ Feature:Feature: Buy Down Fees
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Repayment | 33.72 | 33.14 | 0.58 | 0.0 | 0.0 | 66.86 | false |
| 01 March 2024 | Repayment | 33.72 | 33.33 | 0.39 | 0.0 | 0.0 | 33.53 | false |
| 31 March 2024 | Accrual | 1.16 | 0.0 | 1.16 | 0.0 | 0.0 | 0.0 | false |
@@ -77,7 +77,7 @@ Feature:Feature: Buy Down Fees
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 66.86 | 33.14 | 0.58 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 2 | 29 | 01 March 2024 | | 33.53 | 33.33 | 0.39 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 100.0 | 1.17 | 0.0 | 0.0 | 101.17 | 0.0 | 0.0 | 0.0 | 101.17 |
@@ -120,7 +120,7 @@ Feature:Feature: Buy Down Fees
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
@@ -318,7 +318,7 @@ Feature:Feature: Buy Down Fees
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 66.86 | 33.14 | 0.58 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 2 | 29 | 01 March 2024 | | 33.53 | 33.33 | 0.39 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 100.0 | 1.17 | 0.0 | 0.0 | 101.17 | 0.0 | 0.0 | 0.0 | 101.17 |
@@ -339,7 +339,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Repayment | 33.72 | 33.14 | 0.58 | 0.0 | 0.0 | 66.86 | false |
When Admin sets the business date to "1 March 2024"
When Loan Pay-off is made on "1 March 2024"
@@ -347,7 +347,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Repayment | 33.72 | 33.14 | 0.58 | 0.0 | 0.0 | 66.86 | false |
| 01 March 2024 | Repayment | 67.25 | 66.86 | 0.39 | 0.0 | 0.0 | 0.0 | false |
| 01 March 2024 | Accrual | 0.97 | 0.0 | 0.97 | 0.0 | 0.0 | 0.0 | false |
@@ -376,7 +376,7 @@ Feature:Feature: Buy Down Fees
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 66.86 | 33.14 | 0.58 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 2 | 29 | 01 March 2024 | | 33.53 | 33.33 | 0.39 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 100.0 | 1.17 | 0.0 | 0.0 | 101.17 | 0.0 | 0.0 | 0.0 | 101.17 |
@@ -415,7 +415,7 @@ Feature:Feature: Buy Down Fees
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
@@ -565,7 +565,7 @@ Feature:Feature: Buy Down Fees
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 66.86 | 33.14 | 0.58 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 2 | 29 | 01 March 2024 | | 33.53 | 33.33 | 0.39 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 100.0 | 1.17 | 0.0 | 0.0 | 101.17 | 0.0 | 0.0 | 0.0 | 101.17 |
@@ -586,7 +586,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Repayment | 33.72 | 33.14 | 0.58 | 0.0 | 0.0 | 66.86 | false |
When Admin sets the business date to "1 March 2024"
And Admin does charge-off the loan on "1 March 2024"
@@ -601,7 +601,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Repayment | 33.72 | 33.14 | 0.58 | 0.0 | 0.0 | 66.86 | false |
| 01 March 2024 | Buy Down Fee Amortization | 33.52 | 0.0 | 33.52 | 0.0 | 0.0 | 0.0 | false |
| 01 March 2024 | Accrual | 0.97 | 0.0 | 0.97 | 0.0 | 0.0 | 0.0 | false |
@@ -637,7 +637,7 @@ Feature:Feature: Buy Down Fees
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 66.86 | 33.14 | 0.58 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 2 | 29 | 01 March 2024 | | 33.53 | 33.33 | 0.39 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 100.0 | 1.17 | 0.0 | 0.0 | 101.17 | 0.0 | 0.0 | 0.0 | 101.17 |
@@ -683,7 +683,7 @@ Feature:Feature: Buy Down Fees
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
@@ -840,7 +840,7 @@ Feature:Feature: Buy Down Fees
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 66.86 | 33.14 | 0.58 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 2 | 29 | 01 March 2024 | | 33.53 | 33.33 | 0.39 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 100.0 | 1.17 | 0.0 | 0.0 | 101.17 | 0.0 | 0.0 | 0.0 | 101.17 |
@@ -865,7 +865,7 @@ Feature:Feature: Buy Down Fees
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 66.86 | 33.14 | 0.58 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 2 | 29 | 01 March 2024 | | 33.53 | 33.33 | 0.39 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 100.0 | 1.17 | 0.0 | 0.0 | 101.17 | 0.0 | 0.0 | 0.0 | 101.17 |
@@ -878,7 +878,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Buy Down Fee Amortization | 17.58 | 0.0 | 17.58 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Accrual | 0.58 | 0.0 | 0.58 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Charge-off | 101.17 | 100.0 | 1.17 | 0.0 | 0.0 | 0.0 | false |
@@ -898,7 +898,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Buy Down Fee Amortization | 17.58 | 0.0 | 17.58 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Accrual | 0.58 | 0.0 | 0.58 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Charge-off | 101.17 | 100.0 | 1.17 | 0.0 | 0.0 | 0.0 | true |
@@ -939,7 +939,7 @@ Feature:Feature: Buy Down Fees
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 66.86 | 33.14 | 0.58 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 2 | 29 | 01 March 2024 | | 33.53 | 33.33 | 0.39 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 100.0 | 1.17 | 0.0 | 0.0 | 101.17 | 0.0 | 0.0 | 0.0 | 101.17 |
@@ -966,7 +966,7 @@ Feature:Feature: Buy Down Fees
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 66.86 | 33.14 | 0.58 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 2 | 29 | 01 March 2024 | | 33.53 | 33.33 | 0.39 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 100.0 | 1.17 | 0.0 | 0.0 | 101.17 | 0.0 | 0.0 | 0.0 | 101.17 |
@@ -979,7 +979,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Buy Down Fee Amortization | 17.58 | 0.0 | 17.58 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Accrual | 0.58 | 0.0 | 0.58 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Charge-off | 101.17 | 100.0 | 1.17 | 0.0 | 0.0 | 0.0 | false |
@@ -999,7 +999,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Buy Down Fee Amortization | 17.58 | 0.0 | 17.58 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Accrual | 0.58 | 0.0 | 0.58 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Charge-off | 101.17 | 100.0 | 1.17 | 0.0 | 0.0 | 0.0 | true |
@@ -1039,7 +1039,7 @@ Feature:Feature: Buy Down Fees
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 66.86 | 33.14 | 0.58 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 2 | 29 | 01 March 2024 | | 33.53 | 33.33 | 0.39 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 100.0 | 1.17 | 0.0 | 0.0 | 101.17 | 0.0 | 0.0 | 0.0 | 101.17 |
@@ -1067,7 +1067,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 25 January 2024 | Buy Down Fee Amortization | 13.74 | 0.0 | 13.74 | 0.0 | 0.0 | 0.0 | false |
| 25 January 2024 | Accrual | 0.45 | 0.0 | 0.45 | 0.0 | 0.0 | 0.0 | false |
| 25 January 2024 | Charge-off | 101.17 | 100.0 | 1.17 | 0.0 | 0.0 | 0.0 | false |
@@ -1102,7 +1102,7 @@ Feature:Feature: Buy Down Fees
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 66.86 | 33.14 | 0.58 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 2 | 29 | 01 March 2024 | | 33.53 | 33.33 | 0.39 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 100.0 | 1.17 | 0.0 | 0.0 | 101.17 | 0.0 | 0.0 | 0.0 | 101.17 |
@@ -1130,7 +1130,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 25 January 2024 | Buy Down Fee Amortization | 13.74 | 0.0 | 13.74 | 0.0 | 0.0 | 0.0 | false |
| 25 January 2024 | Accrual | 0.45 | 0.0 | 0.45 | 0.0 | 0.0 | 0.0 | false |
| 25 January 2024 | Charge-off | 101.17 | 100.0 | 1.17 | 0.0 | 0.0 | 0.0 | false |
@@ -1164,7 +1164,7 @@ Feature:Feature: Buy Down Fees
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 66.86 | 33.14 | 0.58 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 2 | 29 | 01 March 2024 | | 33.53 | 33.33 | 0.39 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 100.0 | 1.17 | 0.0 | 0.0 | 101.17 | 0.0 | 0.0 | 0.0 | 101.17 |
@@ -1192,7 +1192,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 25 January 2024 | Buy Down Fee Amortization | 13.74 | 0.0 | 13.74 | 0.0 | 0.0 | 0.0 | false |
| 25 January 2024 | Accrual | 0.45 | 0.0 | 0.45 | 0.0 | 0.0 | 0.0 | false |
| 25 January 2024 | Charge-off | 101.17 | 100.0 | 1.17 | 0.0 | 0.0 | 0.0 | false |
@@ -1211,7 +1211,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 25 January 2024 | Buy Down Fee Amortization | 13.74 | 0.0 | 13.74 | 0.0 | 0.0 | 0.0 | false |
| 25 January 2024 | Accrual | 0.45 | 0.0 | 0.45 | 0.0 | 0.0 | 0.0 | false |
| 25 January 2024 | Charge-off | 101.17 | 100.0 | 1.17 | 0.0 | 0.0 | 0.0 | true |
@@ -1252,7 +1252,7 @@ Feature:Feature: Buy Down Fees
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 66.86 | 33.14 | 0.58 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 2 | 29 | 01 March 2024 | | 33.53 | 33.33 | 0.39 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 100.0 | 1.17 | 0.0 | 0.0 | 101.17 | 0.0 | 0.0 | 0.0 | 101.17 |
@@ -1297,10 +1297,10 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 31 January 2024 | Accrual | 0.56 | 0.0 | 0.56 | 0.0 | 0.0 | 0.0 | false |
| 31 January 2024 | Buy Down Fee Amortization | 17.03 | 0.0 | 17.03 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 February 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 March 2024 | Buy Down Fee Amortization | 41.49 | 0.0 | 41.49 | 0.0 | 0.0 | 0.0 | false |
| 01 March 2024 | Accrual | 0.6 | 0.0 | 0.6 | 0.0 | 0.0 | 0.0 | false |
| 01 March 2024 | Charge-off | 101.36 | 100.0 | 1.36 | 0.0 | 0.0 | 0.0 | false |
@@ -1367,7 +1367,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Repayment | 33.72 | 33.14 | 0.58 | 0.0 | 0.0 | 66.86 | false |
# --- BuyDownFee Adjustment trns on March,1 ---#
When Admin sets the business date to "1 March 2024"
@@ -1384,9 +1384,9 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Repayment | 33.72 | 33.14 | 0.58 | 0.0 | 0.0 | 66.86 | false |
| 01 March 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 66.86 | false |
| 01 March 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
And Loan Transactions tab has a "BUY_DOWN_FEE_ADJUSTMENT" transaction with date "01 March 2024" which has the following Journal entries:
| Type | Account code | Account name | Debit | Credit |
| EXPENSE | 450280 | Buy Down Expense | | 10.0 |
@@ -1401,9 +1401,9 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Repayment | 33.72 | 33.14 | 0.58 | 0.0 | 0.0 | 66.86 | false |
| 01 March 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 66.86 | false |
| 01 March 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 31 March 2024 | Accrual | 1.35 | 0.0 | 1.35 | 0.0 | 0.0 | 0.0 | false |
| 31 March 2024 | Buy Down Fee Amortization | 40.0 | 0.0 | 40.0 | 0.0 | 0.0 | 0.0 | false |
| 01 April 2024 | Repayment | 33.73 | 33.34 | 0.39 | 0.0 | 0.0 | 33.52 | false |
@@ -1416,9 +1416,9 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Repayment | 33.72 | 33.14 | 0.58 | 0.0 | 0.0 | 66.86 | false |
| 01 March 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 66.86 | false |
| 01 March 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 31 March 2024 | Accrual | 1.35 | 0.0 | 1.35 | 0.0 | 0.0 | 0.0 | false |
| 31 March 2024 | Buy Down Fee Amortization | 40.0 | 0.0 | 40.0 | 0.0 | 0.0 | 0.0 | false |
| 01 April 2024 | Repayment | 33.73 | 33.34 | 0.39 | 0.0 | 0.0 | 33.52 | false |
@@ -1441,7 +1441,7 @@ Feature:Feature: Buy Down Fees
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 66.86 | 33.14 | 0.58 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 2 | 29 | 01 March 2024 | | 33.53 | 33.33 | 0.39 | 0.0 | 0.0 | 33.72 | 0.0 | 0.0 | 0.0 | 33.72 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
| 3 | 31 | 01 April 2024 | | 0.0 | 33.53 | 0.2 | 0.0 | 0.0 | 33.73 | 0.0 | 0.0 | 0.0 | 33.73 |
And Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 100.0 | 1.17 | 0.0 | 0.0 | 101.17 | 0.0 | 0.0 | 0.0 | 101.17 |
@@ -1473,7 +1473,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Repayment | 33.72 | 33.14 | 0.58 | 0.0 | 0.0 | 66.86 | false |
# --- 1st BuyDownFee Adjustment trns on March,1 ---#
When Admin sets the business date to "1 March 2024"
@@ -1481,9 +1481,9 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Repayment | 33.72 | 33.14 | 0.58 | 0.0 | 0.0 | 66.86 | false |
| 01 March 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 66.86 | false |
| 01 March 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
And Loan Transactions tab has a "BUY_DOWN_FEE_ADJUSTMENT" transaction with date "01 March 2024" which has the following Journal entries:
| Type | Account code | Account name | Debit | Credit |
| EXPENSE | 450280 | Buy Down Expense | | 10.0 |
@@ -1497,10 +1497,10 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Repayment | 33.72 | 33.14 | 0.58 | 0.0 | 0.0 | 66.86 | false |
| 01 March 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 66.86 | false |
| 15 March 2024 | Buy Down Fee Adjustment | 5.0 | 0.0 | 0.0 | 0.0 | 0.0 | 66.86 | false |
| 01 March 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 15 March 2024 | Buy Down Fee Adjustment | 5.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
And Loan Transactions tab has a "BUY_DOWN_FEE_ADJUSTMENT" transaction with date "15 March 2024" which has the following Journal entries:
| Type | Account code | Account name | Debit | Credit |
| EXPENSE | 450280 | Buy Down Expense | | 5.0 |
@@ -1515,10 +1515,10 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Repayment | 33.72 | 33.14 | 0.58 | 0.0 | 0.0 | 66.86 | false |
| 01 March 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 66.86 | false |
| 15 March 2024 | Buy Down Fee Adjustment | 5.0 | 0.0 | 0.0 | 0.0 | 0.0 | 66.86 | false |
| 01 March 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 15 March 2024 | Buy Down Fee Adjustment | 5.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 31 March 2024 | Accrual | 1.35 | 0.0 | 1.35 | 0.0 | 0.0 | 0.0 | false |
| 31 March 2024 | Buy Down Fee Amortization | 35.0 | 0.0 | 35.0 | 0.0 | 0.0 | 0.0 | false |
| 01 April 2024 | Repayment | 33.73 | 33.34 | 0.39 | 0.0 | 0.0 | 33.52 | false |
@@ -1531,10 +1531,10 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Repayment | 33.72 | 33.14 | 0.58 | 0.0 | 0.0 | 66.86 | false |
| 01 March 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 66.86 | false |
| 15 March 2024 | Buy Down Fee Adjustment | 5.0 | 0.0 | 0.0 | 0.0 | 0.0 | 66.86 | false |
| 01 March 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 15 March 2024 | Buy Down Fee Adjustment | 5.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 31 March 2024 | Accrual | 1.35 | 0.0 | 1.35 | 0.0 | 0.0 | 0.0 | false |
| 31 March 2024 | Buy Down Fee Amortization | 35.0 | 0.0 | 35.0 | 0.0 | 0.0 | 0.0 | false |
| 01 April 2024 | Repayment | 33.73 | 33.34 | 0.39 | 0.0 | 0.0 | 33.52 | false |
@@ -1588,7 +1588,7 @@ Feature:Feature: Buy Down Fees
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 900.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false |
| 02 January 2024 | Buy Down Fee | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false |
| 02 January 2024 | Buy Down Fee | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Close (as written-off) | 910.52 | 900.0 | 10.52 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Buy Down Fee Amortization | 100.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | false |
And Loan Transactions tab has a "BUY_DOWN_FEE_AMORTIZATION" transaction with date "02 January 2024" which has the following Journal entries:
@@ -1648,7 +1648,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
@@ -1731,7 +1731,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
@@ -1871,7 +1871,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
@@ -1995,7 +1995,7 @@ Feature:Feature: Buy Down Fees
| 29 February 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 01 March 2024 | Repayment | 33.72 | 33.33 | 0.39 | 0.0 | 0.0 | 33.53 | false |
| 01 March 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 33.53 | false |
| 01 March 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false |
| 01 March 2024 | Buy Down Fee Amortization | 0.22 | 0.0 | 0.22 | 0.0 | 0.0 | 0.0 | false |
And Loan Transactions tab has a "BUY_DOWN_FEE_ADJUSTMENT" transaction with date "01 March 2024" which has the following Journal entries:
@@ -2012,7 +2012,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
@@ -2136,7 +2136,7 @@ Feature:Feature: Buy Down Fees
| 29 February 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 01 March 2024 | Repayment | 33.72 | 33.33 | 0.39 | 0.0 | 0.0 | 33.53 | false |
| 01 March 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 33.53 | true |
| 01 March 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | true |
| 01 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false |
| 01 March 2024 | Buy Down Fee Amortization | 0.22 | 0.0 | 0.22 | 0.0 | 0.0 | 0.0 | false |
| 02 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false |
@@ -2197,7 +2197,7 @@ Feature:Feature: Buy Down Fees
And Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 01 February 2024 | Repayment | 33.72 | 33.14 | 0.58 | 0.0 | 0.0 | 66.86 | false |
# --- Run COB to amortize Buy Down Fee ---#
@@ -2215,7 +2215,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
@@ -2286,7 +2286,7 @@ Feature:Feature: Buy Down Fees
| 03 February 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 04 February 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false |
| 04 February 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 05 February 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false |
| 05 February 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false |
| 05 February 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 06 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false |
| 06 February 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
@@ -2309,9 +2309,9 @@ Feature:Feature: Buy Down Fees
| 15 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false |
| 15 February 2024 | Buy Down Fee Amortization | 0.54 | 0.0 | 0.54 | 0.0 | 0.0 | 0.0 | false |
# --- Reverse Buy Down Fee transaction ---#
When Admin sets the business date to "15 February 2024"
# When Admin sets the business date to "15 February 2024"
When Customer undo "1"th "Buy Down Fee" transaction made on "01 January 2024"
When Admin sets the business date to "16 February 2024"
When Admin sets the business date to "17 February 2024"
And Admin runs inline COB job for Loan
Then Loan Repayment schedule has 3 periods, with the following data for periods:
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
@@ -2325,7 +2325,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | true |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | true |
| 01 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
@@ -2418,7 +2418,8 @@ Feature:Feature: Buy Down Fees
| 14 February 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 15 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false |
| 15 February 2024 | Buy Down Fee Amortization | 0.54 | 0.0 | 0.54 | 0.0 | 0.0 | 0.0 | false |
| 15 February 2024 | Buy Down Fee Amortization Adjustment | 25.27 | 0.0 | 25.27 | 0.0 | 0.0 | 0.0 | false |
| 16 February 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false |
| 16 February 2024 | Buy Down Fee Amortization Adjustment | 25.27 | 0.0 | 25.27 | 0.0 | 0.0 | 0.0 | false |
And Loan Transactions tab has a "BUY_DOWN_FEE" transaction with date "01 January 2024" which has the following Journal entries:
| Type | Account code | Account name | Debit | Credit |
| EXPENSE | 450280 | Buy Down Expense | 50.0 | |
@@ -2527,9 +2528,9 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 10 January 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 10 January 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
And Loan Transactions tab has a "BUY_DOWN_FEE_ADJUSTMENT" transaction with date "10 January 2024" which has the following Journal entries:
| Type | Account code | Account name | Debit | Credit |
| EXPENSE | 450280 | Buy Down Expense | | 10.0 |
@@ -2552,7 +2553,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false |
| 01 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
@@ -2570,7 +2571,7 @@ Feature:Feature: Buy Down Fees
| 08 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 09 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false |
| 09 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 10 January 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | true |
| 10 January 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | true |
| 10 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false |
| 10 January 2024 | Buy Down Fee Amortization | 0.54 | 0.0 | 0.54 | 0.0 | 0.0 | 0.0 | false |
And Loan Transactions tab has a "BUY_DOWN_FEE_ADJUSTMENT" transaction with date "10 January 2024" which has the following Journal entries:
@@ -2595,7 +2596,7 @@ Feature:Feature: Buy Down Fees
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | true |
| 01 January 2024 | Buy Down Fee | 50.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | true |
| 01 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false |
| 02 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
@@ -2613,7 +2614,7 @@ Feature:Feature: Buy Down Fees
| 08 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 09 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false |
| 09 January 2024 | Buy Down Fee Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false |
| 10 January 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | true |
| 10 January 2024 | Buy Down Fee Adjustment | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | true |
| 10 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false |
| 10 January 2024 | Buy Down Fee Amortization | 0.54 | 0.0 | 0.54 | 0.0 | 0.0 | 0.0 | false |
| 11 January 2024 | Buy Down Fee Amortization Adjustment | 5.49 | 0.0 | 5.49 | 0.0 | 0.0 | 0.0 | false |
@@ -20,11 +20,11 @@ package org.apache.fineract.infrastructure.event.business.domain.loan.transactio
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
public class LoanBuyDownFeeAdjustmentTransactionBusinessEvent extends LoanTransactionBusinessEvent {
public class LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent extends LoanTransactionBusinessEvent {
private static final String TYPE = "LoanBuyDownFeeAdjustmentTransactionBusinessEvent";
private static final String TYPE = "LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent";
public LoanBuyDownFeeAdjustmentTransactionBusinessEvent(LoanTransaction value) {
public LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent(LoanTransaction value) {
super(value);
}
@@ -20,11 +20,11 @@ package org.apache.fineract.infrastructure.event.business.domain.loan.transactio
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
public class LoanBuyDownFeeTransactionBusinessEvent extends LoanTransactionBusinessEvent {
public class LoanBuyDownFeeTransactionCreatedBusinessEvent extends LoanTransactionBusinessEvent {
private static final String TYPE = "LoanBuyDownFeeTransactionBusinessEvent";
private static final String TYPE = "LoanBuyDownFeeTransactionCreatedBusinessEvent";
public LoanBuyDownFeeTransactionBusinessEvent(LoanTransaction value) {
public LoanBuyDownFeeTransactionCreatedBusinessEvent(LoanTransaction value) {
super(value);
}
@@ -839,8 +839,8 @@ public class LoanTransaction extends AbstractAuditableWithUTCDateTimeCustom<Long
|| type == LoanTransactionType.WITHDRAW_TRANSFER || type == LoanTransactionType.CHARGE_OFF
|| type == LoanTransactionType.REAMORTIZE || type == LoanTransactionType.REAGE
|| type == LoanTransactionType.CAPITALIZED_INCOME_AMORTIZATION || type == LoanTransactionType.CONTRACT_TERMINATION
|| type == LoanTransactionType.CAPITALIZED_INCOME_AMORTIZATION_ADJUSTMENT
|| type == LoanTransactionType.BUY_DOWN_FEE_AMORTIZATION
|| type == LoanTransactionType.CAPITALIZED_INCOME_AMORTIZATION_ADJUSTMENT || type == LoanTransactionType.BUY_DOWN_FEE
|| type == LoanTransactionType.BUY_DOWN_FEE_ADJUSTMENT || type == LoanTransactionType.BUY_DOWN_FEE_AMORTIZATION
|| type == LoanTransactionType.BUY_DOWN_FEE_AMORTIZATION_ADJUSTMENT);
}
@@ -22,6 +22,7 @@ import java.util.List;
import org.apache.fineract.portfolio.loanaccount.domain.LoanBuyDownFeeBalance;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
public interface LoanBuyDownFeeBalanceRepository
extends JpaRepository<LoanBuyDownFeeBalance, Long>, JpaSpecificationExecutor<LoanBuyDownFeeBalance> {
@@ -30,4 +31,6 @@ public interface LoanBuyDownFeeBalanceRepository
LoanBuyDownFeeBalance findByLoanIdAndLoanTransactionId(Long loanId, Long transactionId);
@Query("SELECT lbdfb FROM LoanBuyDownFeeBalance lbdfb, LoanTransaction lt, LoanTransactionRelation ltr WHERE lt.loan.id = lbdfb.loan.id AND ltr.fromTransaction.id =:transactionId AND ltr.toTransaction.id=lt.id AND lbdfb.loanTransaction.id = lt.id")
LoanBuyDownFeeBalance findBalanceForAdjustment(Long transactionId);
}
@@ -18,10 +18,8 @@
*/
package org.apache.fineract.portfolio.loanaccount.service;
import java.util.Optional;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
import org.springframework.transaction.annotation.Transactional;
public interface BuyDownFeePlatformService {
@@ -31,7 +29,4 @@ public interface BuyDownFeePlatformService {
@Transactional
CommandProcessingResult buyDownFeeAdjustment(Long loanId, Long buyDownFeeTransactionId, JsonCommand command);
@Transactional
Optional<LoanTransaction> reverseBuyDownFee(LoanTransaction buyDownFeeTransaction);
}
@@ -32,12 +32,10 @@ import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
import org.apache.fineract.infrastructure.core.domain.ExternalId;
import org.apache.fineract.infrastructure.core.exception.GeneralPlatformDomainRuleException;
import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.infrastructure.core.service.ExternalIdFactory;
import org.apache.fineract.infrastructure.core.service.MathUtil;
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanBuyDownFeeAdjustmentTransactionBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanBuyDownFeeTransactionBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanBuyDownFeeTransactionCreatedBusinessEvent;
import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
import org.apache.fineract.organisation.monetary.domain.Money;
import org.apache.fineract.portfolio.client.domain.Client;
@@ -46,10 +44,8 @@ import org.apache.fineract.portfolio.group.domain.Group;
import org.apache.fineract.portfolio.group.exception.GroupNotActiveException;
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
import org.apache.fineract.portfolio.loanaccount.domain.LoanBuyDownFeeBalance;
import org.apache.fineract.portfolio.loanaccount.domain.LoanLifecycleStateMachine;
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRelation;
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRelationRepository;
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRelationTypeEnum;
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRepository;
import org.apache.fineract.portfolio.loanaccount.repository.LoanBuyDownFeeBalanceRepository;
@@ -70,11 +66,7 @@ public class BuyDownFeeWritePlatformServiceImpl implements BuyDownFeePlatformSer
private final NoteWritePlatformService noteWritePlatformService;
private final ExternalIdFactory externalIdFactory;
private final LoanBuyDownFeeBalanceRepository loanBuyDownFeeBalanceRepository;
private final ReprocessLoanTransactionsService reprocessLoanTransactionsService;
private final LoanBalanceService loanBalanceService;
private final LoanLifecycleStateMachine loanLifecycleStateMachine;
private final BusinessEventNotifierService businessEventNotifierService;
private final LoanTransactionRelationRepository loanTransactionRelationRepository;
@Transactional
@Override
@@ -111,9 +103,6 @@ public class BuyDownFeeWritePlatformServiceImpl implements BuyDownFeePlatformSer
// Create Buy Down Fee balance
createBuyDownFeeBalance(buyDownFeeTransaction);
// Update loan derived fields
loan.updateLoanScheduleDependentDerivedFields();
// Add note if provided
final String noteText = command.stringValueOfParameterNamed("note");
if (StringUtils.isNotBlank(noteText)) {
@@ -124,7 +113,7 @@ public class BuyDownFeeWritePlatformServiceImpl implements BuyDownFeePlatformSer
loanJournalEntryPoster.postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
// Notify business events
businessEventNotifierService.notifyPostBusinessEvent(new LoanBuyDownFeeTransactionBusinessEvent(buyDownFeeTransaction));
businessEventNotifierService.notifyPostBusinessEvent(new LoanBuyDownFeeTransactionCreatedBusinessEvent(buyDownFeeTransaction));
return new CommandProcessingResultBuilder() //
.withClientId(loan.getClientId()) //
@@ -171,9 +160,6 @@ public class BuyDownFeeWritePlatformServiceImpl implements BuyDownFeePlatformSer
// Add transaction to loan
loan.addLoanTransaction(buyDownFeeAdjustment);
// Recalculate loan transactions
recalculateLoanTransactions(loan, transactionDate, buyDownFeeAdjustment);
// Save transaction
LoanTransaction savedBuyDownFeeAdjustment = loanTransactionRepository.saveAndFlush(buyDownFeeAdjustment);
@@ -187,9 +173,6 @@ public class BuyDownFeeWritePlatformServiceImpl implements BuyDownFeePlatformSer
loanBuyDownFeeBalanceRepository.save(buydownFeeBalance);
}
// Update outstanding loan balances
loanBalanceService.updateLoanOutstandingBalances(loan);
// Create a note if provided
final String noteText = command.stringValueOfParameterNamed("note");
if (StringUtils.isNotBlank(noteText)) {
@@ -198,57 +181,15 @@ public class BuyDownFeeWritePlatformServiceImpl implements BuyDownFeePlatformSer
// Post journal entries
loanJournalEntryPoster.postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
// Determine loan lifecycle transition
loanLifecycleStateMachine.determineAndTransition(loan, transactionDate);
// Notify business events
businessEventNotifierService
.notifyPostBusinessEvent(new LoanBuyDownFeeAdjustmentTransactionBusinessEvent(savedBuyDownFeeAdjustment));
.notifyPostBusinessEvent(new LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent(savedBuyDownFeeAdjustment));
return new CommandProcessingResultBuilder().withEntityId(savedBuyDownFeeAdjustment.getId())
.withEntityExternalId(savedBuyDownFeeAdjustment.getExternalId()).withOfficeId(loan.getOfficeId())
.withClientId(loan.getClientId()).withLoanId(loan.getId()).build();
}
@Override
@Transactional
public Optional<LoanTransaction> reverseBuyDownFee(LoanTransaction buyDownFeeTransaction) {
LoanTransaction amortizationTransaction = null;
Loan loan = buyDownFeeTransaction.getLoan();
BigDecimal totalAmortizationAmount = BigDecimal.ZERO;
if (loanTransactionRelationRepository.hasLoanTransactionRelationsWithType(buyDownFeeTransaction,
LoanTransactionRelationTypeEnum.ADJUSTMENT)) {
throw new GeneralPlatformDomainRuleException(
"error.msg.loan.transaction.with.not.reversed.transaction.related", "Undo Loan Transaction: "
+ buyDownFeeTransaction.getId() + " is not allowed. Loan transaction has not reversed transaction related",
buyDownFeeTransaction.getId());
}
LoanBuyDownFeeBalance buydownFeeBalance = loanBuyDownFeeBalanceRepository
.findByLoanIdAndLoanTransactionId(buyDownFeeTransaction.getLoan().getId(), buyDownFeeTransaction.getId());
if (buydownFeeBalance != null) {
totalAmortizationAmount = buydownFeeBalance.getAmount().subtract(MathUtil.nullToZero(buydownFeeBalance.getAmountAdjustment())
.add(MathUtil.nullToZero(buydownFeeBalance.getUnrecognizedAmount())));
loanBuyDownFeeBalanceRepository.delete(buydownFeeBalance);
}
if (MathUtil.isGreaterThanZero(totalAmortizationAmount)) {
amortizationTransaction = LoanTransaction.buyDownFeeAmortizationAdjustment(loan,
Money.of(loan.getCurrency(), totalAmortizationAmount), DateUtils.getBusinessLocalDate(), externalIdFactory.create());
}
return (amortizationTransaction == null) ? Optional.empty() : Optional.of(amortizationTransaction);
}
private void recalculateLoanTransactions(Loan loan, LocalDate transactionDate, LoanTransaction transaction) {
if (loan.isInterestBearingAndInterestRecalculationEnabled() || DateUtils.isBeforeBusinessDate(transactionDate)) {
reprocessLoanTransactionsService.reprocessTransactions(loan);
} else {
reprocessLoanTransactionsService.processLatestTransaction(transaction, loan);
}
}
private void checkClientOrGroupActive(final Loan loan) {
final Client client = loan.client();
if (client != null && client.isNotActive()) {
@@ -23,8 +23,11 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.infrastructure.event.business.BusinessEventListener;
import org.apache.fineract.infrastructure.event.business.domain.loan.LoanAdjustTransactionBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.LoanBalanceChangedBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.LoanCloseBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanBuyDownFeeTransactionCreatedBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanChargeOffPostBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanChargeOffPreBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanUndoChargeOffBusinessEvent;
@@ -43,6 +46,12 @@ public class LoanBuyDownFeeAmortizationEventService {
@PostConstruct
public void addListeners() {
businessEventNotifierService.addPreBusinessEventListener(LoanCloseBusinessEvent.class, new LoanCloseListener());
businessEventNotifierService.addPostBusinessEventListener(LoanBuyDownFeeTransactionCreatedBusinessEvent.class,
new LoanBuyDownFeeTransactionListener());
businessEventNotifierService.addPostBusinessEventListener(LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent.class,
new LoanBuyDownFeeAdjustmentTransactionListener());
businessEventNotifierService.addPostBusinessEventListener(LoanAdjustTransactionBusinessEvent.class,
new LoanAdjustTransactionListener());
businessEventNotifierService.addPostBusinessEventListener(LoanBalanceChangedBusinessEvent.class, new LoanBalanceChangedListener());
businessEventNotifierService.addPostBusinessEventListener(LoanChargeOffPostBusinessEvent.class, new LoanChargeOffEventListener());
businessEventNotifierService.addPostBusinessEventListener(LoanUndoChargeOffBusinessEvent.class,
@@ -78,6 +87,52 @@ public class LoanBuyDownFeeAmortizationEventService {
}
}
private final class LoanBuyDownFeeTransactionListener implements BusinessEventListener<LoanBuyDownFeeTransactionCreatedBusinessEvent> {
@Override
public void onBusinessEvent(final LoanBuyDownFeeTransactionCreatedBusinessEvent event) {
final Loan loan = event.get().getLoan();
final LoanStatus status = loan.getStatus();
if (loan.getLoanProductRelatedDetail().isEnableBuyDownFee()
&& (status.isClosedObligationsMet() || status.isClosedWrittenOff() || status.isOverpaid())) {
log.debug("Loan buy down fee change on buy down fee amortization for closed loan {}", loan.getId());
loanBuyDownFeeAmortizationProcessingService.processBuyDownFeeAmortizationOnLoanClosure(loan, true);
}
}
}
private final class LoanBuyDownFeeAdjustmentTransactionListener
implements BusinessEventListener<LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent> {
@Override
public void onBusinessEvent(final LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent event) {
final Loan loan = event.get().getLoan();
final LoanStatus status = loan.getStatus();
if (loan.getLoanProductRelatedDetail().isEnableBuyDownFee()
&& (status.isClosedObligationsMet() || status.isClosedWrittenOff() || status.isOverpaid())) {
log.debug("Loan buy down fee change on buy down fee amortization for closed loan {}", loan.getId());
loanBuyDownFeeAmortizationProcessingService.processBuyDownFeeAmortizationOnLoanClosure(loan, true);
}
}
}
private final class LoanAdjustTransactionListener implements BusinessEventListener<LoanAdjustTransactionBusinessEvent> {
@Override
public void onBusinessEvent(final LoanAdjustTransactionBusinessEvent event) {
final LoanTransaction transactionToAdjust = event.get().getTransactionToAdjust();
final boolean isTransactionBuyDownFeeRelated = transactionToAdjust.isBuyDownFee()
|| transactionToAdjust.isBuyDownFeeAdjustment();
final Loan loan = transactionToAdjust.getLoan();
final LoanStatus status = loan.getStatus();
if (loan.getLoanProductRelatedDetail().isEnableBuyDownFee() && isTransactionBuyDownFeeRelated
&& (status.isClosedObligationsMet() || status.isClosedWrittenOff() || status.isOverpaid())) {
log.debug("Loan buy down fee change on buy down fee amortization for closed loan {}", loan.getId());
loanBuyDownFeeAmortizationProcessingService.processBuyDownFeeAmortizationOnLoanClosure(loan, true);
}
}
}
private final class LoanChargeOffEventListener implements BusinessEventListener<LoanChargeOffPostBusinessEvent> {
@Override
@@ -24,7 +24,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
@@ -37,9 +36,6 @@ import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.infrastructure.core.service.MathUtil;
import org.apache.fineract.infrastructure.event.business.domain.loan.LoanAdjustTransactionBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.LoanBalanceChangedBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanBuyDownFeeAdjustmentTransactionBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanBuyDownFeeAmortizationAdjustmentTransactionCreatedBusinessEvent;
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanBuyDownFeeTransactionBusinessEvent;
import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
import org.apache.fineract.organisation.monetary.domain.Money;
@@ -177,6 +173,31 @@ public class LoanAdjustmentServiceImpl implements LoanAdjustmentService {
capitalizedIncomeBalance
.setUnrecognizedAmount(capitalizedIncomeBalance.getUnrecognizedAmount().add(transactionToAdjust.getAmount()));
}
if (transactionToAdjust.isBuyDownFee()) {
if (newTransactionDetail.isNotZero()) {
throw new InvalidLoanTransactionTypeException("transaction", "buy.down.fee.cannot.be.adjusted",
"Buy down fee transaction cannot be adjusted");
}
LoanBuyDownFeeBalance buyDownFeeBalance = loanBuyDownFeeBalanceRepository.findByLoanIdAndLoanTransactionId(loan.getId(),
transactionToAdjust.getId());
if (MathUtil.isGreaterThanZero(buyDownFeeBalance.getAmountAdjustment())) {
throw new InvalidLoanTransactionTypeException("transaction", "buy.down.fee.cannot.be.reversed.when.adjusted",
"Buy down fee transaction cannot be reversed when non-reversed adjustment exists for it.");
}
loanBuyDownFeeBalanceRepository.delete(buyDownFeeBalance);
}
if (transactionToAdjust.isBuyDownFeeAdjustment()) {
if (newTransactionDetail.isNotZero()) {
throw new InvalidLoanTransactionTypeException("transaction", "buy.down.fee.adjustment.cannot.be.adjusted",
"Buy down fee adjustment transaction cannot be adjusted");
}
LoanBuyDownFeeBalance buyDownFeeBalance = loanBuyDownFeeBalanceRepository.findBalanceForAdjustment(transactionToAdjust.getId());
buyDownFeeBalance.setAmountAdjustment(buyDownFeeBalance.getAmountAdjustment().subtract(transactionToAdjust.getAmount()));
buyDownFeeBalance.setUnrecognizedAmount(buyDownFeeBalance.getUnrecognizedAmount().add(transactionToAdjust.getAmount()));
}
LocalDate recalculateFrom = null;
@@ -292,9 +313,9 @@ public class LoanAdjustmentServiceImpl implements LoanAdjustmentService {
&& transactionForAdjustment.isNotWaiver() && transactionForAdjustment.isNotCreditBalanceRefund()
&& !transactionForAdjustment.isDeferredIncome() && !transactionForAdjustment.isCapitalizedIncomeAdjustment()
&& !transactionForAdjustment.isBuyDownFeeAdjustment()) {
final String errorMessage = "Only (non-reversed) transactions of type repayment, waiver, accrual, credit balance refund, capitalized income, capitalized income adjustment or buy down fee adjustment can be adjusted.";
final String errorMessage = "Only (non-reversed) transactions of type repayment, waiver, accrual, credit balance refund, capitalized income, capitalized income adjustment, buy down fee or buy down fee adjustment can be adjusted.";
throw new InvalidLoanTransactionTypeException("transaction",
"adjustment.is.only.allowed.to.repayment.or.waiver.or.creditbalancerefund.or.capitalizedIncome.or.capitalizedIncomeAdjustment.or.buyDownFeeAdjustment.transactions",
"adjustment.is.only.allowed.to.repayment.or.waiver.or.creditbalancerefund.or.capitalizedIncome.or.capitalizedIncomeAdjustment.or.buyDownFee.or.buyDownFeeAdjustment.transactions",
errorMessage);
}
@@ -318,17 +339,6 @@ public class LoanAdjustmentServiceImpl implements LoanAdjustmentService {
LoanAdjustTransactionBusinessEvent.Data eventData = new LoanAdjustTransactionBusinessEvent.Data(loanTransaction);
businessEventNotifierService.notifyPostBusinessEvent(new LoanAdjustTransactionBusinessEvent(eventData));
});
} else if (transactionForAdjustment.isBuyDownFee()) {
Optional<LoanTransaction> optAmortizationAdjustmentTransaction = buyDownFeePlatformService
.reverseBuyDownFee(transactionForAdjustment);
if (optAmortizationAdjustmentTransaction.isPresent()) {
loan.addLoanTransaction(optAmortizationAdjustmentTransaction.get());
loanTransactionRepository.saveAndFlush(optAmortizationAdjustmentTransaction.get());
businessEventNotifierService
.notifyPostBusinessEvent(new LoanBuyDownFeeAmortizationAdjustmentTransactionCreatedBusinessEvent(
optAmortizationAdjustmentTransaction.get()));
}
businessEventNotifierService.notifyPostBusinessEvent(new LoanBuyDownFeeTransactionBusinessEvent(transactionForAdjustment));
}
if (loan.isClosedWrittenOff()) {
@@ -347,24 +357,6 @@ public class LoanAdjustmentServiceImpl implements LoanAdjustmentService {
if (transactionForAdjustment.getTypeOf().equals(LoanTransactionType.CAPITALIZED_INCOME)) {
reprocessLoanTransactionsService.reprocessTransactions(loan);
}
if (transactionForAdjustment.getTypeOf().equals(LoanTransactionType.BUY_DOWN_FEE_ADJUSTMENT)) {
// adjust buy down fee balance
final LoanTransaction originalBuyDownFeeTransaction = transactionForAdjustment.getLoanTransactionRelations().stream()
.filter(r -> r.getRelationType().equals(LoanTransactionRelationTypeEnum.ADJUSTMENT)).findFirst().get()
.getToTransaction();
final LoanBuyDownFeeBalance buyDownFeeBalance = loanBuyDownFeeBalanceRepository.findByLoanIdAndLoanTransactionId(loan.getId(),
originalBuyDownFeeTransaction.getId());
if (buyDownFeeBalance != null) {
buyDownFeeBalance.setAmountAdjustment(
MathUtil.nullToZero(buyDownFeeBalance.getAmountAdjustment()).subtract(transactionForAdjustment.getAmount()));
buyDownFeeBalance.setUnrecognizedAmount(
MathUtil.nullToZero(buyDownFeeBalance.getUnrecognizedAmount()).add(transactionForAdjustment.getAmount()));
loanBuyDownFeeBalanceRepository.save(buyDownFeeBalance);
}
businessEventNotifierService
.notifyPostBusinessEvent(new LoanBuyDownFeeAdjustmentTransactionBusinessEvent(transactionForAdjustment));
}
}
private Loan saveAndFlushLoanWithDataIntegrityViolationChecks(final Loan loan) {
@@ -395,14 +395,10 @@ public class LoanAccountConfiguration {
LoanAssembler loanAssembler, LoanTransactionRepository loanTransactionRepository,
PaymentDetailWritePlatformService paymentDetailWritePlatformService, LoanJournalEntryPoster loanJournalEntryPoster,
NoteWritePlatformService noteWritePlatformService, ExternalIdFactory externalIdFactory,
LoanBuyDownFeeBalanceRepository loanBuyDownFeeBalanceRepository,
ReprocessLoanTransactionsService reprocessLoanTransactionsService, LoanBalanceService loanBalanceService,
LoanLifecycleStateMachine loanLifecycleStateMachine, BusinessEventNotifierService businessEventNotifierService,
LoanTransactionRelationRepository loanTransactionRelationRepository) {
LoanBuyDownFeeBalanceRepository loanBuyDownFeeBalanceRepository, BusinessEventNotifierService businessEventNotifierService) {
return new BuyDownFeeWritePlatformServiceImpl(loanTransactionValidator, loanAssembler, loanTransactionRepository,
paymentDetailWritePlatformService, loanJournalEntryPoster, noteWritePlatformService, externalIdFactory,
loanBuyDownFeeBalanceRepository, reprocessLoanTransactionsService, loanBalanceService, loanLifecycleStateMachine,
businessEventNotifierService, loanTransactionRelationRepository);
loanBuyDownFeeBalanceRepository, businessEventNotifierService);
}
@Bean
@@ -211,5 +211,4 @@
<include file="parts/0190_buy_down_fee_amortization.xml" relativeToChangelogFile="true" />
<include file="parts/0191_add_LoanApprovedAmountChangedBusinessEvent.xml" relativeToChangelogFile="true" />
<include file="parts/0192_create_loan_approved_amount_history.xml" relativeToChangelogFile="true" />
<include file="parts/0193_buy_down_fee_events.xml" relativeToChangelogFile="true" />
</databaseChangeLog>
@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
<changeSet id="4" author="fineract">
<update tableName="m_external_event_configuration">
<column name="type" value="LoanBuyDownFeeTransactionBusinessEvent"/>
<where>type='LoanBuyDownFeeTransactionCreatedBusinessEvent'</where>
</update>
<update tableName="m_external_event_configuration">
<column name="type" value="LoanBuyDownFeeAdjustmentTransactionBusinessEvent"/>
<where>type='LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent'</where>
</update>
</changeSet>
</databaseChangeLog>
@@ -110,7 +110,7 @@ public class ExternalEventConfigurationValidationServiceTest {
"LoanCapitalizedIncomeAdjustmentTransactionCreatedBusinessEvent", "LoanTransactionContractTerminationPostBusinessEvent",
"LoanCapitalizedIncomeAmortizationAdjustmentTransactionCreatedBusinessEvent",
"LoanCapitalizedIncomeTransactionCreatedBusinessEvent", "LoanUndoContractTerminationBusinessEvent",
"LoanBuyDownFeeTransactionBusinessEvent", "LoanBuyDownFeeAdjustmentTransactionBusinessEvent",
"LoanBuyDownFeeTransactionCreatedBusinessEvent", "LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent",
"LoanBuyDownFeeAmortizationTransactionCreatedBusinessEvent",
"LoanBuyDownFeeAmortizationAdjustmentTransactionCreatedBusinessEvent", "LoanApprovedAmountChangedBusinessEvent");
@@ -204,7 +204,7 @@ public class ExternalEventConfigurationValidationServiceTest {
"LoanCapitalizedIncomeAdjustmentTransactionCreatedBusinessEvent", "LoanTransactionContractTerminationPostBusinessEvent",
"LoanCapitalizedIncomeAmortizationAdjustmentTransactionCreatedBusinessEvent",
"LoanCapitalizedIncomeTransactionCreatedBusinessEvent", "LoanUndoContractTerminationBusinessEvent",
"LoanBuyDownFeeTransactionBusinessEvent", "LoanBuyDownFeeAdjustmentTransactionBusinessEvent",
"LoanBuyDownFeeTransactionCreatedBusinessEvent", "LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent",
"LoanBuyDownFeeAmortizationTransactionCreatedBusinessEvent",
"LoanBuyDownFeeAmortizationAdjustmentTransactionCreatedBusinessEvent", "LoanApprovedAmountChangedBusinessEvent");
@@ -46,9 +46,9 @@ import org.apache.fineract.client.util.CallFailedRuntimeException;
import org.apache.fineract.integrationtests.common.BusinessStepHelper;
import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.Utils;
import org.apache.fineract.integrationtests.common.accounting.Account;
import org.apache.fineract.integrationtests.common.externalevents.BusinessEvent;
import org.apache.fineract.integrationtests.common.externalevents.ExternalEventHelper;
import org.apache.fineract.integrationtests.common.externalevents.LoanAdjustTransactionBusinessEvent;
import org.apache.fineract.integrationtests.common.externalevents.LoanTransactionMinimalBusinessEvent;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
@@ -64,28 +64,25 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
private Long clientId;
private Long loanId;
// Buy Down Fee accounts for accrual-based accounting
private final Account buyDownExpenseAccount = accountHelper.createExpenseAccount();
private final Account deferredIncomeLiabilityAccount = accountHelper.createLiabilityAccount();
// Additional receivable accounts required for accrual-based accounting
private final Account interestReceivableAccount = accountHelper.createAssetAccount();
private final Account feeReceivableAccount = accountHelper.createAssetAccount();
private final Account penaltyReceivableAccount = accountHelper.createAssetAccount();
@AfterAll
public static void teardown() {
ExternalEventHelper externalEventHelper = new ExternalEventHelper();
externalEventHelper.disableBusinessEvent("LoanBuyDownFeeTransactionBusinessEvent");
externalEventHelper.disableBusinessEvent("LoanBuyDownFeeAdjustmentTransactionBusinessEvent");
externalEventHelper.disableBusinessEvent("LoanAdjustTransactionBusinessEvent");
externalEventHelper.disableBusinessEvent("LoanBuyDownFeeTransactionCreatedBusinessEvent");
externalEventHelper.disableBusinessEvent("LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent");
externalEventHelper.disableBusinessEvent("LoanBuyDownFeeAmortizationTransactionCreatedBusinessEvent");
externalEventHelper.disableBusinessEvent("LoanBuyDownFeeAmortizationAdjustmentTransactionCreatedBusinessEvent");
}
@BeforeEach
public void beforeEach() {
externalEventHelper.enableBusinessEvent("LoanBuyDownFeeTransactionBusinessEvent");
externalEventHelper.enableBusinessEvent("LoanBuyDownFeeAdjustmentTransactionBusinessEvent");
new BusinessStepHelper().updateSteps("LOAN_CLOSE_OF_BUSINESS", "APPLY_CHARGE_TO_OVERDUE_LOANS", "LOAN_DELINQUENCY_CLASSIFICATION",
"CHECK_LOAN_REPAYMENT_DUE", "CHECK_LOAN_REPAYMENT_OVERDUE", "CHECK_DUE_INSTALLMENTS", "UPDATE_LOAN_ARREARS_AGING",
"ADD_PERIODIC_ACCRUAL_ENTRIES", "ACCRUAL_ACTIVITY_POSTING", "CAPITALIZED_INCOME_AMORTIZATION", "BUY_DOWN_FEE_AMORTIZATION",
"LOAN_INTEREST_RECALCULATION", "EXTERNAL_ASSET_OWNER_TRANSFER");
externalEventHelper.enableBusinessEvent("LoanAdjustTransactionBusinessEvent");
externalEventHelper.enableBusinessEvent("LoanBuyDownFeeTransactionCreatedBusinessEvent");
externalEventHelper.enableBusinessEvent("LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent");
externalEventHelper.enableBusinessEvent("LoanBuyDownFeeAmortizationTransactionCreatedBusinessEvent");
externalEventHelper.enableBusinessEvent("LoanBuyDownFeeAmortizationAdjustmentTransactionCreatedBusinessEvent");
runAt("01 September 2024", () -> {
@@ -113,7 +110,7 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
deleteAllExternalEvents();
// Create buy down fee transaction
Long buyDownFeeTransactionId = addBuyDownFeeForLoan(loanId, 500.0, "02 September 2024");
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeTransactionBusinessEvent", "02 September 2024"));
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeTransactionCreatedBusinessEvent", "02 September 2024"));
assertNotNull(buyDownFeeTransactionId);
@@ -149,7 +146,7 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
.transactionAmount(250.0).externalId(externalId).note(noteText));
assertNotNull(response.getResourceId());
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeTransactionBusinessEvent", "03 September 2024"));
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeTransactionCreatedBusinessEvent", "03 September 2024"));
// Verify transaction details
final GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(loanId);
@@ -171,12 +168,12 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
// Add first buy down fee
Long firstBuyDownFeeId = addBuyDownFeeForLoan(loanId, 200.0, "02 September 2024");
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeTransactionBusinessEvent", "04 September 2024"));
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeTransactionCreatedBusinessEvent", "04 September 2024"));
deleteAllExternalEvents();
// Add second buy down fee
Long secondBuyDownFeeId = addBuyDownFeeForLoan(loanId, 150.0, "04 September 2024");
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeTransactionBusinessEvent", "04 September 2024"));
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeTransactionCreatedBusinessEvent", "04 September 2024"));
assertNotNull(firstBuyDownFeeId);
assertNotNull(secondBuyDownFeeId);
@@ -288,14 +285,14 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
Long buyDownFeeTransactionId = addBuyDownFeeForLoan(loanId, 500.0, "06 September 2024");
assertNotNull(buyDownFeeTransactionId);
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeTransactionBusinessEvent", "06 September 2024"));
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeTransactionCreatedBusinessEvent", "06 September 2024"));
deleteAllExternalEvents();
// Create buy down fee adjustment (use same date as business date)
PostLoansLoanIdTransactionsResponse adjustmentResponse = loanTransactionHelper.buyDownFeeAdjustment(loanId,
buyDownFeeTransactionId, "06 September 2024", 100.0);
verifyBusinessEvents(new LoanTransactionMinimalBusinessEvent("LoanBuyDownFeeAdjustmentTransactionBusinessEvent",
verifyBusinessEvents(new LoanTransactionMinimalBusinessEvent("LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent",
"06 September 2024", 100.0, false));
assertNotNull(adjustmentResponse);
@@ -321,8 +318,8 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
deleteAllExternalEvents();
loanTransactionHelper.reverseLoanTransaction(loanId, adjustmentResponse.getResourceId(), "06 September 2024");
verifyBusinessEvents(new LoanTransactionMinimalBusinessEvent("LoanBuyDownFeeAdjustmentTransactionBusinessEvent",
"06 September 2024", 100.0, true));
verifyBusinessEvents(new LoanAdjustTransactionBusinessEvent("LoanAdjustTransactionBusinessEvent", "06 September 2024",
"loanTransactionType.buyDownFeeAdjustment", "2024-09-06"));
});
}
@@ -395,7 +392,7 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
Long buyDownFeeTransactionId = addBuyDownFeeForLoan(loanId, 600.0, "12 September 2024");
assertNotNull(buyDownFeeTransactionId);
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeTransactionBusinessEvent", "12 September 2024"));
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeTransactionCreatedBusinessEvent", "12 September 2024"));
deleteAllExternalEvents();
// First adjustment
@@ -403,7 +400,7 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
"12 September 2024", 100.0);
assertNotNull(adjustment1);
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeAdjustmentTransactionBusinessEvent", "12 September 2024"));
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent", "12 September 2024"));
deleteAllExternalEvents();
// Second adjustment
@@ -411,7 +408,7 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
"12 September 2024", 150.0);
assertNotNull(adjustment2);
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeAdjustmentTransactionBusinessEvent", "12 September 2024"));
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent", "12 September 2024"));
// Verify both adjustments are recorded
final GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(loanId);
@@ -444,7 +441,7 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
// Add initial buy down fee
Long buyDownFeeTransactionId = addBuyDownFeeForLoan(loanId, 350.0, "16 September 2024");
assertNotNull(buyDownFeeTransactionId);
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeTransactionBusinessEvent", "16 September 2024"));
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeTransactionCreatedBusinessEvent", "16 September 2024"));
deleteAllExternalEvents();
// Create adjustment with external ID
String adjustmentExternalId = UUID.randomUUID().toString();
@@ -457,7 +454,7 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
assertNotNull(adjustmentResponse);
assertEquals(adjustmentExternalId, adjustmentResponse.getResourceExternalId());
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeAdjustmentTransactionBusinessEvent", "16 September 2024"));
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent", "16 September 2024"));
// Verify adjustment transaction details
final GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(loanId);
@@ -490,11 +487,6 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
@Test
public void testBuyDownFeeDailyAmortization() {
new BusinessStepHelper().updateSteps("LOAN_CLOSE_OF_BUSINESS", "APPLY_CHARGE_TO_OVERDUE_LOANS", "LOAN_DELINQUENCY_CLASSIFICATION",
"CHECK_LOAN_REPAYMENT_DUE", "CHECK_LOAN_REPAYMENT_OVERDUE", "CHECK_DUE_INSTALLMENTS", "UPDATE_LOAN_ARREARS_AGING",
"ADD_PERIODIC_ACCRUAL_ENTRIES", "ACCRUAL_ACTIVITY_POSTING", "CAPITALIZED_INCOME_AMORTIZATION", "BUY_DOWN_FEE_AMORTIZATION",
"LOAN_INTEREST_RECALCULATION", "EXTERNAL_ASSET_OWNER_TRANSFER");
final AtomicReference<Long> loanIdRef = new AtomicReference<>();
final AtomicReference<Long> buyDownFeeTransactionIdIdRef = new AtomicReference<>();
@@ -518,7 +510,7 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
PostLoansLoanIdTransactionsResponse transactionsResponse = loanTransactionHelper.makeLoanBuyDownFee(loanId, "1 January 2024",
50.0);
buyDownFeeTransactionIdIdRef.set(transactionsResponse.getResourceId());
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeTransactionBusinessEvent", "01 January 2024"));
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeTransactionCreatedBusinessEvent", "01 January 2024"));
});
runAt("31 January 2024", () -> {
Long loanId = loanIdRef.get();
@@ -550,7 +542,7 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
deleteAllExternalEvents();
loanTransactionHelper.buyDownFeeAdjustment(loanId, buyDownFeeTransactionIdIdRef.get(), "1 February 2024", 10.0);
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeAdjustmentTransactionBusinessEvent", "01 February 2024"));
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent", "01 February 2024"));
});
runAt("2 February 2024", () -> {
Long loanId = loanIdRef.get();
@@ -572,7 +564,7 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
deleteAllExternalEvents();
loanTransactionHelper.buyDownFeeAdjustment(loanId, buyDownFeeTransactionIdIdRef.get(), "10 January 2024", 10.0);
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeAdjustmentTransactionBusinessEvent", "02 February 2024"));
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent", "02 February 2024"));
});
runAt("3 February 2024", () -> {
Long loanId = loanIdRef.get();
@@ -598,7 +590,7 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
deleteAllExternalEvents();
loanTransactionHelper.buyDownFeeAdjustment(loanId, buyDownFeeTransactionIdIdRef.get(), "03 February 2024", 20.0);
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeAdjustmentTransactionBusinessEvent", "03 February 2024"));
verifyBusinessEvents(new BusinessEvent("LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent", "03 February 2024"));
});
runAt("4 February 2024", () -> {
Long loanId = loanIdRef.get();
@@ -710,8 +702,8 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
Long buyDownFeeTransactionId = addBuyDownFeeForLoan(loanId, 400.0, "02 September 2024");
buyDownFeeTransactionIdRef.set(buyDownFeeTransactionId);
assertNotNull(buyDownFeeTransactionId);
verifyBusinessEvents(
new LoanTransactionMinimalBusinessEvent("LoanBuyDownFeeTransactionBusinessEvent", "02 September 2024", 400.0, false));
verifyBusinessEvents(new LoanTransactionMinimalBusinessEvent("LoanBuyDownFeeTransactionCreatedBusinessEvent",
"02 September 2024", 400.0, false));
});
runAt("10 September 2024", () -> {
deleteAllExternalEvents();
@@ -730,16 +722,18 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
Assertions.assertNotNull(transactionsResponse.getResourceId());
Assertions.assertEquals(transactionsResponse.getResourceId(), buyDownFeeTransactionId);
verifyBusinessEvents(
new LoanTransactionMinimalBusinessEvent("LoanBuyDownFeeAmortizationAdjustmentTransactionCreatedBusinessEvent",
"10 September 2024", 8.79, false),
new LoanTransactionMinimalBusinessEvent("LoanBuyDownFeeTransactionBusinessEvent", "10 September 2024", 400.0, true));
verifyBusinessEvents(new LoanAdjustTransactionBusinessEvent("LoanAdjustTransactionBusinessEvent", "10 September 2024",
"loanTransactionType.buyDownFee", "2024-09-02"));
});
runAt("11 September 2024", () -> {
executeInlineCOB(loanId);
verifyTransactions(loanId, //
transaction(1000.000000, "Disbursement", "01 September 2024", 1000.000000, 0, 0, 0, 0, 0, 0, false), //
transaction(400.000000, "Buy Down Fee", "02 September 2024", 0, 0, 0, 0, 0, 0, 0, true), //
transaction(2.220000, "Accrual", "09 September 2024", 0, 0, 2.220000, 0, 0, 0, 0, false), //
transaction(8.790000, "Buy Down Fee Amortization", "09 September 2024", 0, 0, 0, 8.790000, 0, 0, 0, false), //
transaction(0.28, "Accrual", "10 September 2024", 0, 0, 0.28, 0, 0, 0, 0, false), //
transaction(8.790000, "Buy Down Fee Amortization Adjustment", "10 September 2024", 0, 0, 0, 8.790000, 0, 0, 0, false) //
);
@@ -790,8 +784,8 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
assertNotNull(buyDownFeeTransactionId);
buyDownFeeTransactionIdIdRef.set(buyDownFeeTransactionId);
verifyBusinessEvents(
new LoanTransactionMinimalBusinessEvent("LoanBuyDownFeeTransactionBusinessEvent", "10 September 2024", 400.0, false));
verifyBusinessEvents(new LoanTransactionMinimalBusinessEvent("LoanBuyDownFeeTransactionCreatedBusinessEvent",
"10 September 2024", 400.0, false));
// Verify initial buy down fee accounting entries
verifyTRJournalEntries(buyDownFeeTransactionId, debit(buyDownExpenseAccount, 400.0),
@@ -818,10 +812,8 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
Assertions.assertNotNull(transactionsResponse.getResourceId());
Assertions.assertEquals(transactionsResponse.getResourceId(), buyDownFeeTransactionId);
verifyBusinessEvents(
new LoanTransactionMinimalBusinessEvent("LoanBuyDownFeeAmortizationAdjustmentTransactionCreatedBusinessEvent",
"23 September 2024", 14.61, false),
new LoanTransactionMinimalBusinessEvent("LoanBuyDownFeeTransactionBusinessEvent", "23 September 2024", 400.0, true));
verifyBusinessEvents(new LoanAdjustTransactionBusinessEvent("LoanAdjustTransactionBusinessEvent", "23 September 2024",
"loanTransactionType.buyDownFee", "2024-09-10"));
// Verify initial buy down fee reversed accounting entries
verifyTRJournalEntries(buyDownFeeTransactionId, debit(buyDownExpenseAccount, 400.0),
@@ -832,8 +824,7 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
transaction(1000.000000, "Disbursement", "01 September 2024", 1000.000000, 0, 0, 0, 0, 0, 0, false), //
transaction(400.000000, "Buy Down Fee", "10 September 2024", 0, 0, 0, 0, 0, 0, 0, true), //
transaction(5.830000, "Accrual", "22 September 2024", 0, 0, 5.830000, 0, 0, 0, 0, false), //
transaction(14.610000, "Buy Down Fee Amortization", "22 September 2024", 0, 0, 0, 14.610000, 0, 0, 0, false), //
transaction(14.610000, "Buy Down Fee Amortization Adjustment", "23 September 2024", 0, 0, 0, 14.610000, 0, 0, 0, false) //
transaction(14.610000, "Buy Down Fee Amortization", "22 September 2024", 0, 0, 0, 14.610000, 0, 0, 0, false) //
);
});
}
@@ -870,7 +861,7 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
.transactionDate("10 September 2024").note("Buy Down Fee reversed").transactionAmount(0.0)
.locale("en")));
assertEquals(403, exception.getResponse().code());
assertTrue(exception.getMessage().contains("loan.transaction.with.not.reversed.transaction.related"));
assertTrue(exception.getMessage().contains("buy.down.fee.cannot.be.reversed.when.adjusted"));
});
}
@@ -637,12 +637,12 @@ public class ExternalEventConfigurationHelper {
defaults.add(loanTransactionUndoContractTerminationBusinessEvent);
Map<String, Object> loanTransactionBuyDownFeePostBusinessEvent = new HashMap<>();
loanTransactionBuyDownFeePostBusinessEvent.put("type", "LoanBuyDownFeeTransactionBusinessEvent");
loanTransactionBuyDownFeePostBusinessEvent.put("type", "LoanBuyDownFeeTransactionCreatedBusinessEvent");
loanTransactionBuyDownFeePostBusinessEvent.put("enabled", false);
defaults.add(loanTransactionBuyDownFeePostBusinessEvent);
Map<String, Object> loanTransactionBuyDownFeeAdjustmentPostBusinessEvent = new HashMap<>();
loanTransactionBuyDownFeeAdjustmentPostBusinessEvent.put("type", "LoanBuyDownFeeAdjustmentTransactionBusinessEvent");
loanTransactionBuyDownFeeAdjustmentPostBusinessEvent.put("type", "LoanBuyDownFeeAdjustmentTransactionCreatedBusinessEvent");
loanTransactionBuyDownFeeAdjustmentPostBusinessEvent.put("enabled", false);
defaults.add(loanTransactionBuyDownFeeAdjustmentPostBusinessEvent);