Skip to content

FINERACT-2646: Decouple accounting from charge via chargeId reference#6106

Open
mansi75 wants to merge 5 commits into
apache:developfrom
mansi75:FINERACT-2646-decouple-accounting
Open

FINERACT-2646: Decouple accounting from charge via chargeId reference#6106
mansi75 wants to merge 5 commits into
apache:developfrom
mansi75:FINERACT-2646-decouple-accounting

Conversation

@mansi75

@mansi75 mansi75 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Description

This PR addresses FINERACT-2646 by decoupling the accounting module from the charge domain dependency.

The accounting code previously depended on charge domain objects directly. This change updates the accounting side to use the 'chargeId' reference instead, so accounting can identify and process charge-related mappings without requiring a direct dependency on the charge package/module.

This helps improve module boundaries and supports the ongoing Fineract modularization effort by reducing cross-feature coupling between accounting and charge. FINERACT-2646 is listed as a sub-task for decoupling the accounting package/module from third-party domains. :contentReference[oaicite:0]{index=0}

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Write the commit message as per our guidelines
  • 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 our 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
  • This PR must not be a "code dump". Large changes can be made in a branch, with assistance. Ask for help on the developer mailing list.

Copilot AI review requested due to automatic review settings July 8, 2026 19:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements FINERACT-2646 by removing accounting’s dependency on charge domain objects, switching accounting-side charge-related mappings to use chargeId references and (where needed) direct SQL reads of charge metadata. It also introduces a Modulith-based boundary test to prevent future cross-feature coupling regressions.

Changes:

  • Replaced ProductToGLAccountMapping’s Charge association with a scalar chargeId and updated related repository queries and mapping helpers.
  • Reworked fee/penalty-to-income mapping reads to join m_charge via JdbcTemplate (to avoid charge-domain navigation and EclipseLink native query binding issues).
  • Added an accounting cross-feature dependency boundary test (Spring Modulith) and adjusted accounting module test/build dependencies.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
fineract-loan/src/main/java/org/apache/fineract/accounting/productaccountmapping/service/LoanProductToGLAccountMappingHelper.java Aligns constructor/super wiring with removal of charge-domain dependency.
fineract-accounting/src/test/java/org/apache/fineract/accounting/AccountingCrossFeatureBoundaryTest.java Adds Modulith-based boundary test to detect cross-feature type references from accounting.
fineract-accounting/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/WorkingCapitalLoanProductAdvancedAccountingReadHelper.java Reads charge name via SQL join instead of charge domain; maps to accounting DTOs.
fineract-accounting/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ShareProductToGLAccountMappingHelper.java Removes charge-domain constructor dependency.
fineract-accounting/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/SavingsProductToGLAccountMappingHelper.java Removes charge-domain constructor dependency and related comment block.
fineract-accounting/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java Reworks charge-income mapping reads via JDBC and updates mapping behavior accordingly.
fineract-accounting/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingHelper.java Stores chargeId instead of a Charge reference when persisting mappings.
fineract-accounting/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/domain/ProductToGLAccountMappingRepository.java Updates JPQL to use chargeId column and removes charge-domain-specific queries.
fineract-accounting/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/domain/ProductToGLAccountMapping.java Replaces Charge relation with Long chargeId field.
fineract-accounting/dependencies.gradle Adds Modulith test dependency/version; currently still declares :fineract-charge implementation dependency.
fineract-accounting/build.gradle Increases test JVM heap/metaspace limits for the accounting module.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread fineract-accounting/dependencies.gradle Outdated
Comment thread fineract-accounting/build.gradle
@mansi75 mansi75 force-pushed the FINERACT-2646-decouple-accounting branch from fd16395 to 84fa296 Compare July 9, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants