From c6a206a634a4eee42e4e26c8b2490f591cc2695d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Soma=20S=C3=B6r=C3=B6s?= Date: Wed, 22 Jul 2026 10:50:58 +0200 Subject: [PATCH 1/2] FINERACT-2455: Working Capital - Charge Adjustment Accounting Entries --- .../WorkingCapitalLoanChargeAccrual.feature | 58 +- ...italLoanChargeAdjustmentAccounting.feature | 654 ++++++++++++++++++ ...kingCapitalTransactionReprocessing.feature | 45 +- .../domain/WorkingCapitalLoanTransaction.java | 7 +- ...ngCapitalLoanAllocationRequestFactory.java | 27 - ...orkingCapitalLoanTransactionProcessor.java | 23 +- 6 files changed, 720 insertions(+), 94 deletions(-) create mode 100644 fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalLoanChargeAdjustmentAccounting.feature diff --git a/fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalLoanChargeAccrual.feature b/fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalLoanChargeAccrual.feature index 22fa5edc83b..ef567524b15 100644 --- a/fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalLoanChargeAccrual.feature +++ b/fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalLoanChargeAccrual.feature @@ -205,20 +205,20 @@ Feature: Working Capital Loan Charge Accrual Then Working Capital Loan has transactions: | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | | 01 July 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | - | 10 July 2026 | Charge Adjustment | 100.0 | 0.0 | 100.0 | 0.0 | false | + | 10 July 2026 | Charge Adjustment | 100.0 | 100.0 | 0.0 | 0.0 | false | And Working Capital Loan charge balances has the following data: | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | - | 100.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | And Working Capital Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "10 July 2026" which has the following Journal entries: - | Type | Account code | Account name | Debit | Credit | - | INCOME | 404007 | Fee Income | 100.0 | | - | ASSET | 112603 | Interest/Fee Receivable | | 100.0 | + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 100.0 | | + | ASSET | 112601 | Loans Receivable | | 100.0 | When Admin sets the business date to "16 July 2026" And Admin runs inline COB job for Working Capital Loan by loanId Then Working Capital Loan has transactions: | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | | 01 July 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | - | 10 July 2026 | Charge Adjustment | 100.0 | 0.0 | 100.0 | 0.0 | false | + | 10 July 2026 | Charge Adjustment | 100.0 | 100.0 | 0.0 | 0.0 | false | | 15 July 2026 | Accrual | 100.0 | 0.0 | 100.0 | 0.0 | false | And Working Capital Loan Transactions tab has a "ACCRUAL" transaction with date "15 July 2026" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | @@ -241,20 +241,20 @@ Feature: Working Capital Loan Charge Accrual Then Working Capital Loan has transactions: | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | | 01 August 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | - | 10 August 2026 | Charge Adjustment | 50.0 | 0.0 | 0.0 | 50.0 | false | + | 10 August 2026 | Charge Adjustment | 50.0 | 50.0 | 0.0 | 0.0 | false | And Working Capital Loan charge balances has the following data: | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | - | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 50.0 | + | 0.0 | 0.0 | 0.0 | 50.0 | 50.0 | 0.0 | And Working Capital Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "10 August 2026" which has the following Journal entries: - | Type | Account code | Account name | Debit | Credit | - | INCOME | 404007 | Fee Income | 50.0 | | - | ASSET | 112603 | Interest/Fee Receivable | | 50.0 | + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 50.0 | | + | ASSET | 112601 | Loans Receivable | | 50.0 | When Admin sets the business date to "16 August 2026" And Admin runs inline COB job for Working Capital Loan by loanId Then Working Capital Loan has transactions: | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | | 01 August 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | - | 10 August 2026 | Charge Adjustment | 50.0 | 0.0 | 0.0 | 50.0 | false | + | 10 August 2026 | Charge Adjustment | 50.0 | 50.0 | 0.0 | 0.0 | false | | 15 August 2026 | Accrual | 50.0 | 0.0 | 0.0 | 50.0 | false | And Working Capital Loan Transactions tab has a "ACCRUAL" transaction with date "15 August 2026" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | @@ -277,20 +277,20 @@ Feature: Working Capital Loan Charge Accrual Then Working Capital Loan has transactions: | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | | 01 November 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | - | 10 November 2026 | Charge Adjustment | 40.0 | 0.0 | 40.0 | 0.0 | false | + | 10 November 2026 | Charge Adjustment | 40.0 | 40.0 | 0.0 | 0.0 | false | And Working Capital Loan charge balances has the following data: | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | - | 100.0 | 60.0 | 40.0 | 0.0 | 0.0 | 0.0 | + | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | And Working Capital Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "10 November 2026" which has the following Journal entries: - | Type | Account code | Account name | Debit | Credit | - | INCOME | 404007 | Fee Income | 40.0 | | - | ASSET | 112603 | Interest/Fee Receivable | | 40.0 | + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 40.0 | | + | ASSET | 112601 | Loans Receivable | | 40.0 | When Admin sets the business date to "16 November 2026" And Admin runs inline COB job for Working Capital Loan by loanId Then Working Capital Loan has transactions: | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | | 01 November 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | - | 10 November 2026 | Charge Adjustment | 40.0 | 0.0 | 40.0 | 0.0 | false | + | 10 November 2026 | Charge Adjustment | 40.0 | 40.0 | 0.0 | 0.0 | false | | 15 November 2026 | Accrual | 100.0 | 0.0 | 100.0 | 0.0 | false | And Working Capital Loan Transactions tab has a "ACCRUAL" transaction with date "15 November 2026" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | @@ -313,20 +313,20 @@ Feature: Working Capital Loan Charge Accrual Then Working Capital Loan has transactions: | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | | 01 December 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | - | 10 December 2026 | Charge Adjustment | 25.0 | 0.0 | 0.0 | 25.0 | false | + | 10 December 2026 | Charge Adjustment | 25.0 | 25.0 | 0.0 | 0.0 | false | And Working Capital Loan charge balances has the following data: | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | - | 0.0 | 0.0 | 0.0 | 60.0 | 35.0 | 25.0 | + | 0.0 | 0.0 | 0.0 | 60.0 | 60.0 | 0.0 | And Working Capital Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "10 December 2026" which has the following Journal entries: - | Type | Account code | Account name | Debit | Credit | - | INCOME | 404007 | Fee Income | 25.0 | | - | ASSET | 112603 | Interest/Fee Receivable | | 25.0 | + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 25.0 | | + | ASSET | 112601 | Loans Receivable | | 25.0 | When Admin sets the business date to "16 December 2026" And Admin runs inline COB job for Working Capital Loan by loanId Then Working Capital Loan has transactions: | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | | 01 December 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | - | 10 December 2026 | Charge Adjustment | 25.0 | 0.0 | 0.0 | 25.0 | false | + | 10 December 2026 | Charge Adjustment | 25.0 | 25.0 | 0.0 | 0.0 | false | | 15 December 2026 | Accrual | 60.0 | 0.0 | 0.0 | 60.0 | false | And Working Capital Loan Transactions tab has a "ACCRUAL" transaction with date "15 December 2026" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | @@ -463,18 +463,18 @@ Feature: Working Capital Loan Charge Accrual | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | | 01 September 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | | 10 September 2026 | Accrual | 100.0 | 0.0 | 100.0 | 0.0 | false | - | 10 September 2026 | Charge Adjustment | 100.0 | 0.0 | 100.0 | 0.0 | false | + | 10 September 2026 | Charge Adjustment | 100.0 | 100.0 | 0.0 | 0.0 | false | And Working Capital Loan charge balances has the following data: | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | - | 100.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | + | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | And Working Capital Loan Transactions tab has a "ACCRUAL" transaction with date "10 September 2026" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | ASSET | 112603 | Interest/Fee Receivable | 100.0 | | | INCOME | 404007 | Fee Income | | 100.0 | And Working Capital Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "10 September 2026" which has the following Journal entries: - | Type | Account code | Account name | Debit | Credit | - | INCOME | 404007 | Fee Income | 100.0 | | - | ASSET | 112603 | Interest/Fee Receivable | | 100.0 | + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 100.0 | | + | ASSET | 112601 | Loans Receivable | | 100.0 | And Admin sets the business date to "25 September 2026" When Global config "charge-accrual-date" value set to "due-date" Then Admin closes the Working Capital loan with a full repayment on "25 September 2026" diff --git a/fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalLoanChargeAdjustmentAccounting.feature b/fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalLoanChargeAdjustmentAccounting.feature new file mode 100644 index 00000000000..1fc004f88c6 --- /dev/null +++ b/fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalLoanChargeAdjustmentAccounting.feature @@ -0,0 +1,654 @@ +@WorkingCapital +@WorkingCapitalLoanChargeAdjustmentAccountingFeature +Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature + + @TestRailId:TODO_1 + Scenario: Verify Working Capital fee charge adjustment accounting entries - UC1: full fee charge adjustment has correct journal entries + Given Admin sets the business date to "01 January 2026" + And Admin creates a client with random data and creates-approves-disburses a working capital loan with the following data: + | LoanProduct | submittedOnDate | expectedDisbursementDate | principalAmount | totalPayment | periodPaymentRate | discount | + | WCLP_ACC_DEF_REV_AM | 01 January 2026 | 01 January 2026 | 9000 | 100000 | 18 | 0 | + When Admin sets the business date to "10 January 2026" + And Admin runs inline COB job for Working Capital Loan by loanId + And Admin adds "WORKING_CAPITAL_SPECIFIED_DUE_DATE_FEE" specified due date charge to working capital loan with "10 January 2026" due date and 100.0 transaction amount + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Fee | 10 January 2026 | 100.0 | EUR | false | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + When Admin makes a charge adjustment for the last added charge with 100.0 amount on working capital loan + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Charge Adjustment | 100.0 | 0.0 | 100.0 | 0.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Fee | 10 January 2026 | 100.0 | EUR | false | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 100.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | + Then Working Capital Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "10 January 2026" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 100.0 | | + | ASSET | 112603 | Interest/Fee Receivable | | 100.0 | + + When Customer undo "1"th "CHARGE_ADJUSTMENT" transaction made on "10 January 2026" on Working Capital loan + + Then Working Capital Loan Transactions tab has a reversed "CHARGE_ADJUSTMENT" transaction with date "10 January 2026" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 100.0 | | + | ASSET | 112603 | Interest/Fee Receivable | | 100.0 | + | INCOME | 404007 | Fee Income | | 100.0 | + | ASSET | 112603 | Interest/Fee Receivable | 100.0 | | + And Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Charge Adjustment | 100.0 | 0.0 | 100.0 | 0.0 | true | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Fee | 10 January 2026 | 100.0 | EUR | false | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + + Then Admin closes the Working Capital loan with a full repayment on "10 January 2026" + + @TestRailId:TODO_ADD_2 + Scenario: Verify Working Capital penalty charge adjustment accounting entries - UC2: full penalty charge adjustment has correct journal entries + Given Admin sets the business date to "01 January 2026" + And Admin creates a client with random data and creates-approves-disburses a working capital loan with the following data: + | LoanProduct | submittedOnDate | expectedDisbursementDate | principalAmount | totalPayment | periodPaymentRate | discount | + | WCLP_ACC_DEF_REV_AM | 01 January 2026 | 01 January 2026 | 9000 | 100000 | 18 | 0 | + When Admin sets the business date to "10 January 2026" + And Admin runs inline COB job for Working Capital Loan by loanId + And Admin adds "WORKING_CAPITAL_SPECIFIED_DUE_DATE_PENALTY" specified due date charge to working capital loan with "10 January 2026" due date and 50.0 transaction amount + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Penalty | 10 January 2026 | 50.0 | EUR | true | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 0.0 | 0.0 | 0.0 | 50.0 | 50.0 | 0.0 | + When Admin makes a charge adjustment for the last added charge with 50.0 amount on working capital loan + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Charge Adjustment | 50.0 | 0.0 | 0.0 | 50.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Penalty | 10 January 2026 | 50.0 | EUR | true | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 50.0 | + Then Working Capital Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "10 January 2026" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 50.0 | | + | ASSET | 112603 | Interest/Fee Receivable | | 50.0 | + + When Customer undo "1"th "CHARGE_ADJUSTMENT" transaction made on "10 January 2026" on Working Capital loan + + Then Working Capital Loan Transactions tab has a reversed "CHARGE_ADJUSTMENT" transaction with date "10 January 2026" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 50.0 | | + | ASSET | 112603 | Interest/Fee Receivable | | 50.0 | + | INCOME | 404007 | Fee Income | | 50.0 | + | ASSET | 112603 | Interest/Fee Receivable | 50.0 | | + And Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Charge Adjustment | 50.0 | 0.0 | 0.0 | 50.0 | true | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Penalty | 10 January 2026 | 50.0 | EUR | true | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 0.0 | 0.0 | 0.0 | 50.0 | 50.0 | 0.0 | + + Then Admin closes the Working Capital loan with a full repayment on "10 January 2026" + + @TestRailId:TODO_3 + Scenario: Verify Working Capital fee charge adjustment accounting entries - UC3: partially paid fee - full fee charge adjustment has correct journal entries + Given Admin sets the business date to "01 January 2026" + And Admin creates a client with random data and creates-approves-disburses a working capital loan with the following data: + | LoanProduct | submittedOnDate | expectedDisbursementDate | principalAmount | totalPayment | periodPaymentRate | discount | + | WCLP_ACC_DEF_REV_AM | 01 January 2026 | 01 January 2026 | 9000 | 100000 | 18 | 0 | + When Admin sets the business date to "10 January 2026" + And Admin runs inline COB job for Working Capital Loan by loanId + And Admin adds "WORKING_CAPITAL_SPECIFIED_DUE_DATE_FEE" specified due date charge to working capital loan with "10 January 2026" due date and 100.0 transaction amount + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Fee | 10 January 2026 | 100.0 | EUR | false | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | + When Customer makes repayment on "10 January 2026" with 50.0 transaction amount on Working Capital loan + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 50.0 | 0.0 | 50.0 | 0.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Fee | 10 January 2026 | 100.0 | EUR | false | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 100.0 | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | + When Admin makes a charge adjustment for the last added charge with 100.0 amount on working capital loan + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 50.0 | 0.0 | 50.0 | 0.0 | false | + | 10 January 2026 | Charge Adjustment | 100.0 | 50.0 | 50.0 | 0.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Fee | 10 January 2026 | 100.0 | EUR | false | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 100.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | + Then Working Capital Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "10 January 2026" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 100.0 | | + | ASSET | 112601 | Loans Receivable | | 50.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 50.0 | + And Working Capital loan status will be "ACTIVE" + And Working Capital loan balance principalOutstanding is "8950.0" + And Working Capital loan balance overpaymentAmount is "0.0" + + When Customer undo "1"th "CHARGE_ADJUSTMENT" transaction made on "10 January 2026" on Working Capital loan + + Then Working Capital Loan Transactions tab has a reversed "CHARGE_ADJUSTMENT" transaction with date "10 January 2026" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 100.0 | | + | ASSET | 112601 | Loans Receivable | | 50.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 50.0 | + | INCOME | 404007 | Fee Income | | 100.0 | + | ASSET | 112601 | Loans Receivable | 50.0 | | + | ASSET | 112603 | Interest/Fee Receivable | 50.0 | | + And Working Capital loan status will be "ACTIVE" + And Working Capital loan balance principalOutstanding is "9000.0" + And Working Capital loan balance overpaymentAmount is "0.0" + And Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 50.0 | 0.0 | 50.0 | 0.0 | false | + | 10 January 2026 | Charge Adjustment | 100.0 | 50.0 | 50.0 | 0.0 | true | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Fee | 10 January 2026 | 100.0 | EUR | false | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 100.0 | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | + + Then Admin closes the Working Capital loan with a full repayment on "10 January 2026" + + @TestRailId:TODO_ADD_4 + Scenario: Verify Working Capital penalty charge adjustment accounting entries - UC4: partially paid penalty - full penalty charge adjustment has correct journal entries + Given Admin sets the business date to "01 January 2026" + And Admin creates a client with random data and creates-approves-disburses a working capital loan with the following data: + | LoanProduct | submittedOnDate | expectedDisbursementDate | principalAmount | totalPayment | periodPaymentRate | discount | + | WCLP_ACC_DEF_REV_AM | 01 January 2026 | 01 January 2026 | 9000 | 100000 | 18 | 0 | + When Admin sets the business date to "10 January 2026" + And Admin runs inline COB job for Working Capital Loan by loanId + And Admin adds "WORKING_CAPITAL_SPECIFIED_DUE_DATE_PENALTY" specified due date charge to working capital loan with "10 January 2026" due date and 50.0 transaction amount + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Penalty | 10 January 2026 | 50.0 | EUR | true | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 0.0 | 0.0 | 0.0 | 50.0 | 50.0 | 0.0 | + When Customer makes repayment on "10 January 2026" with 30.0 transaction amount on Working Capital loan + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 30.0 | 0.0 | 0.0 | 30.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Penalty | 10 January 2026 | 50.0 | EUR | true | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 0.0 | 0.0 | 0.0 | 50.0 | 20.0 | 30.0 | + When Admin makes a charge adjustment for the last added charge with 50.0 amount on working capital loan + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 30.0 | 0.0 | 0.0 | 30.0 | false | + | 10 January 2026 | Charge Adjustment | 50.0 | 30.0 | 0.0 | 20.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Penalty | 10 January 2026 | 50.0 | EUR | true | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 50.0 | + Then Working Capital Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "10 January 2026" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 50.0 | | + | ASSET | 112601 | Loans Receivable | | 30.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 20.0 | + And Working Capital loan status will be "ACTIVE" + And Working Capital loan balance principalOutstanding is "8970.0" + And Working Capital loan balance overpaymentAmount is "0.0" + + When Customer undo "1"th "CHARGE_ADJUSTMENT" transaction made on "10 January 2026" on Working Capital loan + + Then Working Capital Loan Transactions tab has a reversed "CHARGE_ADJUSTMENT" transaction with date "10 January 2026" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 50.0 | | + | ASSET | 112601 | Loans Receivable | | 30.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 20.0 | + | INCOME | 404007 | Fee Income | | 50.0 | + | ASSET | 112601 | Loans Receivable | 30.0 | | + | ASSET | 112603 | Interest/Fee Receivable | 20.0 | | + And Working Capital loan status will be "ACTIVE" + And Working Capital loan balance principalOutstanding is "9000.0" + And Working Capital loan balance overpaymentAmount is "0.0" + And Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 30.0 | 0.0 | 0.0 | 30.0 | false | + | 10 January 2026 | Charge Adjustment | 50.0 | 30.0 | 0.0 | 20.0 | true | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Penalty | 10 January 2026 | 50.0 | EUR | true | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 0.0 | 0.0 | 0.0 | 50.0 | 20.0 | 30.0 | + + Then Admin closes the Working Capital loan with a full repayment on "10 January 2026" + + @TestRailId:TODO_5 + Scenario: Verify Working Capital fee charge adjustment accounting entries - UC5: partially paid fee - full fee charge adjustment has correct journal entries + Given Admin sets the business date to "01 January 2026" + And Admin creates a client with random data and creates-approves-disburses a working capital loan with the following data: + | LoanProduct | submittedOnDate | expectedDisbursementDate | principalAmount | totalPayment | periodPaymentRate | discount | + | WCLP_ACC_DEF_REV_AM | 01 January 2026 | 01 January 2026 | 9000 | 100000 | 18 | 0 | + When Admin sets the business date to "10 January 2026" + And Admin runs inline COB job for Working Capital Loan by loanId + And Admin adds "WORKING_CAPITAL_SPECIFIED_DUE_DATE_FEE" specified due date charge to working capital loan with "10 January 2026" due date and 100.0 transaction amount + And Admin adds "WORKING_CAPITAL_SPECIFIED_DUE_DATE_PENALTY" specified due date charge to working capital loan with "11 January 2026" due date and 50.0 transaction amount + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Fee | 10 January 2026 | 100.0 | EUR | false | Specified due date | Flat | Regular | + | Working Capital Loan Penalty | 11 January 2026 | 50.0 | EUR | true | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 100.0 | 100.0 | 0.0 | 50.0 | 50.0 | 0.0 | + When Customer makes repayment on "10 January 2026" with 50.0 transaction amount on Working Capital loan + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 50.0 | 0.0 | 50.0 | 0.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Fee | 10 January 2026 | 100.0 | EUR | false | Specified due date | Flat | Regular | + | Working Capital Loan Penalty | 11 January 2026 | 50.0 | EUR | true | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 100.0 | 50.0 | 50.0 | 50.0 | 50.0 | 0.0 | + + When Admin sets the business date to "11 January 2026" + And Admin runs inline COB job for Working Capital Loan by loanId + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 50.0 | 0.0 | 50.0 | 0.0 | false | + | 10 January 2026 | Accrual | 100.0 | 0.0 | 100.0 | 0.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Fee | 10 January 2026 | 100.0 | EUR | false | Specified due date | Flat | Regular | + | Working Capital Loan Penalty | 11 January 2026 | 50.0 | EUR | true | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 100.0 | 50.0 | 50.0 | 50.0 | 50.0 | 0.0 | + + When Admin makes a charge adjustment for the last added fee charge with 100.0 amount on working capital loan + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 50.0 | 0.0 | 50.0 | 0.0 | false | + | 10 January 2026 | Accrual | 100.0 | 0.0 | 100.0 | 0.0 | false | + | 11 January 2026 | Charge Adjustment | 100.0 | 0.0 | 50.0 | 50.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Fee | 10 January 2026 | 100.0 | EUR | false | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 100.0 | 0.0 | 100.0 | 50.0 | 0.0 | 50.0 | + Then Working Capital Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "11 January 2026" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 100.0 | | + | ASSET | 112603 | Interest/Fee Receivable | | 50.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 50.0 | + And Working Capital loan status will be "ACTIVE" + And Working Capital loan balance overpaymentAmount is "0.0" + + When Customer undo "1"th "CHARGE_ADJUSTMENT" transaction made on "11 January 2026" on Working Capital loan + + Then Working Capital Loan Transactions tab has a reversed "CHARGE_ADJUSTMENT" transaction with date "11 January 2026" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 100.0 | | + | ASSET | 112603 | Interest/Fee Receivable | | 50.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 50.0 | + | INCOME | 404007 | Fee Income | | 100.0 | + | ASSET | 112603 | Interest/Fee Receivable | 50.0 | | + | ASSET | 112603 | Interest/Fee Receivable | 50.0 | | + And Working Capital loan status will be "ACTIVE" + And Working Capital loan balance overpaymentAmount is "0.0" + And Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 50.0 | 0.0 | 50.0 | 0.0 | false | + | 10 January 2026 | Accrual | 100.0 | 0.0 | 100.0 | 0.0 | false | + | 11 January 2026 | Charge Adjustment | 100.0 | 0.0 | 50.0 | 50.0 | true | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Fee | 10 January 2026 | 100.0 | EUR | false | Specified due date | Flat | Regular | + | Working Capital Loan Penalty | 11 January 2026 | 50.0 | EUR | true | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 100.0 | 50.0 | 50.0 | 50.0 | 50.0 | 0.0 | + Then Admin closes the Working Capital loan with a full repayment on "11 January 2026" + + @TestRailId:TODO_ADD_6 + Scenario: Verify Working Capital penalty charge adjustment accounting entries - UC6: partially paid penalty - full penalty charge adjustment has correct journal entries + Given Admin sets the business date to "01 January 2026" + And Admin creates a client with random data and creates-approves-disburses a working capital loan with the following data: + | LoanProduct | submittedOnDate | expectedDisbursementDate | principalAmount | totalPayment | periodPaymentRate | discount | + | WCLP_ACC_DEF_REV_AM | 01 January 2026 | 01 January 2026 | 9000 | 100000 | 18 | 0 | + When Admin sets the business date to "10 January 2026" + And Admin runs inline COB job for Working Capital Loan by loanId + And Admin adds "WORKING_CAPITAL_SPECIFIED_DUE_DATE_PENALTY" specified due date charge to working capital loan with "10 January 2026" due date and 50.0 transaction amount + And Admin adds "WORKING_CAPITAL_SPECIFIED_DUE_DATE_FEE" specified due date charge to working capital loan with "11 January 2026" due date and 60.0 transaction amount + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Penalty | 10 January 2026 | 50.0 | EUR | true | Specified due date | Flat | Regular | + | Working Capital Loan Fee | 11 January 2026 | 60.0 | EUR | false | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 60.0 | 60.0 | 0.0 | 50.0 | 50.0 | 0.0 | + When Customer makes repayment on "10 January 2026" with 30.0 transaction amount on Working Capital loan + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 30.0 | 0.0 | 0.0 | 30.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Penalty | 10 January 2026 | 50.0 | EUR | true | Specified due date | Flat | Regular | + | Working Capital Loan Fee | 11 January 2026 | 60.0 | EUR | false | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 60.0 | 60.0 | 0.0 | 50.0 | 20.0 | 30.0 | + + When Admin sets the business date to "11 January 2026" + And Admin runs inline COB job for Working Capital Loan by loanId + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 30.0 | 0.0 | 0.0 | 30.0 | false | + | 10 January 2026 | Accrual | 50.0 | 0.0 | 0.0 | 50.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Penalty | 10 January 2026 | 50.0 | EUR | true | Specified due date | Flat | Regular | + | Working Capital Loan Fee | 11 January 2026 | 60.0 | EUR | false | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 60.0 | 60.0 | 0.0 | 50.0 | 20.0 | 30.0 | + + When Admin makes a charge adjustment for the last added penalty charge with 50.0 amount on working capital loan + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 30.0 | 0.0 | 0.0 | 30.0 | false | + | 10 January 2026 | Accrual | 50.0 | 0.0 | 0.0 | 50.0 | false | + | 11 January 2026 | Charge Adjustment | 50.0 | 0.0 | 30.0 | 20.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Penalty | 10 January 2026 | 50.0 | EUR | true | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 60.0 | 30.0 | 30.0 | 50.0 | 0.0 | 50.0 | + Then Working Capital Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "11 January 2026" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 50.0 | | + | ASSET | 112603 | Interest/Fee Receivable | | 30.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 20.0 | + And Working Capital loan status will be "ACTIVE" + And Working Capital loan balance overpaymentAmount is "0.0" + + When Customer undo "1"th "CHARGE_ADJUSTMENT" transaction made on "11 January 2026" on Working Capital loan + + Then Working Capital Loan Transactions tab has a reversed "CHARGE_ADJUSTMENT" transaction with date "11 January 2026" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 50.0 | | + | ASSET | 112603 | Interest/Fee Receivable | | 30.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 20.0 | + | INCOME | 404007 | Fee Income | | 50.0 | + | ASSET | 112603 | Interest/Fee Receivable | 30.0 | | + | ASSET | 112603 | Interest/Fee Receivable | 20.0 | | + And Working Capital loan status will be "ACTIVE" + And Working Capital loan balance overpaymentAmount is "0.0" + And Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 30.0 | 0.0 | 0.0 | 30.0 | false | + | 10 January 2026 | Accrual | 50.0 | 0.0 | 0.0 | 50.0 | false | + | 11 January 2026 | Charge Adjustment | 50.0 | 0.0 | 30.0 | 20.0 | true | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Penalty | 10 January 2026 | 50.0 | EUR | true | Specified due date | Flat | Regular | + | Working Capital Loan Fee | 11 January 2026 | 60.0 | EUR | false | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 60.0 | 60.0 | 0.0 | 50.0 | 20.0 | 30.0 | + + Then Admin closes the Working Capital loan with a full repayment on "11 January 2026" + + + @TestRailId:TODO_7 + Scenario: Verify Working Capital fee charge adjustment accounting entries - UC7: fully repaid loan - partial fee charge adjustment has overpayment journal entries + Given Admin sets the business date to "01 January 2026" + And Admin creates a client with random data and creates-approves-disburses a working capital loan with the following data: + | LoanProduct | submittedOnDate | expectedDisbursementDate | principalAmount | totalPayment | periodPaymentRate | discount | + | WCLP_ACC_DEF_REV_AM | 01 January 2026 | 01 January 2026 | 9000 | 100000 | 18 | 0 | + When Admin sets the business date to "10 January 2026" + And Admin runs inline COB job for Working Capital Loan by loanId + And Admin adds "WORKING_CAPITAL_SPECIFIED_DUE_DATE_FEE" specified due date charge to working capital loan with "10 January 2026" due date and 45.0 transaction amount + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Fee | 10 January 2026 | 45.0 | EUR | false | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 45.0 | 45.0 | 0.0 | 0.0 | 0.0 | 0.0 | + When Customer makes repayment on "10 January 2026" with 9045.0 transaction amount on Working Capital loan + Then Working Capital loan status will be "CLOSED_OBLIGATIONS_MET" + And Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 9045.0 | 9000.0 | 45.0 | 0.0 | false | + | 10 January 2026 | Accrual | 45.0 | 0.0 | 45.0 | 0.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Fee | 10 January 2026 | 45.0 | EUR | false | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 45.0 | 0.0 | 45.0 | 0.0 | 0.0 | 0.0 | + + When Admin sets the business date to "11 January 2026" + And Admin runs inline COB job for Working Capital Loan by loanId + + When Admin makes a charge adjustment for the last added fee charge with 25.0 amount on working capital loan + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 9045.0 | 9000.0 | 45.0 | 0.0 | false | + | 10 January 2026 | Accrual | 45.0 | 0.0 | 45.0 | 0.0 | false | + | 11 January 2026 | Charge Adjustment | 25.0 | 0.0 | 0.0 | 0.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Fee | 10 January 2026 | 45.0 | EUR | false | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 45.0 | 0.0 | 45.0 | 0.0 | 0.0 | 0.0 | + Then Working Capital Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "11 January 2026" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 25.0 | | + | LIABILITY | 245000 | Other Credit Liability | | 25.0 | + Then Working Capital loan status will be "OVERPAID" + And Working Capital loan balance overpaymentAmount is "25.0" + + When Customer undo "1"th "CHARGE_ADJUSTMENT" transaction made on "11 January 2026" on Working Capital loan + + Then Working Capital Loan Transactions tab has a reversed "CHARGE_ADJUSTMENT" transaction with date "11 January 2026" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 25.0 | | + | LIABILITY | 245000 | Other Credit Liability | | 25.0 | + | INCOME | 404007 | Fee Income | | 25.0 | + | LIABILITY | 245000 | Other Credit Liability | 25.0 | | + + Then Working Capital loan status will be "CLOSED_OBLIGATIONS_MET" + And Working Capital loan balance overpaymentAmount is "0.0" + And Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 9045.0 | 9000.0 | 45.0 | 0.0 | false | + | 10 January 2026 | Accrual | 45.0 | 0.0 | 45.0 | 0.0 | false | + | 11 January 2026 | Charge Adjustment | 25.0 | 0.0 | 0.0 | 0.0 | true | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Fee | 10 January 2026 | 45.0 | EUR | false | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 45.0 | 0.0 | 45.0 | 0.0 | 0.0 | 0.0 | + When Customer undo "1"th "REPAYMENT" transaction made on "10 January 2026" on Working Capital loan + Then Working Capital loan status will be "ACTIVE" + And Working Capital loan balance principalOutstanding is "9000.0" + And Working Capital loan balance overpaymentAmount is "0.0" + And Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 9045.0 | 9000.0 | 45.0 | 0.0 | true | + | 10 January 2026 | Accrual | 45.0 | 0.0 | 45.0 | 0.0 | false | + | 11 January 2026 | Charge Adjustment | 25.0 | 0.0 | 0.0 | 0.0 | true | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Fee | 10 January 2026 | 45.0 | EUR | false | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 45.0 | 45.0 | 0.0 | 0.0 | 0.0 | 0.0 | + Then Admin closes the Working Capital loan with a full repayment on "11 January 2026" + + @TestRailId:TODO_ADD_8 + Scenario: Verify Working Capital penalty charge adjustment accounting entries - UC8: fully repaid loan - partial penalty charge adjustment has overpayment journal entries + Given Admin sets the business date to "01 January 2026" + And Admin creates a client with random data and creates-approves-disburses a working capital loan with the following data: + | LoanProduct | submittedOnDate | expectedDisbursementDate | principalAmount | totalPayment | periodPaymentRate | discount | + | WCLP_ACC_DEF_REV_AM | 01 January 2026 | 01 January 2026 | 9000 | 100000 | 18 | 0 | + When Admin sets the business date to "10 January 2026" + And Admin runs inline COB job for Working Capital Loan by loanId + And Admin adds "WORKING_CAPITAL_SPECIFIED_DUE_DATE_PENALTY" specified due date charge to working capital loan with "10 January 2026" due date and 77.7 transaction amount + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Penalty | 10 January 2026 | 77.7 | EUR | true | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 0.0 | 0.0 | 0.0 | 77.7 | 77.7 | 0.0 | + When Customer makes repayment on "10 January 2026" with 9077.7 transaction amount on Working Capital loan + Then Working Capital loan status will be "CLOSED_OBLIGATIONS_MET" + And Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 9077.7 | 9000.0 | 0.0 | 77.7 | false | + | 10 January 2026 | Accrual | 77.7 | 0.0 | 0.0 | 77.7 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Penalty | 10 January 2026 | 77.7 | EUR | true | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 0.0 | 0.0 | 0.0 | 77.7 | 0.0 | 77.7 | + + When Admin sets the business date to "11 January 2026" + And Admin runs inline COB job for Working Capital Loan by loanId + + When Admin makes a charge adjustment for the last added penalty charge with 50.0 amount on working capital loan + Then Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 9077.7 | 9000.0 | 0.0 | 77.7 | false | + | 10 January 2026 | Accrual | 77.7 | 0.0 | 0.0 | 77.7 | false | + | 11 January 2026 | Charge Adjustment | 50.0 | 0.0 | 0.0 | 0.0 | false | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Penalty | 10 January 2026 | 77.7 | EUR | true | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 0.0 | 0.0 | 0.0 | 77.7 | 0.0 | 77.7 | + Then Working Capital Loan Transactions tab has a "CHARGE_ADJUSTMENT" transaction with date "11 January 2026" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 50.0 | | + | LIABILITY | 245000 | Other Credit Liability | | 50.0 | + + Then Working Capital loan status will be "OVERPAID" + And Working Capital loan balance overpaymentAmount is "50.0" + + When Customer undo "1"th "CHARGE_ADJUSTMENT" transaction made on "11 January 2026" on Working Capital loan + + Then Working Capital Loan Transactions tab has a reversed "CHARGE_ADJUSTMENT" transaction with date "11 January 2026" which has the following Journal entries: + | Type | Account code | Account name | Debit | Credit | + | INCOME | 404007 | Fee Income | 50.0 | | + | LIABILITY | 245000 | Other Credit Liability | | 50.0 | + | INCOME | 404007 | Fee Income | | 50.0 | + | LIABILITY | 245000 | Other Credit Liability | 50.0 | | + + Then Working Capital loan status will be "CLOSED_OBLIGATIONS_MET" + And Working Capital loan balance overpaymentAmount is "0.0" + And Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 9077.7 | 9000.0 | 0.0 | 77.7 | false | + | 10 January 2026 | Accrual | 77.7 | 0.0 | 0.0 | 77.7 | false | + | 11 January 2026 | Charge Adjustment | 50.0 | 0.0 | 0.0 | 0.0 | true | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Penalty | 10 January 2026 | 77.7 | EUR | true | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 0.0 | 0.0 | 0.0 | 77.7 | 0.0 | 77.7 | + When Customer undo "1"th "REPAYMENT" transaction made on "10 January 2026" on Working Capital loan + Then Working Capital loan status will be "ACTIVE" + And Working Capital loan balance principalOutstanding is "9000.0" + And Working Capital loan balance overpaymentAmount is "0.0" + And Working Capital Loan has transactions: + | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | Repayment | 9077.7 | 9000.0 | 0.0 | 77.7 | true | + | 10 January 2026 | Accrual | 77.7 | 0.0 | 0.0 | 77.7 | false | + | 11 January 2026 | Charge Adjustment | 50.0 | 0.0 | 0.0 | 0.0 | true | + And Working Capital Loan has charges with the following data: + | Charge Name | Due Date | Amount | Currency | isPenalty | Charge Time Type | Charge Calculation Type | Charge Payment mode | + | Working Capital Loan Penalty | 10 January 2026 | 77.7 | EUR | true | Specified due date | Flat | Regular | + And Working Capital Loan charge balances has the following data: + | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | + | 0.0 | 0.0 | 0.0 | 77.7 | 77.7 | 0.0 | + Then Admin closes the Working Capital loan with a full repayment on "11 January 2026" \ No newline at end of file diff --git a/fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalTransactionReprocessing.feature b/fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalTransactionReprocessing.feature index ff1779032e3..a9e3f79a9fa 100644 --- a/fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalTransactionReprocessing.feature +++ b/fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalTransactionReprocessing.feature @@ -29,10 +29,11 @@ Feature: Working Capital Transaction Reprocessing | overpaymentAmount | 0.0 | # The backdated repayment allocates fully to principal; the earlier repayment stays untouched And Working Capital Loan has transactions: - | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | - | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | - | 05 January 2026 | Repayment | 2000.0 | 2000.0 | 0.0 | 0.0 | false | - | 10 January 2026 | Repayment | 3000.0 | 3000.0 | 0.0 | 0.0 | false | + | transactionDate | submittedOnDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 05 January 2026 | 15 January 2026 | Repayment | 2000.0 | 2000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | 10 January 2026 | Repayment | 3000.0 | 3000.0 | 0.0 | 0.0 | false | + Then Admin closes the Working Capital loan with a full repayment on "15 January 2026" @TestRailId:C85209 Scenario: Verify backdated repayment that overpays - excess becomes overpayment @@ -88,11 +89,12 @@ Feature: Working Capital Transaction Reprocessing | totalPaidPrincipal | 6000.0 | | overpaymentAmount | 0.0 | And Working Capital Loan has transactions: - | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | - | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | - | 05 January 2026 | Repayment | 1000.0 | 1000.0 | 0.0 | 0.0 | false | - | 10 January 2026 | Repayment | 2000.0 | 2000.0 | 0.0 | 0.0 | false | - | 15 January 2026 | Repayment | 3000.0 | 3000.0 | 0.0 | 0.0 | false | + | transactionDate | submittedOnDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 05 January 2026 | 20 January 2026 | Repayment | 1000.0 | 1000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | 20 January 2026 | Repayment | 2000.0 | 2000.0 | 0.0 | 0.0 | false | + | 15 January 2026 | 15 January 2026 | Repayment | 3000.0 | 3000.0 | 0.0 | 0.0 | false | + Then Admin closes the Working Capital loan with a full repayment on "20 January 2026" @TestRailId:C85211 Scenario: Verify sequential (non-backdated) repayments do not trigger reprocessing side effects @@ -113,10 +115,11 @@ Feature: Working Capital Transaction Reprocessing | totalPaidPrincipal | 5000.0 | | overpaymentAmount | 0.0 | And Working Capital Loan has transactions: - | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | - | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | - | 05 January 2026 | Repayment | 2000.0 | 2000.0 | 0.0 | 0.0 | false | - | 10 January 2026 | Repayment | 3000.0 | 3000.0 | 0.0 | 0.0 | false | + | transactionDate | submittedOnDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 05 January 2026 | 05 January 2026 | Repayment | 2000.0 | 2000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | 10 January 2026 | Repayment | 3000.0 | 3000.0 | 0.0 | 0.0 | false | + Then Admin closes the Working Capital loan with a full repayment on "10 January 2026" @TestRailId:C85212 Scenario: Verify backdated repayment only settles a charge that is already due on the backdated date @@ -141,13 +144,14 @@ Feature: Working Capital Transaction Reprocessing | totalPaidPrincipal | 4965.0 | # The day-5 repayment predates the fee due date, so it is principal-only; the day-10 repayment covers the fee And Working Capital Loan has transactions: - | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | - | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | - | 05 January 2026 | Repayment | 2000.0 | 2000.0 | 0.0 | 0.0 | false | - | 10 January 2026 | Repayment | 3000.0 | 2965.0 | 35.0 | 0.0 | false | + | transactionDate | submittedOnDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | + | 01 January 2026 | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | + | 05 January 2026 | 15 January 2026 | Repayment | 2000.0 | 2000.0 | 0.0 | 0.0 | false | + | 10 January 2026 | 10 January 2026 | Repayment | 3000.0 | 2965.0 | 35.0 | 0.0 | false | And Working Capital Loan charge balances has the following data: | Fee Amount | Fee Paid | Fee Outstanding | | 35.0 | 35.0 | 0.0 | + Then Admin closes the Working Capital loan with a full repayment on "15 January 2026" @TestRailId:C85213 Scenario: Verify a repayment clearing more than one lapsed delinquency period distributes by remaining balance @@ -171,6 +175,7 @@ Feature: Working Capital Transaction Reprocessing | 1 | 2026-01-01 | 2026-01-30 | 270.0 | 270.0 | 0.0 | true | 0.0 | 0 | | 2 | 2026-01-31 | 2026-03-01 | 270.0 | 130.0 | 140.0 | false | 140.0 | 1 | | 3 | 2026-03-02 | 2026-03-31 | 270.0 | 0.0 | 270.0 | null | null | null | + Then Admin closes the Working Capital loan with a full repayment on "02 March 2026" @TestRailId:C85214 Scenario: Verify backdated repayment is recorded on its actual day and the amortization balance is recalculated @@ -195,6 +200,7 @@ Feature: Working Capital Transaction Reprocessing Then The retrieved amortization schedule has the following summary fields: | discountFeeAmount | netDisbursementAmount | totalPaymentVolume | periodPaymentRate | npvDayCount | expectedPaymentAmount | | 0.00 | 9000.00 | 100000.00 | 18 | 360 | 50.00 | + Then Admin closes the Working Capital loan with a full repayment on "15 January 2026" @TestRailId:C85215 Scenario: Verify backdated repayment reduces the outstanding tracked by the breach schedule @@ -213,6 +219,7 @@ Feature: Working Capital Transaction Reprocessing And Customer makes repayment on "05 January 2026" with 2000 transaction amount on Working Capital loan And Admin runs inline COB job for Working Capital Loan by loanId Then Working Capital loan breach schedule has 1 period + Then Admin closes the Working Capital loan with a full repayment on "15 January 2026" @TestRailId:C85216 Scenario: Verify backdated repayment re-allocates the later transaction's fee portion to principal @@ -251,6 +258,7 @@ Feature: Working Capital Transaction Reprocessing | 01 January 2026 | Disbursement | 9000.0 | 9000.0 | 0.0 | 0.0 | false | | 05 January 2026 | Repayment | 25.0 | 20.0 | 5.0 | 0.0 | false | | 10 January 2026 | Repayment | 30.0 | 30.0 | 0.0 | 0.0 | false | + Then Admin closes the Working Capital loan with a full repayment on "15 January 2026" @TestRailId:C85217 Scenario: Verify reversal of a transaction re-allocates the remaining transaction's fee portion @@ -289,6 +297,7 @@ Feature: Working Capital Transaction Reprocessing | field | value | | principalOutstanding | 8980.0 | | totalPaidPrincipal | 20.0 | + Then Admin closes the Working Capital loan with a full repayment on "10 January 2026" @TestRailId:C85218 Scenario: Verify a repayment splits across fee and principal per the product's allocation order @@ -317,6 +326,7 @@ Feature: Working Capital Transaction Reprocessing And Working Capital Loan charge balances has the following data: | Fee Amount | Fee Paid | Fee Outstanding | | 5.0 | 5.0 | 0.0 | + Then Admin closes the Working Capital loan with a full repayment on "10 January 2026" @TestRailId:C85460 Scenario: Verify backdated repayment reprocessing preserves an earlier charge adjustment's settlement @@ -358,6 +368,7 @@ Feature: Working Capital Transaction Reprocessing | field | value | | principalOutstanding | 8950.0 | | totalPaidPrincipal | 50.0 | + Then Admin closes the Working Capital loan with a full repayment on "15 January 2026" @TestRailId:C85461 Scenario: Verify backdated repayment that overpays redistributes allocations chronologically diff --git a/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoanTransaction.java b/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoanTransaction.java index 75ff8aac3ec..f284306483c 100644 --- a/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoanTransaction.java +++ b/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/domain/WorkingCapitalLoanTransaction.java @@ -39,6 +39,7 @@ import org.apache.fineract.infrastructure.codes.domain.CodeValue; import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom; import org.apache.fineract.infrastructure.core.domain.ExternalId; +import org.apache.fineract.infrastructure.core.service.DateUtils; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionTypeConverter; import org.apache.fineract.portfolio.paymentdetail.domain.PaymentDetail; @@ -168,7 +169,7 @@ public static WorkingCapitalLoanTransaction discountFee(final WorkingCapitalLoan transaction.transactionType = LoanTransactionType.DISCOUNT_FEE; transaction.transactionAmount = amount; transaction.transactionDate = transactionDate; - transaction.submittedOnDate = transactionDate; + transaction.submittedOnDate = DateUtils.getBusinessLocalDate(); transaction.externalId = externalId != null ? externalId : ExternalId.empty(); transaction.paymentDetail = paymentDetail; transaction.classification = classification; @@ -185,7 +186,7 @@ public static WorkingCapitalLoanTransaction discountFeeAdjustment(final WorkingC transaction.transactionType = LoanTransactionType.DISCOUNT_FEE_ADJUSTMENT; transaction.transactionAmount = amount; transaction.transactionDate = transactionDate; - transaction.submittedOnDate = transactionDate; + transaction.submittedOnDate = DateUtils.getBusinessLocalDate(); transaction.externalId = externalId != null ? externalId : ExternalId.empty(); transaction.paymentDetail = paymentDetail; transaction.classification = classification; @@ -214,7 +215,7 @@ private void initialize(final WorkingCapitalLoan loan, final LoanTransactionType this.wcLoan = loan; this.transactionType = transactionType; this.transactionDate = transactionDate; - this.submittedOnDate = transactionDate; + this.submittedOnDate = DateUtils.getBusinessLocalDate(); this.transactionAmount = amount; this.paymentDetail = paymentDetail; this.classification = classification; diff --git a/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/service/WorkingCapitalLoanAllocationRequestFactory.java b/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/service/WorkingCapitalLoanAllocationRequestFactory.java index 07002d14428..63447512031 100644 --- a/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/service/WorkingCapitalLoanAllocationRequestFactory.java +++ b/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/service/WorkingCapitalLoanAllocationRequestFactory.java @@ -52,33 +52,6 @@ public WorkingCapitalLoanAllocationRequest build(@NonNull final WorkingCapitalLo getAllocationRule(loan, transactionType).getAllocationTypes(), balance.getPrincipalOutstanding(), chargeBalances); } - /** - * Builds the allocation request for a charge adjustment. When the product configures its own CHARGE_ADJUSTMENT - * allocation order, that order is honored and the adjustment spreads across charges/principal like a repayment. - * Otherwise an adjustment settles only its own charge: the request is scoped to that single charge with no - * principal outstanding, which keeps the amount on the charge's fee/penalty bucket and prevents the fallback - * (default) order - which ranks DUE_PRINCIPAL ahead of the IN_ADVANCE buckets - from diverting a not-yet-due charge - * onto principal. - */ - public WorkingCapitalLoanAllocationRequest buildForChargeAdjustment(@NonNull final WorkingCapitalLoan loan, - @NonNull final WorkingCapitalLoanBalance balance, @NonNull final List charges, - @NonNull final WorkingCapitalLoanCharge adjustedCharge, @NonNull final LocalDate transactionDate, - @NonNull final BigDecimal amount) { - if (hasConfiguredAllocationRule(loan, LoanTransactionType.CHARGE_ADJUSTMENT)) { - return build(loan, balance, charges, transactionDate, amount, LoanTransactionType.CHARGE_ADJUSTMENT); - } - final ChargeBalance chargeBalance = new ChargeBalance(adjustedCharge.getId(), adjustedCharge.getAmountOutstanding(), - adjustedCharge.getDueDate(), adjustedCharge.isPenaltyCharge()); - return new WorkingCapitalLoanAllocationRequest(transactionDate, amount, getDefaultAllocationRule(loan).getAllocationTypes(), - BigDecimal.ZERO, List.of(chargeBalance)); - } - - private boolean hasConfiguredAllocationRule(@NonNull final WorkingCapitalLoan loan, - @NonNull final LoanTransactionType transactionType) { - return loan.getPaymentAllocationRules().stream() - .anyMatch(rule -> transactionType.equals(rule.getTransactionType().getLoanTransactionType())); - } - @NonNull private WorkingCapitalLoanPaymentAllocationRule getAllocationRule(@NonNull final WorkingCapitalLoan loan, @NonNull final LoanTransactionType transactionType) { diff --git a/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/service/WorkingCapitalLoanTransactionProcessor.java b/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/service/WorkingCapitalLoanTransactionProcessor.java index ee196b4a429..46633e1c140 100644 --- a/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/service/WorkingCapitalLoanTransactionProcessor.java +++ b/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/service/WorkingCapitalLoanTransactionProcessor.java @@ -34,7 +34,6 @@ import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoanLifecycleStateMachine; import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoanTransaction; import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoanTransactionAllocation; -import org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoanTransactionRelation; import org.apache.fineract.portfolio.workingcapitalloan.repository.WorkingCapitalLoanBalanceRepository; import org.apache.fineract.portfolio.workingcapitalloan.repository.WorkingCapitalLoanChargeRepository; import org.apache.fineract.portfolio.workingcapitalloan.repository.WorkingCapitalLoanTransactionAllocationRepository; @@ -68,23 +67,11 @@ public WorkingCapitalLoanTransactionAllocation processRepaymentLikeTransaction(f final WorkingCapitalLoanBalance balance = balanceRepository.findByWcLoan_Id(loanId) .orElseGet(() -> WorkingCapitalLoanBalance.createFor(loan)); final List charges = chargeRepository.findByLoanIdAndActiveTrueOrderByDueDateAscIdAsc(loanId); - - WorkingCapitalLoanAllocationRequest allocationRequest; - if (transactionType == LoanTransactionType.CHARGE_ADJUSTMENT) { - final WorkingCapitalLoanTransactionRelation loanTransactionRelation = transaction.getLoanTransactionRelations().stream() - .filter(e -> e.getToCharge() != null).findFirst().orElseThrow(); - final WorkingCapitalLoanCharge adjustedCharge = loanTransactionRelation.getToCharge(); - // The factory honors a configured CHARGE_ADJUSTMENT allocation order when the product defines one; - // otherwise it scopes the adjustment to its own charge (no principal) so a not-yet-due charge is not - // diverted onto principal. - allocationRequest = allocationRequestFactory.buildForChargeAdjustment(loan, balance, charges, adjustedCharge, transactionDate, - transactionAmount); - } else { - // Decide the allocation across penalty/fee/principal following the loan's configured payment allocation - // order (principal-only when no order is configured), then materialize it onto the charges and refresh the - // balance. - allocationRequest = allocationRequestFactory.build(loan, balance, charges, transactionDate, transactionAmount, transactionType); - } + // Decide the allocation across penalty/fee/principal following the loan's configured payment allocation + // order (principal-only when no order is configured), then materialize it onto the charges and refresh the + // balance. + final WorkingCapitalLoanAllocationRequest allocationRequest = allocationRequestFactory.build(loan, balance, charges, + transactionDate, transactionAmount, transactionType); final WorkingCapitalLoanAllocationPlan allocationPlan = allocationProcessor.plan(allocationRequest); final WorkingCapitalLoanTransactionAllocation allocation = allocationApplier.apply(transaction, null, allocationPlan, charges); balanceUpdater.apply(balance, allocationPlan); From 2f86080cb71c2aea0c03555153b590805381eaac Mon Sep 17 00:00:00 2001 From: Peter Kovacs Date: Fri, 31 Jul 2026 09:12:06 +0200 Subject: [PATCH 2/2] FINERACT-2455: Working Capital - Charge Adjustment Accounting Entries - E2E tests --- ...italLoanChargeAdjustmentAccounting.feature | 48 ++++--------------- 1 file changed, 8 insertions(+), 40 deletions(-) diff --git a/fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalLoanChargeAdjustmentAccounting.feature b/fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalLoanChargeAdjustmentAccounting.feature index 1fc004f88c6..ad0276ab704 100644 --- a/fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalLoanChargeAdjustmentAccounting.feature +++ b/fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalLoanChargeAdjustmentAccounting.feature @@ -2,7 +2,7 @@ @WorkingCapitalLoanChargeAdjustmentAccountingFeature Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature - @TestRailId:TODO_1 + @TestRailId:C89820 Scenario: Verify Working Capital fee charge adjustment accounting entries - UC1: full fee charge adjustment has correct journal entries Given Admin sets the business date to "01 January 2026" And Admin creates a client with random data and creates-approves-disburses a working capital loan with the following data: @@ -35,9 +35,7 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature | Type | Account code | Account name | Debit | Credit | | INCOME | 404007 | Fee Income | 100.0 | | | ASSET | 112603 | Interest/Fee Receivable | | 100.0 | - When Customer undo "1"th "CHARGE_ADJUSTMENT" transaction made on "10 January 2026" on Working Capital loan - Then Working Capital Loan Transactions tab has a reversed "CHARGE_ADJUSTMENT" transaction with date "10 January 2026" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | INCOME | 404007 | Fee Income | 100.0 | | @@ -54,10 +52,9 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature And Working Capital Loan charge balances has the following data: | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | - Then Admin closes the Working Capital loan with a full repayment on "10 January 2026" - @TestRailId:TODO_ADD_2 + @TestRailId:C89821 Scenario: Verify Working Capital penalty charge adjustment accounting entries - UC2: full penalty charge adjustment has correct journal entries Given Admin sets the business date to "01 January 2026" And Admin creates a client with random data and creates-approves-disburses a working capital loan with the following data: @@ -90,9 +87,7 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature | Type | Account code | Account name | Debit | Credit | | INCOME | 404007 | Fee Income | 50.0 | | | ASSET | 112603 | Interest/Fee Receivable | | 50.0 | - When Customer undo "1"th "CHARGE_ADJUSTMENT" transaction made on "10 January 2026" on Working Capital loan - Then Working Capital Loan Transactions tab has a reversed "CHARGE_ADJUSTMENT" transaction with date "10 January 2026" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | INCOME | 404007 | Fee Income | 50.0 | | @@ -109,10 +104,9 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature And Working Capital Loan charge balances has the following data: | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | | 0.0 | 0.0 | 0.0 | 50.0 | 50.0 | 0.0 | - Then Admin closes the Working Capital loan with a full repayment on "10 January 2026" - @TestRailId:TODO_3 + @TestRailId:C89822 Scenario: Verify Working Capital fee charge adjustment accounting entries - UC3: partially paid fee - full fee charge adjustment has correct journal entries Given Admin sets the business date to "01 January 2026" And Admin creates a client with random data and creates-approves-disburses a working capital loan with the following data: @@ -161,9 +155,7 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature And Working Capital loan status will be "ACTIVE" And Working Capital loan balance principalOutstanding is "8950.0" And Working Capital loan balance overpaymentAmount is "0.0" - When Customer undo "1"th "CHARGE_ADJUSTMENT" transaction made on "10 January 2026" on Working Capital loan - Then Working Capital Loan Transactions tab has a reversed "CHARGE_ADJUSTMENT" transaction with date "10 January 2026" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | INCOME | 404007 | Fee Income | 100.0 | | @@ -186,10 +178,9 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature And Working Capital Loan charge balances has the following data: | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | | 100.0 | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | - Then Admin closes the Working Capital loan with a full repayment on "10 January 2026" - @TestRailId:TODO_ADD_4 + @TestRailId:C89823 Scenario: Verify Working Capital penalty charge adjustment accounting entries - UC4: partially paid penalty - full penalty charge adjustment has correct journal entries Given Admin sets the business date to "01 January 2026" And Admin creates a client with random data and creates-approves-disburses a working capital loan with the following data: @@ -238,9 +229,7 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature And Working Capital loan status will be "ACTIVE" And Working Capital loan balance principalOutstanding is "8970.0" And Working Capital loan balance overpaymentAmount is "0.0" - When Customer undo "1"th "CHARGE_ADJUSTMENT" transaction made on "10 January 2026" on Working Capital loan - Then Working Capital Loan Transactions tab has a reversed "CHARGE_ADJUSTMENT" transaction with date "10 January 2026" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | INCOME | 404007 | Fee Income | 50.0 | | @@ -263,10 +252,9 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature And Working Capital Loan charge balances has the following data: | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | | 0.0 | 0.0 | 0.0 | 50.0 | 20.0 | 30.0 | - Then Admin closes the Working Capital loan with a full repayment on "10 January 2026" - @TestRailId:TODO_5 + @TestRailId:C89824 Scenario: Verify Working Capital fee charge adjustment accounting entries - UC5: partially paid fee - full fee charge adjustment has correct journal entries Given Admin sets the business date to "01 January 2026" And Admin creates a client with random data and creates-approves-disburses a working capital loan with the following data: @@ -298,7 +286,6 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature And Working Capital Loan charge balances has the following data: | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | | 100.0 | 50.0 | 50.0 | 50.0 | 50.0 | 0.0 | - When Admin sets the business date to "11 January 2026" And Admin runs inline COB job for Working Capital Loan by loanId Then Working Capital Loan has transactions: @@ -313,7 +300,6 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature And Working Capital Loan charge balances has the following data: | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | | 100.0 | 50.0 | 50.0 | 50.0 | 50.0 | 0.0 | - When Admin makes a charge adjustment for the last added fee charge with 100.0 amount on working capital loan Then Working Capital Loan has transactions: | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | @@ -334,9 +320,7 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature | ASSET | 112603 | Interest/Fee Receivable | | 50.0 | And Working Capital loan status will be "ACTIVE" And Working Capital loan balance overpaymentAmount is "0.0" - When Customer undo "1"th "CHARGE_ADJUSTMENT" transaction made on "11 January 2026" on Working Capital loan - Then Working Capital Loan Transactions tab has a reversed "CHARGE_ADJUSTMENT" transaction with date "11 January 2026" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | INCOME | 404007 | Fee Income | 100.0 | | @@ -362,7 +346,7 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature | 100.0 | 50.0 | 50.0 | 50.0 | 50.0 | 0.0 | Then Admin closes the Working Capital loan with a full repayment on "11 January 2026" - @TestRailId:TODO_ADD_6 + @TestRailId:C89825 Scenario: Verify Working Capital penalty charge adjustment accounting entries - UC6: partially paid penalty - full penalty charge adjustment has correct journal entries Given Admin sets the business date to "01 January 2026" And Admin creates a client with random data and creates-approves-disburses a working capital loan with the following data: @@ -394,7 +378,6 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature And Working Capital Loan charge balances has the following data: | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | | 60.0 | 60.0 | 0.0 | 50.0 | 20.0 | 30.0 | - When Admin sets the business date to "11 January 2026" And Admin runs inline COB job for Working Capital Loan by loanId Then Working Capital Loan has transactions: @@ -409,7 +392,6 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature And Working Capital Loan charge balances has the following data: | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | | 60.0 | 60.0 | 0.0 | 50.0 | 20.0 | 30.0 | - When Admin makes a charge adjustment for the last added penalty charge with 50.0 amount on working capital loan Then Working Capital Loan has transactions: | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | @@ -430,9 +412,7 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature | ASSET | 112603 | Interest/Fee Receivable | | 20.0 | And Working Capital loan status will be "ACTIVE" And Working Capital loan balance overpaymentAmount is "0.0" - When Customer undo "1"th "CHARGE_ADJUSTMENT" transaction made on "11 January 2026" on Working Capital loan - Then Working Capital Loan Transactions tab has a reversed "CHARGE_ADJUSTMENT" transaction with date "11 January 2026" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | INCOME | 404007 | Fee Income | 50.0 | | @@ -456,11 +436,10 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature And Working Capital Loan charge balances has the following data: | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | | 60.0 | 60.0 | 0.0 | 50.0 | 20.0 | 30.0 | - Then Admin closes the Working Capital loan with a full repayment on "11 January 2026" - @TestRailId:TODO_7 + @TestRailId:C89826 Scenario: Verify Working Capital fee charge adjustment accounting entries - UC7: fully repaid loan - partial fee charge adjustment has overpayment journal entries Given Admin sets the business date to "01 January 2026" And Admin creates a client with random data and creates-approves-disburses a working capital loan with the following data: @@ -491,10 +470,8 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature And Working Capital Loan charge balances has the following data: | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | | 45.0 | 0.0 | 45.0 | 0.0 | 0.0 | 0.0 | - When Admin sets the business date to "11 January 2026" And Admin runs inline COB job for Working Capital Loan by loanId - When Admin makes a charge adjustment for the last added fee charge with 25.0 amount on working capital loan Then Working Capital Loan has transactions: | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | @@ -514,16 +491,13 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature | LIABILITY | 245000 | Other Credit Liability | | 25.0 | Then Working Capital loan status will be "OVERPAID" And Working Capital loan balance overpaymentAmount is "25.0" - When Customer undo "1"th "CHARGE_ADJUSTMENT" transaction made on "11 January 2026" on Working Capital loan - Then Working Capital Loan Transactions tab has a reversed "CHARGE_ADJUSTMENT" transaction with date "11 January 2026" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | INCOME | 404007 | Fee Income | 25.0 | | | LIABILITY | 245000 | Other Credit Liability | | 25.0 | | INCOME | 404007 | Fee Income | | 25.0 | | LIABILITY | 245000 | Other Credit Liability | 25.0 | | - Then Working Capital loan status will be "CLOSED_OBLIGATIONS_MET" And Working Capital loan balance overpaymentAmount is "0.0" And Working Capital Loan has transactions: @@ -556,7 +530,7 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature | 45.0 | 45.0 | 0.0 | 0.0 | 0.0 | 0.0 | Then Admin closes the Working Capital loan with a full repayment on "11 January 2026" - @TestRailId:TODO_ADD_8 + @TestRailId:C89827 Scenario: Verify Working Capital penalty charge adjustment accounting entries - UC8: fully repaid loan - partial penalty charge adjustment has overpayment journal entries Given Admin sets the business date to "01 January 2026" And Admin creates a client with random data and creates-approves-disburses a working capital loan with the following data: @@ -587,10 +561,8 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature And Working Capital Loan charge balances has the following data: | Fee Amount | Fee Outstanding | Fee Paid | Penalty Amount | Penalty Outstanding | Penalty Paid | | 0.0 | 0.0 | 0.0 | 77.7 | 0.0 | 77.7 | - When Admin sets the business date to "11 January 2026" And Admin runs inline COB job for Working Capital Loan by loanId - When Admin makes a charge adjustment for the last added penalty charge with 50.0 amount on working capital loan Then Working Capital Loan has transactions: | transactionDate | type | transactionAmount | principalPortion | feeChargesPortion | penaltyChargesPortion | reversed | @@ -608,19 +580,15 @@ Feature: WorkingCapitalLoanChargeAdjustmentAccountingFeature | Type | Account code | Account name | Debit | Credit | | INCOME | 404007 | Fee Income | 50.0 | | | LIABILITY | 245000 | Other Credit Liability | | 50.0 | - Then Working Capital loan status will be "OVERPAID" And Working Capital loan balance overpaymentAmount is "50.0" - When Customer undo "1"th "CHARGE_ADJUSTMENT" transaction made on "11 January 2026" on Working Capital loan - Then Working Capital Loan Transactions tab has a reversed "CHARGE_ADJUSTMENT" transaction with date "11 January 2026" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | INCOME | 404007 | Fee Income | 50.0 | | | LIABILITY | 245000 | Other Credit Liability | | 50.0 | | INCOME | 404007 | Fee Income | | 50.0 | | LIABILITY | 245000 | Other Credit Liability | 50.0 | | - Then Working Capital loan status will be "CLOSED_OBLIGATIONS_MET" And Working Capital loan balance overpaymentAmount is "0.0" And Working Capital Loan has transactions: