FINERACT-2181: Fix the API to return interestRecognitionOnDisbursementDate in GetLoanProductsResponse
This commit is contained in:
committed by
Adam Saghy
parent
f8d5bde921
commit
245b095195
+29
@@ -65,6 +65,7 @@ import org.apache.fineract.client.models.CommandProcessingResult;
|
||||
import org.apache.fineract.client.models.DeleteLoansLoanIdResponse;
|
||||
import org.apache.fineract.client.models.GetLoanProductsChargeOffReasonOptions;
|
||||
import org.apache.fineract.client.models.GetLoanProductsProductIdResponse;
|
||||
import org.apache.fineract.client.models.GetLoanProductsResponse;
|
||||
import org.apache.fineract.client.models.GetLoanProductsTemplateResponse;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdDelinquencySummary;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdLoanChargeData;
|
||||
@@ -3834,4 +3835,32 @@ public class LoanStepDef extends AbstractStepDef {
|
||||
assertThat(totalPagesActual).as(ErrorMessageHelper.wrongValueInTotalPages(totalPagesActual, totalPagesExpected))
|
||||
.isEqualTo(totalPagesExpected);
|
||||
}
|
||||
|
||||
@Then("Loan Product response contains interestRecognitionOnDisbursementDate flag with value {string}")
|
||||
public void verifyInterestRecognitionOnDisbursementDateFlag(final String expectedValue) throws IOException {
|
||||
final Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
assertNotNull(loanResponse.body());
|
||||
final Long loanId = loanResponse.body().getLoanId();
|
||||
|
||||
final Response<GetLoansLoanIdResponse> loanDetails = loansApi.retrieveLoan(loanId, false, "", "", "").execute();
|
||||
ErrorHelper.checkSuccessfulApiCall(loanDetails);
|
||||
assertNotNull(loanDetails.body());
|
||||
|
||||
final Long targetLoanProductId = loanDetails.body().getLoanProductId();
|
||||
|
||||
final Response<List<GetLoanProductsResponse>> allProductsResponse = loanProductsApi.retrieveAllLoanProducts().execute();
|
||||
ErrorHelper.checkSuccessfulApiCall(allProductsResponse);
|
||||
|
||||
assertNotNull(allProductsResponse.body());
|
||||
final List<GetLoanProductsResponse> loanProducts = allProductsResponse.body();
|
||||
assertThat(loanProducts).isNotEmpty();
|
||||
|
||||
final GetLoanProductsResponse targetProduct = loanProducts.stream().filter(product -> {
|
||||
assertNotNull(product.getId());
|
||||
return product.getId().equals(targetLoanProductId);
|
||||
}).findFirst().orElseThrow(() -> new AssertionError("Loan product with ID " + targetLoanProductId + " not found in response"));
|
||||
|
||||
assertNotNull(targetProduct.getInterestRecognitionOnDisbursementDate());
|
||||
assertThat(targetProduct.getInterestRecognitionOnDisbursementDate().toString()).isEqualTo(expectedValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,3 +207,9 @@ Feature: LoanProduct
|
||||
| Fraud | | 2 | true | false |
|
||||
| Delinquent | | 3 | true | false |
|
||||
| Other | | 4 | true | false |
|
||||
|
||||
Scenario: As a user I would like to verify interestRecognitionOnDisbursementDate flag in loan product response
|
||||
When Admin sets the business date to "01 January 2025"
|
||||
When Admin creates a client with random data
|
||||
And Admin successfully creates a new customised Loan submitted on date: "01 January 2025", with Principal: "1000", a loanTermFrequency: 1 months, and numberOfRepayments: 1
|
||||
Then Loan Product response contains interestRecognitionOnDisbursementDate flag with value "false"
|
||||
|
||||
+2
@@ -649,6 +649,8 @@ public final class LoanProductsApiResourceSwagger {
|
||||
public GetLoanProductsResponse.GetLoanProductsRepaymentStartDateType repaymentStartDateType;
|
||||
public List<StringEnumOptionData> supportedInterestRefundTypes;
|
||||
public StringEnumOptionData chargeOffBehaviour;
|
||||
@Schema(example = "false")
|
||||
public Boolean interestRecognitionOnDisbursementDate;
|
||||
}
|
||||
|
||||
@Schema(description = "GetLoanProductsTemplateResponse")
|
||||
|
||||
Reference in New Issue
Block a user