FINERACT-2455: Working Capital Loan - Write-Off - #6223
Conversation
875df73 to
73e7c91
Compare
6152194 to
246c7ad
Compare
galovics
left a comment
There was a problem hiding this comment.
Migration and permission wiring are solid, WorkingCapitalLoanWriteOffDomainService is clean. One real gap:
// TODO(D3): confirm the backdating rule. The ticket says "not supporting backdated transactions"; progressive
// loans allow a floor at the last user transaction date. Add the agreed date constraint here once confirmed.The validator only checks "not null" and "not in the future" for the write-off date - the actual backdating restriction the ticket calls for is admittedly unresolved and unimplemented. As it stands, a write-off can be backdated to any past date (before other transactions, before disbursement, whatever), and the write-off domain service doesn't guard against it either (zeroes outstanding unconditionally). For a terminal, balance-zeroing operation this seems worth nailing down before merge rather than after - self-acknowledged TODOs on the actual validation rule the PR is supposed to implement are the kind of thing I'd want resolved, not shipped.
e6282ca to
d4e7c38
Compare
|
@alberto-art3ch Please kindly see my concerns:
Two consequences: With the maker-checker global config enabled, ConfigurationDomainServiceJpa.java:54 does permissionRepository.findOneByCode("WRITEOFF_WORKINGCAPITALLOAN") and throws PermissionNotFoundException — every write-off call fails.
Also the field was not added to PostWorkingCapitalLoanTransactionsRequest in WorkingCapitalLoanTransactionsApiResourceSwagger.java:192-215, even though chargeOffReasonId is there (line 209). So the generated client can't send a write-off reason at all, which is also why no test exercises it. Same for reversalExternalId on undo — accepted by the validator, absent from the request model.
Let's replicate the implementation from the progressive loan handling.
|
d4e7c38 to
056ce10
Compare
@adamsaghy all the points are addressed:
One open question on 3 before I align any further with core: |
@alberto-art3ch Thank you for the quick turnaround. Regarding the accounting in case the loan was already charged-off:
Progressive loan implementation: We are looking for the same for Working Capital |
056ce10 to
3a4ab1f
Compare
@adamsaghy Done! I've updated the accounting to be moved in the case of the Write-Off will be applied after the Charge-Off. Thanks! |
3a4ab1f to
3cab518
Compare
3cab518 to
1e4bc36
Compare
|
@alberto-art3ch Please rebase |
1e4bc36 to
4b0f5fb
Compare
a2f3abd to
b978ac4
Compare
b978ac4 to
5d32845
Compare
Description
Adds Write-Off and Undo Write-Off for Working Capital Loans, matching cumulative/progressive loans.
Write-off is terminal: zeroes outstanding balances and closes the loan as
CLOSED_WRITTEN_OFF; undo reopens it toACTIVEand restores the balance. Incoming parameters follow progressive loans.Accounting (accrual):
Dr LOSSES_WRITTEN_OFF(total) ·Cr LOAN_PORTFOLIO/FEES_RECEIVABLE/PENALTIES_RECEIVABLEper portion (no interest leg). Undo reverses via offsetting mirrors.Includes: domain/state machine + dedicated write-off domain service, transaction/handlers/API/validator wiring, accounting
WRITEOFFcase, business events, DB migration0063(0062reserved for the in-review Charge-Off PR), integration + E2E tests, and afineract-docchapter.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.