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

   ## Description
   
   Resolves FINERACT-1152.
   
   The core issue here was that you couldn't extend a loan's tenure 
(`extraTerms`) and change its EMI at the same time because the validation threw 
an error if the new `endDate` didn't already exist in the schedule. 
   
   **What I changed:**
   1. **Relaxed End Date Validation:** Tweaked 
[LoanRescheduleRequestDataValidatorImpl](cci:2://file:///home/deathgun/fineract/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/data/LoanRescheduleRequestDataValidatorImpl.java:52:0-408:1)
 so that if `extraTerms > 0`, we allow the `endDate` to fall on a future, 
projected installment date.
   2. **Blanket EMI Variations:** The old logic tried to map new EMIs to 
specific existing installments using a loop. I rewrote 
[LoanRescheduleRequestWritePlatformServiceImpl](cci:2://file:///home/deathgun/fineract/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/service/LoanRescheduleRequestWritePlatformServiceImpl.java:92:0-574:1)
 to use a blanket term variation instead (`isSpecificToInstallment=false`). 
Now, the schedule generator will naturally apply the new EMI across all future 
installments, including the newly requested ones.
   3. **Fineract-Client & Tests:** To properly test this, I realized the 
Swagger API docs were missing the `emi` and `endDate` fields for rescheduling 
requests. I added them in, regenerated the `fineract-client` SDK, and then 
wrote a modern integration test 
([testCreateLoanRescheduleChangeEMIWithExtraTerms](cci:1://file:///home/deathgun/fineract/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanRescheduleRequestTest.java:412:4-437:5))
 bypassing the legacy RestAssured models to prove the fix works perfectly!
   
   ## Checklist
   
   - [x] Write the commit message as per our guidelines
   - [x] Acknowledge that we will not review PRs that are not passing the build
   - [x] Create/update unit or integration tests
   - [x] Follow our coding conventions
   - [x] Add required Swagger annotation and update API documentation
   - [x] This PR must not be a "code dump"
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to