rhopman commented on PR #5500:
URL: https://github.com/apache/fineract/pull/5500#issuecomment-4003978213

   Hi @Abdelrahman-358! Thanks for tackling this issue. I think the approach is 
on the right track, but there are a few critical issues that concern me:
   
   ### Validation Bypass
   
   The `hasGroupSavingsAccountGuarantor` flag currently **disables the 
self-guarantee validation entirely**. This means a client could get a loan 
approved with:
   - Group savings guarantee: 2,500 (25% external)
   - Own funds: **0**
   
   Even if the product requires minimum own-funds. I would say the group 
savings should count as **external guarantee**, but other validation 
requirements should still apply.
   
   **Fix:** Remove the flag and the conditional check on line 146. All 
validations should run normally - we're just classifying guarantees differently.
   
   ### Missing Group Loan Support
   
   I would say a group loan that has a group savings account from the **same 
group** as guarantor should count as **self-guarantee**. Currently, all group 
savings accounts are treated as external guarantee. We need to check:
   
   ```java
   if (loan.getGroupId() != null && 
loan.getGroupId().equals(savingsAccount.getGroupId())) {
       // Count as self-guarantee
   } else {
       // Count as external guarantee
   }
   ```
   
   ### Business Logic
   
   The complete logic should be:
   - **Group loan** with **same group's savings** → self-guarantee
   - **Client loan** with **any group savings** → external guarantee (you have 
this)
   - **Group loan** with **different group's savings** → external guarantee
   
   ### Suggested Changes
   
   1. **Remove lines 119 and 146** (the `hasGroupSavingsAccountGuarantor` flag 
and its usage)
   2. **Update the classification logic** (lines 128-136) to handle group loans 
properly
   3. **Add a test** for group loan + same group savings scenario
   4. **(Optional)** Migrate the test helper to use fineract-client instead of 
the deprecated approach
   
   Let me know if you need help or clarification!


-- 
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