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

   
   `TaxGroup.findOneBy(TaxGroupMappings)` threw `TaxMappingNotFoundException` 
as soon as the **first** existing mapping in the set didn't match the one being 
looked up, instead of checking the rest of the set. With a tax group that has 
more than one component mapping, this meant editing/adding a component could 
randomly fail with an Internal Server Error depending on iteration order, even 
though a matching mapping existed further down the set. The same method could 
also throw an NPE via `groupMappings.getId().equals(...)` when an existing 
mapping's id was itself `null`.
   
   This PR:
   - Fixes `findOneBy` to scan the full set of existing mappings and only throw 
`TaxMappingNotFoundException` if none of them match, using `Objects.equals` to 
avoid the NPE on a null id.
   - Exposes a `businessDate` field on `TaxGroupData` (populated from 
`DateUtils.getBusinessLocalDate()` when fetching a single tax group), so a 
client can validate a new tax component's start date against the system 
business date before submitting, instead of relying on the server round-trip to 
reject it.
    ## Changes                                                                  
                                                                     
                                                                                
                                                                      
     - `TaxGroup#findOneBy`: iterate over all mappings before giving up, 
`Objects.equals` instead of `.getId().equals(...)`                           
     - `TaxGroupData`: new `businessDate` field + 
`withBusinessDate(TaxGroupData, LocalDate)` factory (mirrors the existing 
`template(...)`           
     copy-factory pattern); existing `lookup()`/`template()` factories updated 
to carry the field through                                             
     - `TaxGroupMapper`: `businessDate` marked `ignore` in the MapStruct 
mapping (it's computed, not entity data)                                     
     - `TaxReadPlatformServiceImpl#retrieveTaxGroupData`: populates 
`businessDate` on the returned `TaxGroupData`   
     PR:(https://issues.apache.org/jira/browse/FINERACT-2772)


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