Conversation
6874513 to
bd41cb4
Compare
31dd361 to
5232cde
Compare
|
@oleksii-novikov-onix Please review my finding / concern: AccrualWithDeferredRevenueAmortizationAccountingProcessorForWorkingCapitalLoanTest.java:169 — (low, test-coverage) The unit test is touched only to stub ACC_DEF_REV_AM so existing tests stay green; nothing asserts the new NONE short-circuit. A tenth method added without the guard, or a guard dropped in a refactor, would pass every unit test and only surface as the runtime exception this PR fixes. A test stubbing NONE and asserting verifyNoInteractions(helper, journalEntryRepository) across the interface would close it. |
5232cde to
5fa56e7
Compare
5fa56e7 to
3ac237b
Compare
Covered, the test loops over every method of the interface with NONE stubbed and asserts verifyNoInteractions(helper, journalEntryRepository), so a newly added method is caught automatically. |
…e no accounting is configured
3ac237b to
ebdd96a
Compare
galovics
left a comment
There was a problem hiding this comment.
The fix is correct. I traced every accrual entry point (COB, real-time on charge add, closure accruals via accrueOnClosure) - they all go through WorkingCapitalLoanChargeAccrualService and already skip when posting is disabled, so no ACCRUAL transaction can exist on a no-accounting loan. The two callers that were actually missing a check (reverseDiscountFeeAmortizationAdjustments and the accrual reversal in undo disbursal) are covered by the new guard in the processor - the first one was a real bug, since reverseExistingEntries calls checkForBranchClosures before looking up any journal entries, so undoing a discount fee adjustment on a no-accounting loan failed with a 403 if the office's accounting was closed (C106704 reproduces it). No balance or summary field reads accrual transactions, so nothing goes stale when they're skipped.
One design question, not blocking: the description says the two call sites now check whether the product has accounting, but the diff puts the check inside the processor on every entry point, while ~25 other call sites still check isAccrualWithDeferredRevenueAmortization() before calling it. I'd pick one place to own this rule. If the processor owns it (probably better - your reflection test enforces it for every new interface method), let's remove the call-site checks and the accountingEnabled flags passed around in the amortization and reprocessing services; if the call sites keep it, add the check at the two missing ones and leave the processor alone. Having both is how we got the uneven checks in the first place. A follow-up is fine.
Small things: C106708's title says "undo disbursal with a live charge accrual is rejected" but the 403 comes from the disbursement's own reversal before the accrual is reached, so it would fail the same way without an accrual - worth renaming. And a pre-existing edge, not from this PR: accountingRule on a product can be changed while loans have journal entries, which orphans them once every check skips - worth a ticket.
Recommendation: APPROVE
Description
Description:
When a Working Capital product has no accounting (NONE), accruals and accrual adjustments should not be created, but discount fee amortization and amortization adjustments should.
Already in develop:
This PR adds:
Two remaining places could reach accounting code without checking whether the product has accounting. Both now check it, which matches how regular loans behave.
E2E tests for the cases that had no coverage for products without accounting:
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.