FINERACT-2455: Working Capital Loan - Recovery payment transaction - #6301
Open
alberto-art3ch wants to merge 1 commit into
Open
FINERACT-2455: Working Capital Loan - Recovery payment transaction#6301alberto-art3ch wants to merge 1 commit into
alberto-art3ch wants to merge 1 commit into
Conversation
alberto-art3ch
force-pushed
the
FINERACT-2455/working-capital-loan-recovery-payment
branch
from
August 21, 2026 01:23
0a47c97 to
42f9e7b
Compare
alberto-art3ch
marked this pull request as ready for review
August 21, 2026 01:24
galovics
approved these changes
Aug 21, 2026
galovics
left a comment
Contributor
There was a problem hiding this comment.
Went back over the money-critical paths specifically - recovery-cap race, transaction boundaries, authorization, rounding - since this is a new feature that moves money. All of it holds up:
- The recovery cap is read and written inside one transaction, and
WorkingCapitalLoanBalancecarries@Version, so two concurrent recovery payments can't both pass - the loser gets an optimistic-lock failure rather than an over-recovery. - Command handler and write service are both
@Transactional, transaction/balance/journal entries commit or roll back together. - Authorization goes through the command framework (
RECOVERYPAYMENT_WORKINGCAPITALLOAN), not just the migration seeding a permission row - confirmed the write service is actually gated by it. - Rounding/locale handling matches the rest of the module (same
MathContext, sameLocale.USparsing as disbursement/repayment) - nothing new introduced here. - Liquibase migration only inserts config rows with
MARK_RANpreconditions, no deletes - follows the write-off PR's pattern correctly.
A few things worth addressing as follow-ups, not blockers:
undoRecoveryPaymentdoesn't emit the genericWorkingCapitalLoanTransactionReversedBusinessEventthat every other WC reversal emits alongside its specific event - a consumer reconciling reversals generically will miss recovery reversals.- No unit test for the write service itself (
WorkingCapitalLoanRecoveryPaymentWriteServiceImpl) - the PR has good unit coverage for the balance math and validation, but the actual balance-mutation/JE-posting/event-emission logic is only covered by integration/e2e tests, which don't run in the fast build. The write-off feature has a dedicated unit test for its write service; a mirror of that would be good here. - Two stranded Javadoc blocks left over from the diff (
AccrualWithDeferredRevenueAmortizationAccountingProcessorForWorkingCapitalLoanandWorkingCapitalLoanDataValidator) - worth a quick cleanup pass. MathUtil.subtract(...).max(BigDecimal.ZERO)on the undo path isn't null-safe if the first argument were ever null, and it silently floors at zero rather than failing iftotalRecoveredwere ever less than the reversed amount - unreachable today given the NOT NULL/default-0 columns, but worth thenullToZeroidiom used elsewhere in the class for consistency, and I'd rather this fail loudly than clamp silently on a money path.
Recommendation: APPROVE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
We are adding the Recovery Payment to Working Capital Loans (
?command=recoveryPayment, reversible via the generic transaction undo)The collections after a write-off book as Dr Fund Source / Cr Income from Recovery, the loan stays CLOSED_WRITTEN_OFF and its balance stays zeroed.
Each recovery is capped by the remaining recoverable amount rather than the gross written off — diverging from term loans, where successive recoveries can exceed the booked loss — and undo write-off is blocked while any recovery stands. Read model and template updated.
FINERACT-2455
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
Your assigned reviewer(s) will follow our guidelines for code reviews.