[ 
https://issues.apache.org/jira/browse/FINERACT-2550?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

devi pathak updated FINERACT-2550:
----------------------------------
    Description: 
In LoansApiResource.retrieveApprovalTemplate(...), unsupported templateType 
values are not explicitly validated. As a result, the API returns a successful 
response with a null/empty payload instead of throwing an error.

## *Steps to Reproduce*
1. Call the loan approval template API with templateType set to an unsupported 
value (e.g. "foo")
2. Observe that the API returns a 200 response with null/empty payload

## Expected Behavior
The API should validate templateType and throw 
NotSupportedLoanTemplateTypeException for unsupported values.

## *Actual Behavior*
Unsupported templateType values are not handled explicitly, resulting in 
null/empty responses.

## Proposed Solution
Add explicit validation for templateType and throw 
NotSupportedLoanTemplateTypeException, consistent with other template-related 
methods in LoansApiResource.

## *Impact*
- Prevents silent failures
- Ensures consistent API behavior
- Improves error handling and reliability

  was:
In LoansApiResource.retrieveApprovalTemplate(...), when templateType is not 
"approval", the API does not throw an error and instead returns a null/empty 
response.

*Steps to Reproduce*
1. Call the loan approval template API with templateType set to an unsupported 
value (e.g. "foo")
2. Observe that the API returns a successful response with null/empty payload

*Expected Behavior*
The API should validate templateType and reject unsupported values with a 
proper exception.

*Actual Behavior*
Unsupported templateType values are not handled explicitly, resulting in a 
null/empty response.

*Proposed Solution*
Add explicit validation for unsupported templateType and throw 
NotSupportedLoanTemplateTypeException, similar to existing handling in other 
methods of this class.

*Impact*
 - Prevents silent failures
 - Ensures consistent API behavior
 - Improves error handling and reliability


> Unsupported templateType returns null response in LoansApiResource
> ------------------------------------------------------------------
>
>                 Key: FINERACT-2550
>                 URL: https://issues.apache.org/jira/browse/FINERACT-2550
>             Project: Apache Fineract
>          Issue Type: Bug
>          Components: Loan
>            Reporter: devi pathak
>            Priority: Major
>              Labels: beginner, beginner-friendly
>
> In LoansApiResource.retrieveApprovalTemplate(...), unsupported templateType 
> values are not explicitly validated. As a result, the API returns a 
> successful response with a null/empty payload instead of throwing an error.
> ## *Steps to Reproduce*
> 1. Call the loan approval template API with templateType set to an 
> unsupported value (e.g. "foo")
> 2. Observe that the API returns a 200 response with null/empty payload
> ## Expected Behavior
> The API should validate templateType and throw 
> NotSupportedLoanTemplateTypeException for unsupported values.
> ## *Actual Behavior*
> Unsupported templateType values are not handled explicitly, resulting in 
> null/empty responses.
> ## Proposed Solution
> Add explicit validation for templateType and throw 
> NotSupportedLoanTemplateTypeException, consistent with other template-related 
> methods in LoansApiResource.
> ## *Impact*
> - Prevents silent failures
> - Ensures consistent API behavior
> - Improves error handling and reliability



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to