You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fineract.apache.org by "pwargulak (via GitHub)" <gi...@apache.org> on 2026/10/05 11:52:49 UTC

[PR] FINERACT-2896: Allow optional transactionDate when waiving a loan charge [fineract]

pwargulak opened a new pull request, #6578:
URL: https://github.com/apache/fineract/pull/6578

   ## Description
   
   [FINERACT-2896](https://issues.apache.org/jira/browse/FINERACT-2896)
   
   Waiving a loan charge gives no way to choose the waiver's transaction date. `LoanChargeWritePlatformServiceImpl` derives it from the charge's due date or the business date, and that date also drives the schedule recalculation and the lifecycle transition. A waiver that follows from an earlier event, such as a backdated repayment that settles the loan, therefore gets the processing date, and so does the loan's closing date.
   
   This change accepts an optional `transactionDate` (with `dateFormat`/`locale`) on `POST /loans/{loanId}/charges/{loanChargeId}?command=waive`. When it is given, it replaces the derived date for the waiver transaction, the recalculation and the lifecycle transition. It is validated in `LoanChargeValidator#validateChargeWaiverDate`: not in the future (`error.msg.loan.charge.waiver.cannot.be.a.future.date`) and not before disbursement (`error.msg.loan.charge.waiver.cannot.be.before.disbursement.date`). When it is absent, behaviour is unchanged; the existing derivation moves into `deriveWaiverTransactionDate` as is.
   
   Tests:
   - `LoanChargeValidatorTest` (new): absent, in-range, future and pre-disbursement dates.
   - `LoanChargeWritePlatformServiceImplTest`: the requested date reaches the transaction, the recalculation and the lifecycle transition; without it the derived date is kept.
   - `LoanWaiveChargeTest`: a backdated waiver closes the loan on the requested date (original and advanced strategies), and a future date is rejected.
   
   ## Checklist
   
   - [x] Write the commit message as per [our guidelines](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#pull-requests)
   - [x] 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.
   - [x] Create/update [unit or integration tests](https://fineract.apache.org/docs/current/#_testing) for verifying the changes made.
   - [x] Follow our [coding conventions](https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions).
   - [x] 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 (`PostLoansLoanIdChargesChargeIdRequest` already carries `transactionDate`; `apiLive.htm` does not document the loan charge waive)
   - [x] [This PR must not be a "code dump"](https://cwiki.apache.org/confluence/display/FINERACT/Pull+Request+Size+Limit). Large changes can be made in a branch, with assistance. Ask for help on the [developer mailing list](https://fineract.apache.org/#contribute).
   - [x] If merging this PR resolves a JIRA issue, I will mark that issue as resolved and set "Fix Version/s" appropriately.
   - [x] I followed the [AI Policy](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#ai-policy).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2896: Allow optional transactionDate when waiving a loan charge [fineract]

Posted by "pwargulak (via GitHub)" <gi...@apache.org>.
pwargulak commented on PR #6578:
URL: https://github.com/apache/fineract/pull/6578#issuecomment-6058974661

   @adamsaghy Good point. 
   
   For this PR I'd propose the minimal fix: reject a `transactionDate` earlier than the loan's last non-reversed monetary transaction (accruals excluded). Then nothing after the waiver can have touched the charge, so its amount is correct.
   
   Making WAIVE_CHARGES part of reverse-replay do sound as better, general solution, but it's a bigger change, I would make new ticket for that if thats OK?
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2896: Allow optional transactionDate when waiving a loan charge [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on PR #6578:
URL: https://github.com/apache/fineract/pull/6578#issuecomment-6059141211

   > @adamsaghy Good point.
   > 
   > For this PR I'd propose the minimal fix: reject a `transactionDate` earlier than the loan's last non-reversed monetary transaction (accruals excluded). Then nothing after the waiver can have touched the charge, so its amount is correct.
   > 
   > Making WAIVE_CHARGES part of reverse-replay do sound as better, general solution, but it's a bigger change, I would make new ticket for that if thats OK?
   
   Let me think this through... i need some example what happens if:
   - Charge was partial paid
   - Waive charge the rest
   - Repayment which partial paid got reversed or backdated repayment occurs


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2896: Allow optional transactionDate when waiving a loan charge [fineract]

Posted by "pwargulak (via GitHub)" <gi...@apache.org>.
pwargulak commented on PR #6578:
URL: https://github.com/apache/fineract/pull/6578#issuecomment-6090676351

   Thanks @adamsaghy, I thought about your scenarios more and I think you are right, with a partly paid charge and a reversed or backdated repayment the waived amount can be wrong, and the guard I proposed only hides part of it. The proper fix is to make the waive part of reverse-replay, which is a bigger change than this PR.
   
   In the meantime our own project went a different way and we don't depend on this anymore, so I don't want to keep a half-solution open here. I'm closing this PR. I'll leave a note on FINERACT-2896 with the scenarios so whoever picks it up has them.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2896: Allow optional transactionDate when waiving a loan charge [fineract]

Posted by "pwargulak (via GitHub)" <gi...@apache.org>.
pwargulak closed pull request #6578: FINERACT-2896: Allow optional transactionDate when waiving a loan charge
URL: https://github.com/apache/fineract/pull/6578


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2896: Allow optional transactionDate when waiving a loan charge [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on PR #6578:
URL: https://github.com/apache/fineract/pull/6578#issuecomment-6058050784

   @pwargulak I think we need to make part of the reverse-replay flow the waive charge transaction, before we are allowing to have a transaction date. What do you think? If the waive charge is on different date, the transaction amount can vary based on a repayment paid how much of the charge.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org