Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

FINERACT-2455: Working Capital Delinquency Disable and Enable - #6072

Merged
adamsaghy merged 2 commits into
apache:developfrom
openMF:FINERACT-2455/working-capital-delinquency-disable-enabled
Jul 22, 2026
Merged

adamsaghy merged 2 commits into
apache:developfrom
openMF:FINERACT-2455/working-capital-delinquency-disable-enabled

Conversation

@alberto-art3ch

Copy link
Copy Markdown
Contributor

Description

The Delinquency Disable feature allows authorized users to disable delinquency evaluation for a loan account under specific business scenarios (e.g., charge-off/write-off). Delinquency Disable shall be allowed only once until the current Delinquency disable is reversed.

FINERACT-2455

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.

Your assigned reviewer(s) will follow our guidelines for code reviews.

@alberto-art3ch
alberto-art3ch force-pushed the FINERACT-2455/working-capital-delinquency-disable-enabled branch 3 times, most recently from 4507fe9 to 4a1f644 Compare July 3, 2026 04:28

@Aman-Mittal Aman-Mittal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Review comments

@alberto-art3ch
alberto-art3ch force-pushed the FINERACT-2455/working-capital-delinquency-disable-enabled branch from 4a1f644 to ddf8b8a Compare July 3, 2026 17:09
@Aman-Mittal Aman-Mittal added Needs Functional Review PRs which pass build and have no obvious technical problems, but need functional review. java Pull requests that update Java code labels Jul 3, 2026

@galovics galovics left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good coverage (unit + integration), permissions actually seeded. One small thing.

0050_wc_loan_delinquency_disable.xml:

<changeSet author="fineract" id="wcl-0049-1">
...
<changeSet author="fineract" id="wcl-0049-2">

This is file 0050_... but the ids say wcl-0049-1/wcl-0049-2 - copy-pasted from 0049_wc_loan_breach_reset.xml without renumbering. Doesn't break anything since Liquibase's key includes the filename, but confusing to read later. Should be wcl-0050-1/wcl-0050-2.

@alberto-art3ch
alberto-art3ch force-pushed the FINERACT-2455/working-capital-delinquency-disable-enabled branch from ddf8b8a to f6949c1 Compare July 3, 2026 19:28
@alberto-art3ch
alberto-art3ch force-pushed the FINERACT-2455/working-capital-delinquency-disable-enabled branch from f6949c1 to c0b5f3a Compare July 13, 2026 03:10

@adamsaghy adamsaghy left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see some discrepancies between this logic and breach disable / enable:

1. Enable persistence model is different.

Breach persists a separate ENABLE row (the validator news up an ENABLE-typed action, it gets saveAndFlush'd as saved) and separately closes the DISABLE row. The delinquency PR persists no ENABLE row: the validator returns the existing active DISABLE (findActiveDisable), and the write service just stamps its endDate and re-saves it. So DelinquencyAction.ENABLE is added to the enum but never stored; the entityId returned on enable is the DISABLE's id. Weaker audit trail than breach, and an inconsistency with the precedent.

2. Enable end-date is off by one vs breach.

Breach closes the window at enableStart.minusDays(1): disable is in effect [start, enable-1], which is exactly why its query uses the inclusive endDate >= :date. The PR sets endDate = businessDate (the enable day itself) and queries endDate is null. So the two features disagree on whether the enable day is still "disabled," and that's coupled to the query difference from before: they're one design decision, made two different ways.

3. Disable/enable side-effects are genuinely new, not inherited from breach.

On DISABLE the PR actively calls liftDelinquencyClassification(loan, startDate); breach has no DISABLE branch at all in its write service (it just saves the row and relies on the eval guard). On ENABLE the PR treats the disabled window like a pause: extendPeriodsForPause + evaluateExpiredPeriods + classifyDelinquency: whereas breach only calls reprocessBreachSchedule and does not extend/pause periods. So the "disabled window behaves like a pause" behavior (which the PR's own comments claim mirrors breach) is not actually what breach does.

4. Bundled unrelated change (scope creep). InternalWorkingCapitalLoanApiResource.activateLoan now seeds WorkingCapitalLoanBalance (principal + discount, zero overpayment) to avoid the loan flipping to OVERPAID on repayment. Nothing to do with disable/enable: it's a fix to the internal activation helper riding along in this PR.

5. Likely docs build break, and diverges from the breach doc wiring.

The PR adds include::chapters/working-capital-disable/index.adoc[leveloffset=+1] to index.adoc, but that file doesn't exist in the tree and isn't added by the diff. Every other working-capital chapter: including breach (working-capital-breach-management.adoc): lives under chapters/features/ and is pulled in through features/index.adoc, not as a new top-level include. So this is both inconsistent with the breach approach and a dangling include that should fail the asciidoctor build.For balance, the thing I'd earlier have expected to differ but doesn't: the "block pause/resume/reschedule while disabled" guard is mirrored faithfully (breach.is.disabled → delinquency.is.disabled).

@alberto-art3ch
alberto-art3ch force-pushed the FINERACT-2455/working-capital-delinquency-disable-enabled branch from c0b5f3a to 37171f3 Compare July 21, 2026 00:34
@alberto-art3ch

Copy link
Copy Markdown
Contributor Author

I see some discrepancies between this logic and breach disable / enable:

1. Enable persistence model is different.

Breach persists a separate ENABLE row (the validator news up an ENABLE-typed action, it gets saveAndFlush'd as saved) and separately closes the DISABLE row. The delinquency PR persists no ENABLE row: the validator returns the existing active DISABLE (findActiveDisable), and the write service just stamps its endDate and re-saves it. So DelinquencyAction.ENABLE is added to the enum but never stored; the entityId returned on enable is the DISABLE's id. Weaker audit trail than breach, and an inconsistency with the precedent.

2. Enable end-date is off by one vs breach.

Breach closes the window at enableStart.minusDays(1): disable is in effect [start, enable-1], which is exactly why its query uses the inclusive endDate >= :date. The PR sets endDate = businessDate (the enable day itself) and queries endDate is null. So the two features disagree on whether the enable day is still "disabled," and that's coupled to the query difference from before: they're one design decision, made two different ways.

3. Disable/enable side-effects are genuinely new, not inherited from breach.

On DISABLE the PR actively calls liftDelinquencyClassification(loan, startDate); breach has no DISABLE branch at all in its write service (it just saves the row and relies on the eval guard). On ENABLE the PR treats the disabled window like a pause: extendPeriodsForPause + evaluateExpiredPeriods + classifyDelinquency: whereas breach only calls reprocessBreachSchedule and does not extend/pause periods. So the "disabled window behaves like a pause" behavior (which the PR's own comments claim mirrors breach) is not actually what breach does.

4. Bundled unrelated change (scope creep). InternalWorkingCapitalLoanApiResource.activateLoan now seeds WorkingCapitalLoanBalance (principal + discount, zero overpayment) to avoid the loan flipping to OVERPAID on repayment. Nothing to do with disable/enable: it's a fix to the internal activation helper riding along in this PR.

5. Likely docs build break, and diverges from the breach doc wiring.

The PR adds include::chapters/working-capital-disable/index.adoc[leveloffset=+1] to index.adoc, but that file doesn't exist in the tree and isn't added by the diff. Every other working-capital chapter: including breach (working-capital-breach-management.adoc): lives under chapters/features/ and is pulled in through features/index.adoc, not as a new top-level include. So this is both inconsistent with the breach approach and a dangling include that should fail the asciidoctor build.For balance, the thing I'd earlier have expected to differ but doesn't: the "block pause/resume/reschedule while disabled" guard is mirrored faithfully (breach.is.disabled → delinquency.is.disabled).

Thanks for the review, @adamsaghy — all valid. I've pushed a follow-up:

1 & 2. Enable persistence + end-date. Aligned with breach: enable now persists its own dedicated ENABLE row (so entityId is the ENABLE's id), and closes the disable at enableDate - 1. The "active disable" query now matches breach too (end_date IS NULL OR end_date >= :date).
3. Side-effects. The disable/enable effects are intentionally delinquency-specific (lift/reclassify vs. breach's schedule reprocess) — breach's schedule mechanics don't carry over. I fixed the misleading comments that claimed this "mirrors breach".
4. Docs. Moved the chapter under chapters/features/ and wired it through features/index.adoc; removed the dangling top-level include. asciidoctor builds clean now. (Root cause: the docs/ gitignore rule silently dropped the new .adoc/.puml files — force-added.)
5. Balance seed. This one is actually a prerequisite for this PR's own ITs (they repay activated loans via the internal helper, which flip to OVERPAID without the seed). Kept it here with a rationale comment, but happy to split it into its own PR if you'd prefer.

Anything else please let me know. Thanks!

@alberto-art3ch
alberto-art3ch force-pushed the FINERACT-2455/working-capital-delinquency-disable-enabled branch 2 times, most recently from 20c9423 to 866f16d Compare July 21, 2026 12:20
@alberto-art3ch
alberto-art3ch force-pushed the FINERACT-2455/working-capital-delinquency-disable-enabled branch from 866f16d to bf4b41c Compare July 21, 2026 19:37

@adamsaghy adamsaghy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@adamsaghy
adamsaghy merged commit dd7bda6 into apache:develop Jul 22, 2026
179 of 180 checks passed
@adamsaghy
adamsaghy deleted the FINERACT-2455/working-capital-delinquency-disable-enabled branch July 22, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

java Pull requests that update Java code Needs Functional Review PRs which pass build and have no obvious technical problems, but need functional review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants