FINERACT-2181: Accruals on accounts where charge adjustments and refunds are done on the same day causing duplicate journal entries
This commit is contained in:
committed by
Adam Saghy
parent
5649aa3ded
commit
496e37e3d4
+4
@@ -108,6 +108,10 @@ public class JournalEntriesStepDef extends AbstractStepDef {
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
List<List<String>> data = table.asLists();
|
||||
final int expectedCount = data.size() - 1;
|
||||
final int actualCount = journalLinesActualList.stream().mapToInt(List::size).sum();
|
||||
assertThat(actualCount).as("The number of journal entries for the transaction does not match the expected count! Expected: "
|
||||
+ expectedCount + ", Actual: " + actualCount).isEqualTo(expectedCount);
|
||||
for (int i = 1; i < data.size(); i++) {
|
||||
List<List<List<String>>> possibleActualValuesList = new ArrayList<>();
|
||||
List<String> expectedValues = data.get(i);
|
||||
|
||||
@@ -501,8 +501,6 @@ Feature: Loan
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 450.0 |
|
||||
| LIABILITY | 145023 | Suspense/Clearing account | 450.0 | |
|
||||
Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 100.0 |
|
||||
| LIABILITY | l1 | Overpayment account | | 200.0 |
|
||||
| LIABILITY | 145023 | Suspense/Clearing account | 300.0 | |
|
||||
@@ -544,8 +542,6 @@ Feature: Loan
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 450.0 |
|
||||
| LIABILITY | 145023 | Suspense/Clearing account | 450.0 | |
|
||||
Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 300.0 |
|
||||
| LIABILITY | 145023 | Suspense/Clearing account | 300.0 | |
|
||||
|
||||
@@ -686,8 +682,6 @@ Feature: Loan
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 450.0 |
|
||||
| LIABILITY | 145023 | Suspense/Clearing account | 450.0 | |
|
||||
Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 100.0 |
|
||||
| LIABILITY | l1 | Overpayment account | | 200.0 |
|
||||
| LIABILITY | 145023 | Suspense/Clearing account | 300.0 | |
|
||||
@@ -729,8 +723,6 @@ Feature: Loan
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 700.0 |
|
||||
| LIABILITY | 145023 | Suspense/Clearing account | 700.0 | |
|
||||
Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 300.0 |
|
||||
| LIABILITY | 145023 | Suspense/Clearing account | 300.0 | |
|
||||
|
||||
|
||||
+25
-1
@@ -1566,4 +1566,28 @@ Feature: LoanAccrualTransaction
|
||||
| 19 February 2025 | Repayment | 376.21 | 272.65 | 103.56 | 0.0 | 0.0 | 3477.35 | false | false |
|
||||
| 20 February 2025 | Merchant Issued Refund | 1881.05 | 1881.05 | 0.0 | 0.0 | 0.0 | 1596.3 | false | false |
|
||||
| 20 February 2025 | Accrual | 3.7 | 0.0 | 3.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 21 February 2025 | Accrual | 3.7 | 0.0 | 3.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 21 February 2025 | Accrual | 3.7 | 0.0 | 3.7 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
|
||||
@TestRailId:C3733
|
||||
Scenario: Accruals on accounts where charge adjustments and refunds are done on the same day should not cause duplicate journal entries
|
||||
When Admin sets the business date to "12 May 2025"
|
||||
And Admin creates a client with random data
|
||||
When Admin creates a fully customized loan with the following data:
|
||||
| LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy |
|
||||
| LP2_ADV_PYMNT_360_30_INTEREST_RECALCULATION_ZERO_INTEREST_CHARGE_OFF_ACCRUAL_ACTIVITY | 12 May 2025 | 50 | 12.19 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
|
||||
And Admin successfully approves the loan on "12 May 2025" with "50" amount and expected disbursement date on "12 May 2025"
|
||||
And Admin successfully disburse the loan on "12 May 2025" with "48.25" EUR transaction amount
|
||||
When Admin adds "LOAN_NSF_FEE" due date charge with "12 May 2025" due date and 1.30 EUR transaction amount
|
||||
And Admin makes a charge adjustment for the last "LOAN_NSF_FEE" type charge which is due on "12 May 2025" with 1.30 EUR transaction amount and externalId ""
|
||||
When Admin makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "12 May 2025" with 48.25 EUR transaction amount
|
||||
Then Loan Transactions tab has the following data:
|
||||
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance |
|
||||
| 12 May 2025 | Disbursement | 48.25 | 0.0 | 0.0 | 0.0 | 0.0 | 48.25 |
|
||||
| 12 May 2025 | Charge Adjustment | 1.3 | 0.0 | 0.0 | 0.0 | 1.3 | 48.25 |
|
||||
| 12 May 2025 | Payout Refund | 48.25 | 48.25 | 0.0 | 0.0 | 0.0 | 0.0 |
|
||||
| 12 May 2025 | Accrual | 1.3 | 0.0 | 0.0 | 0.0 | 1.3 | 0.0 |
|
||||
| 12 May 2025 | Accrual Activity | 1.3 | 0.0 | 0.0 | 0.0 | 1.3 | 0.0 |
|
||||
Then Loan Transactions tab has a "ACCRUAL" transaction with date "12 May 2025" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 1.3 | |
|
||||
| INCOME | 404007 | Fee Income | | 1.3 |
|
||||
@@ -37,8 +37,6 @@ Feature: Credit Balance Refund
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 500.0 |
|
||||
| LIABILITY | 145023 | Suspense/Clearing account | 500.0 | |
|
||||
Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 500.0 |
|
||||
| LIABILITY | l1 | Overpayment account | | 100.0 |
|
||||
| LIABILITY | 145023 | Suspense/Clearing account | 600.0 | |
|
||||
@@ -78,8 +76,6 @@ Feature: Credit Balance Refund
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 450.0 |
|
||||
| LIABILITY | 145023 | Suspense/Clearing account | 450.0 | |
|
||||
Then Loan Transactions tab has a "REPAYMENT" transaction with date "05 January 2023" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 100.0 |
|
||||
| LIABILITY | l1 | Overpayment account | | 200.0 |
|
||||
| LIABILITY | 145023 | Suspense/Clearing account | 300.0 | |
|
||||
@@ -1410,6 +1406,8 @@ Feature: Credit Balance Refund
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 100.0 |
|
||||
| LIABILITY | 145023 | Suspense/Clearing account | 100.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | 100.0 | |
|
||||
| LIABILITY | 145023 | Suspense/Clearing account | | 100.0 |
|
||||
Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "03 January 2024" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 750.0 |
|
||||
|
||||
@@ -350,14 +350,12 @@ Feature: LoanCharge
|
||||
| ASSET | 112601 | Loans Receivable | 1.0 | |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 2.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 3.0 |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | | 4.0 |
|
||||
| INCOME | 404007 | Fee Income | 4.0 | |
|
||||
Then Loan Transactions tab has a "ACCRUAL" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 9.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 9.0 |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | | 4.0 |
|
||||
| INCOME | 404007 | Fee Income | 4.0 | |
|
||||
# --- Backdated repayment with 507 EUR ---
|
||||
And Customer makes "AUTOPAY" repayment on "31 October 2022" with 507 EUR transaction amount
|
||||
Then Loan has 500 outstanding amount
|
||||
@@ -408,14 +406,12 @@ Feature: LoanCharge
|
||||
| ASSET | 112601 | Loans Receivable | 1.0 | |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 2.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 3.0 |
|
||||
| ASSET | 112601 | Loans Receivable | | 4.0 |
|
||||
| INCOME | 404007 | Fee Income | 4.0 | |
|
||||
Then Loan Transactions tab has a "ACCRUAL" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 9.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 9.0 |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 4.0 |
|
||||
| INCOME | 404007 | Fee Income | 4.0 | |
|
||||
# --- charge adjustment for nsf fee with 5 ---
|
||||
When Admin makes a charge adjustment for the last "LOAN_NSF_FEE" type charge which is due on "23 October 2022" with 5 EUR transaction amount and externalId ""
|
||||
Then Loan has 495 outstanding amount
|
||||
@@ -467,18 +463,14 @@ Feature: LoanCharge
|
||||
| ASSET | 112601 | Loans Receivable | 1.0 | |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 2.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 3.0 |
|
||||
| ASSET | 112601 | Loans Receivable | | 4.0 |
|
||||
| INCOME | 404007 | Fee Income | 4.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | | 5.0 |
|
||||
| INCOME | 404007 | Fee Income | 5.0 | |
|
||||
Then Loan Transactions tab has a "ACCRUAL" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 9.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 9.0 |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 4.0 |
|
||||
| INCOME | 404007 | Fee Income | 4.0 | |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 5.0 |
|
||||
| INCOME | 404007 | Fee Income | 5.0 | |
|
||||
# --- Backdated repayment with 494 EUR ---
|
||||
And Customer makes "AUTOPAY" repayment on "1 November 2022" with 494 EUR transaction amount
|
||||
Then Loan has 1 outstanding amount
|
||||
@@ -535,18 +527,14 @@ Feature: LoanCharge
|
||||
| ASSET | 112601 | Loans Receivable | 1.0 | |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 2.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 3.0 |
|
||||
| ASSET | 112601 | Loans Receivable | | 4.0 |
|
||||
| INCOME | 404007 | Fee Income | 4.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | | 5.0 |
|
||||
| INCOME | 404007 | Fee Income | 5.0 | |
|
||||
Then Loan Transactions tab has a "ACCRUAL" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 9.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 9.0 |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 4.0 |
|
||||
| INCOME | 404007 | Fee Income | 4.0 | |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 5.0 |
|
||||
| INCOME | 404007 | Fee Income | 5.0 | |
|
||||
# --- charge adjustment for snooze fee with 1 ---
|
||||
When Admin makes a charge adjustment for the last "LOAN_SNOOZE_FEE" type charge which is due on "27 October 2022" with 1 EUR transaction amount and externalId ""
|
||||
Then Loan status will be "CLOSED_OBLIGATIONS_MET"
|
||||
@@ -605,22 +593,16 @@ Feature: LoanCharge
|
||||
| ASSET | 112601 | Loans Receivable | 1.0 | |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 2.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 3.0 |
|
||||
| ASSET | 112601 | Loans Receivable | | 4.0 |
|
||||
| INCOME | 404007 | Fee Income | 4.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | | 5.0 |
|
||||
| INCOME | 404007 | Fee Income | 5.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| INCOME | 404007 | Fee Income | 1.0 | |
|
||||
Then Loan Transactions tab has a "ACCRUAL" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 9.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 9.0 |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 4.0 |
|
||||
| INCOME | 404007 | Fee Income | 4.0 | |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 5.0 |
|
||||
| INCOME | 404007 | Fee Income | 5.0 | |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| INCOME | 404007 | Fee Income | 1.0 | |
|
||||
# --- revert last charge adjustment (was amount 1) ---
|
||||
When Admin reverts the charge adjustment which was raised on "04 November 2022" with 1 EUR transaction amount
|
||||
Then Loan status will be "ACTIVE"
|
||||
@@ -679,24 +661,18 @@ Feature: LoanCharge
|
||||
| ASSET | 112601 | Loans Receivable | 1.0 | |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 2.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 3.0 |
|
||||
| ASSET | 112601 | Loans Receivable | | 4.0 |
|
||||
| INCOME | 404007 | Fee Income | 4.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | | 5.0 |
|
||||
| INCOME | 404007 | Fee Income | 5.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| INCOME | 404007 | Fee Income | 1.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | 1.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 1.0 |
|
||||
Then Loan Transactions tab has a "ACCRUAL" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 9.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 9.0 |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 4.0 |
|
||||
| INCOME | 404007 | Fee Income | 4.0 | |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 5.0 |
|
||||
| INCOME | 404007 | Fee Income | 5.0 | |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| INCOME | 404007 | Fee Income | 1.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | 1.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 1.0 |
|
||||
# --- charge adjustment for nsf fee with 1 ---
|
||||
When Admin makes a charge adjustment for the last "LOAN_NSF_FEE" type charge which is due on "23 October 2022" with 1 EUR transaction amount and externalId ""
|
||||
Then Loan status will be "CLOSED_OBLIGATIONS_MET"
|
||||
@@ -756,28 +732,20 @@ Feature: LoanCharge
|
||||
| ASSET | 112601 | Loans Receivable | 1.0 | |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 2.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 3.0 |
|
||||
| ASSET | 112601 | Loans Receivable | | 4.0 |
|
||||
| INCOME | 404007 | Fee Income | 4.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | | 5.0 |
|
||||
| INCOME | 404007 | Fee Income | 5.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| INCOME | 404007 | Fee Income | 1.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | 1.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 1.0 |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| INCOME | 404007 | Fee Income | 1.0 | |
|
||||
Then Loan Transactions tab has a "ACCRUAL" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 9.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 9.0 |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 4.0 |
|
||||
| INCOME | 404007 | Fee Income | 4.0 | |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 5.0 |
|
||||
| INCOME | 404007 | Fee Income | 5.0 | |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| INCOME | 404007 | Fee Income | 1.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | 1.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 1.0 |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| INCOME | 404007 | Fee Income | 1.0 | |
|
||||
# --- charge adjustment for nsf fee with 2 ---
|
||||
When Admin makes a charge adjustment for the last "LOAN_NSF_FEE" type charge which is due on "23 October 2022" with 2 EUR transaction amount and externalId ""
|
||||
Then Loan status will be "OVERPAID"
|
||||
@@ -831,39 +799,29 @@ Feature: LoanCharge
|
||||
| ASSET | 112601 | Loans Receivable | | 494.0 |
|
||||
| LIABILITY | 145023 | Suspense/Clearing account | 494.0 | |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | | 2.0 |
|
||||
| INCOME | 404007 | Fee Income | 3.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | 1.0 | |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 2.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 3.0 |
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | | 2.0 |
|
||||
| INCOME | 404007 | Fee Income | 3.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | 1.0 | |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 2.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 3.0 |
|
||||
| ASSET | 112601 | Loans Receivable | | 4.0 |
|
||||
| INCOME | 404007 | Fee Income | 4.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | | 5.0 |
|
||||
| INCOME | 404007 | Fee Income | 5.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| INCOME | 404007 | Fee Income | 1.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | 1.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 1.0 |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| INCOME | 404007 | Fee Income | 1.0 | |
|
||||
| LIABILITY | l1 | Overpayment account | | 2.0 |
|
||||
| INCOME | 404007 | Fee Income | 2.0 | |
|
||||
Then Loan Transactions tab has a "ACCRUAL" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 9.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 9.0 |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 4.0 |
|
||||
| INCOME | 404007 | Fee Income | 4.0 | |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 5.0 |
|
||||
| INCOME | 404007 | Fee Income | 5.0 | |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| INCOME | 404007 | Fee Income | 1.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | 1.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 1.0 |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| INCOME | 404007 | Fee Income | 1.0 | |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| LIABILITY | l1 | Overpayment account | | 2.0 |
|
||||
| INCOME | 404007 | Fee Income | 2.0 | |
|
||||
# --- revert last charge adjustment (was amount 2) ---
|
||||
When Admin reverts the charge adjustment which was raised on "04 November 2022" with 2 EUR transaction amount
|
||||
Then Loan status will be "CLOSED_OBLIGATIONS_MET"
|
||||
@@ -917,41 +875,31 @@ Feature: LoanCharge
|
||||
| ASSET | 112601 | Loans Receivable | | 494.0 |
|
||||
| LIABILITY | 145023 | Suspense/Clearing account | 494.0 | |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | | 2.0 |
|
||||
| INCOME | 404007 | Fee Income | 3.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | 1.0 | |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 2.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 3.0 |
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | | 2.0 |
|
||||
| INCOME | 404007 | Fee Income | 3.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | 1.0 | |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 2.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 3.0 |
|
||||
| ASSET | 112601 | Loans Receivable | | 4.0 |
|
||||
| INCOME | 404007 | Fee Income | 4.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | | 5.0 |
|
||||
| INCOME | 404007 | Fee Income | 5.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| INCOME | 404007 | Fee Income | 1.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | 1.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 1.0 |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| INCOME | 404007 | Fee Income | 1.0 | |
|
||||
| LIABILITY | l1 | Overpayment account | | 2.0 |
|
||||
| INCOME | 404007 | Fee Income | 2.0 | |
|
||||
| LIABILITY | l1 | Overpayment account | 2.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 2.0 |
|
||||
Then Loan Transactions tab has a "ACCRUAL" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 9.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 9.0 |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 4.0 |
|
||||
| INCOME | 404007 | Fee Income | 4.0 | |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 5.0 |
|
||||
| INCOME | 404007 | Fee Income | 5.0 | |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| INCOME | 404007 | Fee Income | 1.0 | |
|
||||
| ASSET | 112601 | Loans Receivable | 1.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 1.0 |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 1.0 |
|
||||
| INCOME | 404007 | Fee Income | 1.0 | |
|
||||
Then Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "04 November 2022" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| LIABILITY | l1 | Overpayment account | | 2.0 |
|
||||
| INCOME | 404007 | Fee Income | 2.0 | |
|
||||
| LIABILITY | l1 | Overpayment account | 2.0 | |
|
||||
| INCOME | 404007 | Fee Income | | 2.0 |
|
||||
|
||||
@TestRailId:C2532
|
||||
Scenario: Verify that charge can be added to loan on disbursement date (loan status is 'active')
|
||||
@@ -5386,8 +5334,9 @@ Feature: LoanCharge
|
||||
| 03 March 2024 | Repayment (at time of disbursement) | 5.0 | 0.0 | 0.0 | 5.0 | 0.0 | 167.05 | false | false |
|
||||
| 03 March 2024 | Accrual | 1.1 | 0.0 | 1.1 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
Then Loan Transactions tab has a "ACCRUAL" transaction with date "03 March 2024" which has the following Journal entries:
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 1.1 | |
|
||||
| INCOME | 404000 | Interest Income | | 1.1 |
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | 1.1 | |
|
||||
| INCOME | 404000 | Interest Income | | 1.1 |
|
||||
# Undo disbursement
|
||||
When Admin successfully undo disbursal
|
||||
Then Loan status has changed to "Approved"
|
||||
|
||||
-2
@@ -392,8 +392,6 @@ Feature: LoanInterestWaiver
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112601 | Loans Receivable | | 250.0 |
|
||||
| LIABILITY | 145023 | Suspense/Clearing account | 250.0 | |
|
||||
Then Loan Transactions tab has a "REPAYMENT" transaction with date "01 February 2024" which has the following Journal entries:
|
||||
| Type | Account code | Account name | Debit | Credit |
|
||||
| ASSET | 112603 | Interest/Fee Receivable | | 10.0 |
|
||||
| LIABILITY | 145023 | Suspense/Clearing account | 10.0 | |
|
||||
|
||||
|
||||
+2
-2
@@ -25,11 +25,11 @@ import org.springframework.lang.NonNull;
|
||||
|
||||
public interface LoanCapitalizedIncomeAmortizationProcessingService {
|
||||
|
||||
void processCapitalizedIncomeAmortizationOnLoanClosure(@NonNull Loan loan);
|
||||
void processCapitalizedIncomeAmortizationOnLoanClosure(@NonNull Loan loan, boolean addJournal);
|
||||
|
||||
void processCapitalizedIncomeAmortizationOnLoanChargeOff(@NonNull Loan loan, @NonNull LoanTransaction chargeOffTransaction);
|
||||
|
||||
void processCapitalizedIncomeAmortizationOnLoanUndoChargeOff(@NonNull LoanTransaction loanTransaction);
|
||||
|
||||
void processCapitalizedIncomeAmortizationTillDate(@NonNull Loan loan, @NonNull LocalDate tillDate);
|
||||
void processCapitalizedIncomeAmortizationTillDate(@NonNull Loan loan, @NonNull LocalDate tillDate, boolean addJournal);
|
||||
}
|
||||
|
||||
-2
@@ -29,7 +29,6 @@ import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.ExternalId;
|
||||
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.LoanBalanceChangedBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanTransactionDownPaymentPostBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanTransactionDownPaymentPreBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
|
||||
@@ -73,7 +72,6 @@ public class LoanDownPaymentHandlerServiceImpl implements LoanDownPaymentHandler
|
||||
if (downPaymentTransaction != null) {
|
||||
downPaymentTransaction = loanTransactionRepository.saveAndFlush(downPaymentTransaction);
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanTransactionDownPaymentPostBusinessEvent(downPaymentTransaction));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
}
|
||||
return downPaymentTransaction;
|
||||
}
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ public class CapitalizedIncomeAmortizationBusinessStep implements LoanCOBBusines
|
||||
public Loan execute(Loan loan) {
|
||||
LocalDate businessDate = DateUtils.getBusinessLocalDate();
|
||||
|
||||
loanCapitalizedIncomeAmortizationProcessingService.processCapitalizedIncomeAmortizationTillDate(loan, businessDate);
|
||||
loanCapitalizedIncomeAmortizationProcessingService.processCapitalizedIncomeAmortizationTillDate(loan, businessDate, true);
|
||||
|
||||
return loan;
|
||||
}
|
||||
|
||||
+11
-12
@@ -280,16 +280,15 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
|
||||
setLoanDelinquencyTag(loan, transactionDate);
|
||||
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds, isAccountTransfer, isLoanToLoanTransfer);
|
||||
loanAccrualTransactionBusinessEventService.raiseBusinessEventForAccrualTransactions(loan, existingTransactionIds);
|
||||
if (!repaymentTransactionType.isChargeRefund()) {
|
||||
LoanTransactionBusinessEvent transactionRepaymentEvent = getTransactionRepaymentTypeBusinessEvent(repaymentTransactionType,
|
||||
isRecoveryRepayment, newRepaymentTransaction);
|
||||
final LoanTransactionBusinessEvent transactionRepaymentEvent = getTransactionRepaymentTypeBusinessEvent(
|
||||
repaymentTransactionType, isRecoveryRepayment, newRepaymentTransaction);
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(transactionRepaymentEvent);
|
||||
}
|
||||
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds, isAccountTransfer, isLoanToLoanTransfer);
|
||||
loanAccrualTransactionBusinessEventService.raiseBusinessEventForAccrualTransactions(loan, existingTransactionIds);
|
||||
|
||||
// disable all active standing orders linked to this loan if status
|
||||
// changes to closed
|
||||
disableStandingInstructionsLinkedToClosedLoan(loan);
|
||||
@@ -434,11 +433,11 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
|
||||
loanAccrualsProcessingService.processAccrualsOnInterestRecalculation(loan, loan.isInterestBearingAndInterestRecalculationEnabled(),
|
||||
false);
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanChargePaymentPostBusinessEvent(newPaymentTransaction));
|
||||
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds, isAccountTransfer);
|
||||
loanAccrualTransactionBusinessEventService.raiseBusinessEventForAccrualTransactions(loan, existingTransactionIds);
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanChargePaymentPostBusinessEvent(newPaymentTransaction));
|
||||
return newPaymentTransaction;
|
||||
}
|
||||
|
||||
@@ -686,12 +685,12 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
|
||||
loanAccrualsProcessingService.processAccrualsOnInterestRecalculation(loan, loan.isInterestBearingAndInterestRecalculationEnabled(),
|
||||
false);
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
businessEventNotifierService
|
||||
.notifyPostBusinessEvent(new LoanCreditBalanceRefundPostBusinessEvent(newCreditBalanceRefundTransaction));
|
||||
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds, false);
|
||||
loanAccrualTransactionBusinessEventService.raiseBusinessEventForAccrualTransactions(loan, existingTransactionIds);
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
businessEventNotifierService
|
||||
.notifyPostBusinessEvent(new LoanCreditBalanceRefundPostBusinessEvent(newCreditBalanceRefundTransaction));
|
||||
|
||||
return newCreditBalanceRefundTransaction;
|
||||
}
|
||||
@@ -739,11 +738,11 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
|
||||
loanAccrualsProcessingService.processAccrualsOnInterestRecalculation(loan, loan.isInterestBearingAndInterestRecalculationEnabled(),
|
||||
false);
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanRefundPostBusinessEvent(newRefundTransaction));
|
||||
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds, false);
|
||||
loanAccrualTransactionBusinessEventService.raiseBusinessEventForAccrualTransactions(loan, existingTransactionIds);
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanRefundPostBusinessEvent(newRefundTransaction));
|
||||
|
||||
builderResult.withEntityId(newRefundTransaction.getId()).withOfficeId(loan.getOfficeId()).withClientId(loan.getClientId())
|
||||
.withGroupId(loan.getGroupId());
|
||||
|
||||
+1
-13
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.portfolio.loanaccount.service;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import java.util.Objects;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.infrastructure.event.business.BusinessEventListener;
|
||||
@@ -28,7 +27,6 @@ import org.apache.fineract.infrastructure.event.business.domain.loan.LoanCloseBu
|
||||
import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRelationTypeEnum;
|
||||
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@@ -66,19 +64,9 @@ public class LoanAccrualEventService {
|
||||
LoanStatus status = loan.getStatus();
|
||||
if (status.isClosedObligationsMet() || status.isOverpaid()) {
|
||||
log.debug("Loan balance change on accrual for loan {}", loan.getId());
|
||||
final boolean hasChargeAdjustment = hasChargeAdjustment(loan);
|
||||
loanAccrualsProcessingService.processAccrualsOnLoanClosure(loan, hasChargeAdjustment);
|
||||
loanAccrualsProcessingService.processAccrualsOnLoanClosure(loan, true);
|
||||
loanAccrualActivityProcessingService.processAccrualActivityForLoanClosure(loan);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasChargeAdjustment(final Loan loan) {
|
||||
return loan.getLoanTransactions().stream()
|
||||
.filter(transaction -> transaction.isChargeAdjustment() && transaction.isNotReversed())
|
||||
.anyMatch(chargeAdjustment -> chargeAdjustment.getLoanTransactionRelations().stream()
|
||||
.anyMatch(relation -> relation.getRelationType() == LoanTransactionRelationTypeEnum.CHARGE_ADJUSTMENT
|
||||
&& relation.getFromTransaction() != null
|
||||
&& Objects.equals(relation.getFromTransaction().getId(), chargeAdjustment.getId())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -59,7 +59,7 @@ public class LoanCapitalizedIncomeAmortizationEventService {
|
||||
if (loan.getLoanProductRelatedDetail().isEnableIncomeCapitalization()
|
||||
&& (status.isClosedObligationsMet() || status.isClosedWrittenOff() || status.isOverpaid())) {
|
||||
log.debug("Loan closure on capitalized income amortization for loan {}", loan.getId());
|
||||
loanCapitalizedIncomeAmortizationProcessingService.processCapitalizedIncomeAmortizationOnLoanClosure(loan);
|
||||
loanCapitalizedIncomeAmortizationProcessingService.processCapitalizedIncomeAmortizationOnLoanClosure(loan, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class LoanCapitalizedIncomeAmortizationEventService {
|
||||
if (loan.getLoanProductRelatedDetail().isEnableIncomeCapitalization()
|
||||
&& (status.isClosedObligationsMet() || status.isClosedWrittenOff() || status.isOverpaid())) {
|
||||
log.debug("Loan balance change on capitalized income amortization for loan {}", loan.getId());
|
||||
loanCapitalizedIncomeAmortizationProcessingService.processCapitalizedIncomeAmortizationOnLoanClosure(loan);
|
||||
loanCapitalizedIncomeAmortizationProcessingService.processCapitalizedIncomeAmortizationOnLoanClosure(loan, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public class LoanCapitalizedIncomeAmortizationEventService {
|
||||
if (loan.getLoanProductRelatedDetail().isEnableIncomeCapitalization()) {
|
||||
log.debug("Loan pre charge-off capitalized income amortization for loan {}", loan.getId());
|
||||
loanCapitalizedIncomeAmortizationProcessingService.processCapitalizedIncomeAmortizationTillDate(loan,
|
||||
DateUtils.getBusinessLocalDate());
|
||||
DateUtils.getBusinessLocalDate(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+18
-3
@@ -20,6 +20,7 @@ package org.apache.fineract.portfolio.loanaccount.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -60,7 +61,14 @@ public class LoanCapitalizedIncomeAmortizationProcessingServiceImpl implements L
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void processCapitalizedIncomeAmortizationOnLoanClosure(@NotNull final Loan loan) {
|
||||
public void processCapitalizedIncomeAmortizationOnLoanClosure(@NotNull final Loan loan, final boolean addJournal) {
|
||||
List<Long> existingTransactionIds = Collections.emptyList();
|
||||
List<Long> existingReversedTransactionIds = Collections.emptyList();
|
||||
if (addJournal) {
|
||||
existingTransactionIds = loanTransactionRepository.findTransactionIdsByLoan(loan);
|
||||
existingReversedTransactionIds = loanTransactionRepository.findReversedTransactionIdsByLoan(loan);
|
||||
}
|
||||
|
||||
final LocalDate transactionDate = getFinalCapitalizedIncomeAmortizationTransactionDate(loan);
|
||||
final Optional<LoanTransaction> amortizationTransaction = createCapitalizedIncomeAmortizationTransaction(loan, transactionDate,
|
||||
false, null);
|
||||
@@ -73,6 +81,10 @@ public class LoanCapitalizedIncomeAmortizationProcessingServiceImpl implements L
|
||||
new LoanCapitalizedIncomeAmortizationAdjustmentTransactionCreatedBusinessEvent(loanTransaction));
|
||||
}
|
||||
});
|
||||
|
||||
if (addJournal) {
|
||||
journalEntryPoster.postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -175,7 +187,8 @@ public class LoanCapitalizedIncomeAmortizationProcessingServiceImpl implements L
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void processCapitalizedIncomeAmortizationTillDate(@NonNull Loan loan, @NonNull LocalDate tillDate) {
|
||||
public void processCapitalizedIncomeAmortizationTillDate(@NonNull final Loan loan, @NonNull final LocalDate tillDate,
|
||||
final boolean addJournal) {
|
||||
final List<Long> existingTransactionIds = loanTransactionRepository.findTransactionIdsByLoan(loan);
|
||||
final List<Long> existingReversedTransactionIds = loanTransactionRepository.findReversedTransactionIdsByLoan(loan);
|
||||
|
||||
@@ -215,7 +228,9 @@ public class LoanCapitalizedIncomeAmortizationProcessingServiceImpl implements L
|
||||
transaction = loanTransactionRepository.save(transaction);
|
||||
loanTransactionRepository.flush();
|
||||
|
||||
journalEntryPoster.postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
if (addJournal) {
|
||||
journalEntryPoster.postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
}
|
||||
|
||||
BusinessEvent<?> event = MathUtil.isGreaterThanZero(totalAmortizationAmount)
|
||||
? new LoanCapitalizedIncomeAmortizationTransactionCreatedBusinessEvent(transaction)
|
||||
|
||||
+1
-1
@@ -318,10 +318,10 @@ public class LoanChargeWritePlatformServiceImpl implements LoanChargeWritePlatfo
|
||||
this.loanAccountDomainService.setLoanDelinquencyTag(loan, DateUtils.getBusinessLocalDate());
|
||||
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanAddChargeBusinessEvent(loanCharge));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
|
||||
postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
loanAccrualTransactionBusinessEventService.raiseBusinessEventForAccrualTransactions(loan, existingTransactionIds);
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
|
||||
return new CommandProcessingResultBuilder().withCommandId(command.commandId()) //
|
||||
.withEntityId(loanCharge.getId()) //
|
||||
|
||||
+11
-13
@@ -524,6 +524,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
|
||||
journalEntryPoster.postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
loanAccrualTransactionBusinessEventService.raiseBusinessEventForAccrualTransactions(loan, existingTransactionIds);
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
@@ -1073,14 +1074,13 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
loanAccountDomainService.updateAndSaveLoanCollateralTransactionsForIndividualAccounts(loan, newInterestPaymentWaiverTransaction);
|
||||
|
||||
// Finished Notification
|
||||
|
||||
LoanTransactionBusinessEvent transactionRepaymentEvent = new LoanTransactionInterestPaymentWaiverPostBusinessEvent(
|
||||
final LoanTransactionBusinessEvent transactionRepaymentEvent = new LoanTransactionInterestPaymentWaiverPostBusinessEvent(
|
||||
newInterestPaymentWaiverTransaction);
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(transactionRepaymentEvent);
|
||||
|
||||
journalEntryPoster.postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
loanAccrualTransactionBusinessEventService.raiseBusinessEventForAccrualTransactions(loan, existingTransactionIds);
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(transactionRepaymentEvent);
|
||||
|
||||
return new CommandProcessingResultBuilder().withCommandId(command.commandId()) //
|
||||
.withLoanId(loan.getId()) //
|
||||
@@ -1457,11 +1457,10 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
false);
|
||||
loanAccountDomainService.setLoanDelinquencyTag(loan, DateUtils.getBusinessLocalDate());
|
||||
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanWaiveInterestBusinessEvent(waiveInterestTransaction));
|
||||
|
||||
journalEntryPoster.postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
loanAccrualTransactionBusinessEventService.raiseBusinessEventForAccrualTransactions(loan, existingTransactionIds);
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanWaiveInterestBusinessEvent(waiveInterestTransaction));
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(waiveInterestTransaction.getId()) //
|
||||
@@ -1551,11 +1550,11 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
loanAccrualsProcessingService.processAccrualsOnInterestRecalculation(loan,
|
||||
loan.isInterestBearingAndInterestRecalculationEnabled(), false);
|
||||
loanAccountDomainService.setLoanDelinquencyTag(loan, DateUtils.getBusinessLocalDate());
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanWrittenOffPostBusinessEvent(loanTransaction));
|
||||
|
||||
journalEntryPoster.postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
loanAccrualTransactionBusinessEventService.raiseBusinessEventForAccrualTransactions(loan, existingTransactionIds);
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanWrittenOffPostBusinessEvent(loanTransaction));
|
||||
|
||||
builder.withEntityId(loanTransaction.getId()).withEntityExternalId(loanTransaction.getExternalId());
|
||||
}
|
||||
@@ -2215,13 +2214,12 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
loanAccrualsProcessingService.processAccrualsOnInterestRecalculation(loan, loan.isInterestBearingAndInterestRecalculationEnabled(),
|
||||
false);
|
||||
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanUndoWrittenOffBusinessEvent(writeOffTransaction));
|
||||
|
||||
this.loanAccountDomainService.setLoanDelinquencyTag(loan, DateUtils.getBusinessLocalDate());
|
||||
|
||||
journalEntryPoster.postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
loanAccrualTransactionBusinessEventService.raiseBusinessEventForAccrualTransactions(loan, existingTransactionIds);
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanUndoWrittenOffBusinessEvent(writeOffTransaction));
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withOfficeId(loan.getOfficeId()) //
|
||||
@@ -2987,11 +2985,11 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
// Raise business events
|
||||
loanAccrualsProcessingService.processAccrualsOnInterestRecalculation(loan, loan.isInterestBearingAndInterestRecalculationEnabled(),
|
||||
false);
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
|
||||
// Create journal entries for the new transaction(s)
|
||||
journalEntryPoster.postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
loanAccrualTransactionBusinessEventService.raiseBusinessEventForAccrualTransactions(loan, existingTransactionIds);
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
|
||||
Long entityId = refundTransaction.getId();
|
||||
ExternalId entityExternalId = refundTransaction.getExternalId();
|
||||
|
||||
+2
-2
@@ -255,11 +255,11 @@ public class LoanAdjustmentServiceImpl implements LoanAdjustmentService {
|
||||
entityId = newTransactionDetail.getId();
|
||||
entityExternalId = newTransactionDetail.getExternalId();
|
||||
}
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanAdjustTransactionBusinessEvent(eventData));
|
||||
|
||||
journalEntryPoster.postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds);
|
||||
loanAccrualTransactionBusinessEventService.raiseBusinessEventForAccrualTransactions(loan, existingTransactionIds);
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanAdjustTransactionBusinessEvent(eventData));
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(commandId) //
|
||||
|
||||
-1
@@ -198,7 +198,6 @@ public class LoanDownPaymentHandlerServiceImplTest {
|
||||
.notifyPreBusinessEvent(Mockito.any(LoanTransactionDownPaymentPreBusinessEvent.class));
|
||||
verify(businessEventNotifierService, Mockito.times(1))
|
||||
.notifyPostBusinessEvent(Mockito.any(LoanTransactionDownPaymentPostBusinessEvent.class));
|
||||
verify(businessEventNotifierService, Mockito.times(1)).notifyPostBusinessEvent(Mockito.any(LoanBalanceChangedBusinessEvent.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user