You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "peter-kovacs-dpc (via GitHub)" <gi...@apache.org> on 2025/10/03 13:18:35 UTC
[PR] FINERACT-2358: Advanced-accounting-rules-based-on-write-off-reason E2E tests [fineract]
peter-kovacs-dpc opened a new pull request, #5075:
URL: https://github.com/apache/fineract/pull/5075
## Description
Describe the changes made and why they were made.
Ignore if these details are present on the associated [Apache Fineract JIRA ticket](https://issues.apache.org/jira/browse/FINERACT-2358).
## Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
- [ ] Write the commit message as per https://github.com/apache/fineract/#pull-requests
- [ ] Acknowledge that we will not review PRs that are not passing the build _("green")_ - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
- [ ] Create/update unit or integration tests for verifying the changes made.
- [ ] Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.
- [ ] Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
- [ ] Submission is not a "code dump". (Large changes can be made "in repository" via a branch. Ask on the developer mailing list for guidance, if required.)
FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2358: Advanced-accounting-rules-based-on-write-off-reason E2E tests [fineract]
Posted by "budaidev (via GitHub)" <gi...@apache.org>.
budaidev commented on code in PR #5075:
URL: https://github.com/apache/fineract/pull/5075#discussion_r2427159338
##########
fineract-e2e-tests-runner/src/test/resources/features/LoanWriteOff.feature:
##########
@@ -361,3 +361,103 @@
| Type | Account code | Account name | Debit | Credit |
| EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | | 750.0 |
| EXPENSE | e4 | Written off | 750.0 | |
+
+ @TestRailId:C4111
+ Scenario: Verify GL entries for Write Off reason mapping - UC1: Write off, LP with write off reason mapping, NO write off reason to expense account
+ When Admin sets the business date to "01 January 2025"
+ And Admin creates a client with random data
+ And Admin creates a fully customized loan with the following data:
+ | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy |
+ | LP2_PROGRESSIVE_ADVANCED_PAYMENT_ALLOCATION_WRITE_OFF_REASON_MAP | 01 January 2025 | 1000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 4 | MONTHS | 1 | MONTHS | 4 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
+ And Admin successfully approves the loan on "01 January 2025" with "1000" amount and expected disbursement date on "01 January 2025"
+ And Admin successfully disburse the loan on "01 January 2025" with "1000" EUR transaction amount
+ And Admin sets the business date to "02 January 2025"
+ And Admin runs inline COB job for Loan
+ And Admin does write-off the loan on "02 January 2025"
+ Then Loan status will be "CLOSED_WRITTEN_OFF"
+ And Loan Repayment schedule has 4 periods, with the following data for periods:
+ | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
+ | | | 01 January 2025 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
+ | 1 | 31 | 01 February 2025 | 02 January 2025 | 753.72 | 246.28 | 10.0 | 0.0 | 0.0 | 256.28 | 0.0 | 0.0 | 0.0 | 0.0 |
+ | 2 | 28 | 01 March 2025 | 02 January 2025 | 504.98 | 248.74 | 7.54 | 0.0 | 0.0 | 256.28 | 0.0 | 0.0 | 0.0 | 0.0 |
+ | 3 | 31 | 01 April 2025 | 02 January 2025 | 253.75 | 251.23 | 5.05 | 0.0 | 0.0 | 256.28 | 0.0 | 0.0 | 0.0 | 0.0 |
+ | 4 | 30 | 01 May 2025 | 02 January 2025 | 0.0 | 253.75 | 2.54 | 0.0 | 0.0 | 256.29 | 0.0 | 0.0 | 0.0 | 0.0 |
+ And Loan Repayment schedule has the following data in Total row:
+ | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
+ | 1000 | 25.13 | 0 | 0 | 1025.13 | 0 | 0 | 0 | 0.0 |
+ And Loan Transactions tab has the following data:
+ | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
+ | 01 January 2025 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
+ | 02 January 2025 | Close (as written-off) | 1025.13 | 1000.0 | 25.13 | 0.0 | 0.0 | 0.0 | false | false |
+ And Loan Transactions tab has a "WRITE_OFF" transaction with date "02 January 2025" which has the following Journal entries:
+ | Type | Account code | Account name | Debit | Credit |
+ | ASSET | 112601 | Loans Receivable | | 1000.0 |
+ | ASSET | 112603 | Interest/Fee Receivable | | 25.13 |
+ | EXPENSE | e4 | Written off | 1025.13 | |
+
+ @temp3
Review Comment:
Probably not needed, but please check this
##########
fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java:
##########
@@ -1913,8 +1913,20 @@ private void createJournalEntriesForLoanWriteOffs(final LoanDTO loanDTO, final L
* Single DEBIT transaction for write-offs
***/
if (MathUtil.isGreaterThanZero(totalDebitAmount)) {
- this.helper.createDebitJournalEntryForLoan(office, currencyCode, AccrualAccountsForLoan.LOSSES_WRITTEN_OFF.getValue(),
- loanProductId, paymentTypeId, loanId, transactionId, transactionDate, totalDebitAmount);
+ final AdvancedMappingtDTO writeAdvancedMappingtDTO = loanDTO.getWriteOffReasonAdvancedMappingData();
+ final ProductToGLAccountMapping mapping = (writeAdvancedMappingtDTO != null
+ && writeAdvancedMappingtDTO.getReferenceValueId() != null)
+ ? helper.getWriteOffMappingByCodeValue(loanProductId, PortfolioProductType.LOAN,
+ writeAdvancedMappingtDTO.getReferenceValueId())
+ : null;
+
+ if (mapping == null) {
+ this.helper.createDebitJournalEntryForLoan(office, currencyCode, AccrualAccountsForLoan.LOSSES_WRITTEN_OFF.getValue(),
+ loanProductId, paymentTypeId, loanId, transactionId, transactionDate, totalDebitAmount);
+ } else {
+ this.helper.createDebitJournalEntryForLoan(office, currencyCode, mapping.getGlAccount(), loanId, transactionId,
Review Comment:
is it possible to have mapping but no glAcccount? What happens in this case?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2358: Advanced-accounting-rules-based-on-write-off-reason E2E tests [fineract]
Posted by "peter-kovacs-dpc (via GitHub)" <gi...@apache.org>.
peter-kovacs-dpc commented on code in PR #5075:
URL: https://github.com/apache/fineract/pull/5075#discussion_r2429000389
##########
fineract-e2e-tests-runner/src/test/resources/features/LoanWriteOff.feature:
##########
@@ -361,3 +361,103 @@
| Type | Account code | Account name | Debit | Credit |
| EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | | 750.0 |
| EXPENSE | e4 | Written off | 750.0 | |
+
+ @TestRailId:C4111
+ Scenario: Verify GL entries for Write Off reason mapping - UC1: Write off, LP with write off reason mapping, NO write off reason to expense account
+ When Admin sets the business date to "01 January 2025"
+ And Admin creates a client with random data
+ And Admin creates a fully customized loan with the following data:
+ | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy |
+ | LP2_PROGRESSIVE_ADVANCED_PAYMENT_ALLOCATION_WRITE_OFF_REASON_MAP | 01 January 2025 | 1000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 4 | MONTHS | 1 | MONTHS | 4 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
+ And Admin successfully approves the loan on "01 January 2025" with "1000" amount and expected disbursement date on "01 January 2025"
+ And Admin successfully disburse the loan on "01 January 2025" with "1000" EUR transaction amount
+ And Admin sets the business date to "02 January 2025"
+ And Admin runs inline COB job for Loan
+ And Admin does write-off the loan on "02 January 2025"
+ Then Loan status will be "CLOSED_WRITTEN_OFF"
+ And Loan Repayment schedule has 4 periods, with the following data for periods:
+ | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
+ | | | 01 January 2025 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
+ | 1 | 31 | 01 February 2025 | 02 January 2025 | 753.72 | 246.28 | 10.0 | 0.0 | 0.0 | 256.28 | 0.0 | 0.0 | 0.0 | 0.0 |
+ | 2 | 28 | 01 March 2025 | 02 January 2025 | 504.98 | 248.74 | 7.54 | 0.0 | 0.0 | 256.28 | 0.0 | 0.0 | 0.0 | 0.0 |
+ | 3 | 31 | 01 April 2025 | 02 January 2025 | 253.75 | 251.23 | 5.05 | 0.0 | 0.0 | 256.28 | 0.0 | 0.0 | 0.0 | 0.0 |
+ | 4 | 30 | 01 May 2025 | 02 January 2025 | 0.0 | 253.75 | 2.54 | 0.0 | 0.0 | 256.29 | 0.0 | 0.0 | 0.0 | 0.0 |
+ And Loan Repayment schedule has the following data in Total row:
+ | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
+ | 1000 | 25.13 | 0 | 0 | 1025.13 | 0 | 0 | 0 | 0.0 |
+ And Loan Transactions tab has the following data:
+ | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
+ | 01 January 2025 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
+ | 02 January 2025 | Close (as written-off) | 1025.13 | 1000.0 | 25.13 | 0.0 | 0.0 | 0.0 | false | false |
+ And Loan Transactions tab has a "WRITE_OFF" transaction with date "02 January 2025" which has the following Journal entries:
+ | Type | Account code | Account name | Debit | Credit |
+ | ASSET | 112601 | Loans Receivable | | 1000.0 |
+ | ASSET | 112603 | Interest/Fee Receivable | | 25.13 |
+ | EXPENSE | e4 | Written off | 1025.13 | |
+
+ @temp3
Review Comment:
removed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2358: Advanced-accounting-rules-based-on-write-off-reason E2E tests [fineract]
Posted by "MarianaDmytrivBinariks (via GitHub)" <gi...@apache.org>.
MarianaDmytrivBinariks commented on code in PR #5075:
URL: https://github.com/apache/fineract/pull/5075#discussion_r2426697643
##########
fineract-e2e-tests-runner/src/test/resources/features/LoanWriteOff.feature:
##########
@@ -361,3 +361,103 @@
| Type | Account code | Account name | Debit | Credit |
| EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | | 750.0 |
| EXPENSE | e4 | Written off | 750.0 | |
+
+ @TestRailId:C4111
+ Scenario: Verify GL entries for Write Off reason mapping - UC1: Write off, LP with write off reason mapping, NO write off reason to expense account
+ When Admin sets the business date to "01 January 2025"
+ And Admin creates a client with random data
+ And Admin creates a fully customized loan with the following data:
+ | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy |
+ | LP2_PROGRESSIVE_ADVANCED_PAYMENT_ALLOCATION_WRITE_OFF_REASON_MAP | 01 January 2025 | 1000 | 12 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 4 | MONTHS | 1 | MONTHS | 4 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
+ And Admin successfully approves the loan on "01 January 2025" with "1000" amount and expected disbursement date on "01 January 2025"
+ And Admin successfully disburse the loan on "01 January 2025" with "1000" EUR transaction amount
+ And Admin sets the business date to "02 January 2025"
+ And Admin runs inline COB job for Loan
+ And Admin does write-off the loan on "02 January 2025"
+ Then Loan status will be "CLOSED_WRITTEN_OFF"
+ And Loan Repayment schedule has 4 periods, with the following data for periods:
+ | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
+ | | | 01 January 2025 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
+ | 1 | 31 | 01 February 2025 | 02 January 2025 | 753.72 | 246.28 | 10.0 | 0.0 | 0.0 | 256.28 | 0.0 | 0.0 | 0.0 | 0.0 |
+ | 2 | 28 | 01 March 2025 | 02 January 2025 | 504.98 | 248.74 | 7.54 | 0.0 | 0.0 | 256.28 | 0.0 | 0.0 | 0.0 | 0.0 |
+ | 3 | 31 | 01 April 2025 | 02 January 2025 | 253.75 | 251.23 | 5.05 | 0.0 | 0.0 | 256.28 | 0.0 | 0.0 | 0.0 | 0.0 |
+ | 4 | 30 | 01 May 2025 | 02 January 2025 | 0.0 | 253.75 | 2.54 | 0.0 | 0.0 | 256.29 | 0.0 | 0.0 | 0.0 | 0.0 |
+ And Loan Repayment schedule has the following data in Total row:
+ | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
+ | 1000 | 25.13 | 0 | 0 | 1025.13 | 0 | 0 | 0 | 0.0 |
+ And Loan Transactions tab has the following data:
+ | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
+ | 01 January 2025 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
+ | 02 January 2025 | Close (as written-off) | 1025.13 | 1000.0 | 25.13 | 0.0 | 0.0 | 0.0 | false | false |
+ And Loan Transactions tab has a "WRITE_OFF" transaction with date "02 January 2025" which has the following Journal entries:
+ | Type | Account code | Account name | Debit | Credit |
+ | ASSET | 112601 | Loans Receivable | | 1000.0 |
+ | ASSET | 112603 | Interest/Fee Receivable | | 25.13 |
+ | EXPENSE | e4 | Written off | 1025.13 | |
+
+ @temp3
Review Comment:
some note internal or for further usage?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2358: Advanced-accounting-rules-based-on-write-off-reason E2E tests [fineract]
Posted by "alberto-art3ch (via GitHub)" <gi...@apache.org>.
alberto-art3ch commented on code in PR #5075:
URL: https://github.com/apache/fineract/pull/5075#discussion_r2428974294
##########
fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java:
##########
@@ -1913,8 +1913,20 @@ private void createJournalEntriesForLoanWriteOffs(final LoanDTO loanDTO, final L
* Single DEBIT transaction for write-offs
***/
if (MathUtil.isGreaterThanZero(totalDebitAmount)) {
- this.helper.createDebitJournalEntryForLoan(office, currencyCode, AccrualAccountsForLoan.LOSSES_WRITTEN_OFF.getValue(),
- loanProductId, paymentTypeId, loanId, transactionId, transactionDate, totalDebitAmount);
+ final AdvancedMappingtDTO writeAdvancedMappingtDTO = loanDTO.getWriteOffReasonAdvancedMappingData();
+ final ProductToGLAccountMapping mapping = (writeAdvancedMappingtDTO != null
+ && writeAdvancedMappingtDTO.getReferenceValueId() != null)
+ ? helper.getWriteOffMappingByCodeValue(loanProductId, PortfolioProductType.LOAN,
+ writeAdvancedMappingtDTO.getReferenceValueId())
+ : null;
+
+ if (mapping == null) {
+ this.helper.createDebitJournalEntryForLoan(office, currencyCode, AccrualAccountsForLoan.LOSSES_WRITTEN_OFF.getValue(),
+ loanProductId, paymentTypeId, loanId, transactionId, transactionDate, totalDebitAmount);
+ } else {
+ this.helper.createDebitJournalEntryForLoan(office, currencyCode, mapping.getGlAccount(), loanId, transactionId,
Review Comment:
If you have a mapping you must to have a GLAccount
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2358: Advanced-accounting-rules-based-on-write-off-reason E2E tests [fineract]
Posted by "galovics (via GitHub)" <gi...@apache.org>.
galovics merged PR #5075:
URL: https://github.com/apache/fineract/pull/5075
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org