This is an automated email from the ASF dual-hosted git repository.

adamsaghy pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git


The following commit(s) were added to refs/heads/develop by this push:
     new 4afa9728b8 FINERACT-2421: Loan product basic detail endpoint
4afa9728b8 is described below

commit 4afa9728b889acdabc759c9804c608b0394a4cf4
Author: Jose Alberto Hernandez <[email protected]>
AuthorDate: Sun Mar 1 19:12:42 2026 -0500

    FINERACT-2421: Loan product basic detail endpoint
---
 .../fineract/client/util/FineractClient.java       |  3 ++
 .../api/LoanProductsDetailsApiResource.java        | 62 ++++++++++++++++++++++
 .../data/LoanProductBasicDetailsData.java          | 36 +++++++++++++
 .../loanproduct/domain/LoanProductRepository.java  |  4 ++
 .../mapper/LoanProductBasicDetailsMapper.java      | 45 ++++++++++++++++
 .../LoanProductReadBasicDetailsService.java        | 28 ++++++++++
 .../LoanProductReadBasicDetailsServiceImpl.java    | 43 +++++++++++++++
 .../service/LoanProductReadPlatformService.java    |  1 +
 ...orkingCapitalLoanProductBasicDetailsMapper.java | 45 ++++++++++++++++
 .../WorkingCapitalLoanProductRepository.java       |  4 ++
 ...italLoanProductReadBasicDetailsServiceImpl.java | 45 ++++++++++++++++
 .../LoanProductBasicDetailsTest.java               | 41 ++++++++++++++
 .../common/loans/LoanProductHelper.java            |  6 +++
 13 files changed, 363 insertions(+)

diff --git 
a/fineract-client/src/main/java/org/apache/fineract/client/util/FineractClient.java
 
b/fineract-client/src/main/java/org/apache/fineract/client/util/FineractClient.java
index 23f3dff5b3..a10c5c6959 100644
--- 
a/fineract-client/src/main/java/org/apache/fineract/client/util/FineractClient.java
+++ 
b/fineract-client/src/main/java/org/apache/fineract/client/util/FineractClient.java
@@ -95,6 +95,7 @@ import org.apache.fineract.client.services.LoanCollateralApi;
 import org.apache.fineract.client.services.LoanDisbursementDetailsApi;
 import org.apache.fineract.client.services.LoanInterestPauseApi;
 import org.apache.fineract.client.services.LoanProductsApi;
+import org.apache.fineract.client.services.LoanProductsDetailsApi;
 import org.apache.fineract.client.services.LoanReschedulingApi;
 import org.apache.fineract.client.services.LoanTransactionsApi;
 import org.apache.fineract.client.services.LoansApi;
@@ -238,6 +239,7 @@ public final class FineractClient {
     public final LoanCollateralApi loanCollaterals;
     public final LoanCapitalizedIncomeApi loanCapitalizedIncome;
     public final LoanProductsApi loanProducts;
+    public final LoanProductsDetailsApi loanProductsDetails;
     public final LoanReschedulingApi loanSchedules;
     public final LoansPointInTimeApi loansPointInTimeApi;
     public final LoansApi loans;
@@ -371,6 +373,7 @@ public final class FineractClient {
         loanCollaterals = retrofit.create(LoanCollateralApi.class);
         loanCapitalizedIncome = 
retrofit.create(LoanCapitalizedIncomeApi.class);
         loanProducts = retrofit.create(LoanProductsApi.class);
+        loanProductsDetails = retrofit.create(LoanProductsDetailsApi.class);
         loanSchedules = retrofit.create(LoanReschedulingApi.class);
         loansPointInTimeApi = retrofit.create(LoansPointInTimeApi.class);
         loans = retrofit.create(LoansApi.class);
diff --git 
a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsDetailsApiResource.java
 
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsDetailsApiResource.java
new file mode 100644
index 0000000000..1225006b99
--- /dev/null
+++ 
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsDetailsApiResource.java
@@ -0,0 +1,62 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.portfolio.loanproduct.api;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.Context;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.UriInfo;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import lombok.RequiredArgsConstructor;
+import 
org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
+import 
org.apache.fineract.portfolio.loanproduct.data.LoanProductBasicDetailsData;
+import 
org.apache.fineract.portfolio.loanproduct.service.LoanProductReadBasicDetailsService;
+import org.springframework.stereotype.Component;
+
+@Path("/v1/loanproducts")
+@Component
+@Tag(name = "Loan Products Details", description = "Loan product basic details 
to be listed")
+@RequiredArgsConstructor
+public class LoanProductsDetailsApiResource {
+
+    private static final String RESOURCE_NAME_FOR_PERMISSIONS = "LOANPRODUCT";
+    private final PlatformSecurityContext context;
+    private final List<LoanProductReadBasicDetailsService> 
loanProductReadBasicDetailsServices;
+
+    @GET
+    @Path("basic-details")
+    @Consumes({ MediaType.APPLICATION_JSON })
+    @Produces({ MediaType.APPLICATION_JSON })
+    @Operation(summary = "List Loan Products with basic details", description 
= "Lists Loan Products with basic details to be listed")
+    public Collection<LoanProductBasicDetailsData> fetchProducts(@Context 
final UriInfo uriInfo) {
+        
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
+
+        Collection<LoanProductBasicDetailsData> products = new ArrayList<>();
+        loanProductReadBasicDetailsServices.forEach(service -> 
products.addAll(service.retrieveProducts()));
+        return products;
+    }
+
+}
diff --git 
a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductBasicDetailsData.java
 
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductBasicDetailsData.java
new file mode 100644
index 0000000000..b5b7c83aaa
--- /dev/null
+++ 
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductBasicDetailsData.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.portfolio.loanproduct.data;
+
+import lombok.Data;
+import lombok.RequiredArgsConstructor;
+import org.apache.fineract.organisation.monetary.data.CurrencyData;
+
+@Data
+@RequiredArgsConstructor
+public class LoanProductBasicDetailsData {
+
+    private final String productType;
+    private final Long id;
+    private final String name;
+    private final String shortName;
+    private final String description;
+    private final CurrencyData currency;
+
+}
diff --git 
a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductRepository.java
 
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductRepository.java
index 78314991b2..6a35428a31 100644
--- 
a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductRepository.java
+++ 
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductRepository.java
@@ -18,6 +18,7 @@
  */
 package org.apache.fineract.portfolio.loanproduct.domain;
 
+import java.time.LocalDate;
 import java.util.List;
 import org.apache.fineract.infrastructure.core.domain.ExternalId;
 import org.apache.fineract.portfolio.delinquency.domain.DelinquencyBucket;
@@ -41,4 +42,7 @@ public interface LoanProductRepository extends 
JpaRepository<LoanProduct, Long>,
     @Override
     @Query("SELECT CASE WHEN COUNT(loanProduct)>0 THEN TRUE ELSE FALSE END 
FROM LoanProduct loanProduct WHERE loanProduct.id = :loanProductId")
     boolean existsById(@NonNull @Param("loanProductId") Long loanProductId);
+
+    @Query("select loanProduct from LoanProduct loanProduct where 
loanProduct.closeDate is null or loanProduct.closeDate >= :businessDate")
+    List<LoanProduct> fetchActiveLoanProducts(LocalDate businessDate);
 }
diff --git 
a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/mapper/LoanProductBasicDetailsMapper.java
 
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/mapper/LoanProductBasicDetailsMapper.java
new file mode 100644
index 0000000000..26f1d4a6be
--- /dev/null
+++ 
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/mapper/LoanProductBasicDetailsMapper.java
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.portfolio.loanproduct.mapper;
+
+import java.util.List;
+import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
+import org.apache.fineract.organisation.monetary.data.CurrencyData;
+import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
+import 
org.apache.fineract.portfolio.loanproduct.data.LoanProductBasicDetailsData;
+import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.Named;
+
+@Mapper(config = MapstructMapperConfig.class)
+public interface LoanProductBasicDetailsMapper {
+
+    @Mapping(target = "productType", constant = "loan")
+    @Mapping(target = "currency", source = 
"loanProductRelatedDetail.currency", qualifiedByName = "currencyData")
+    LoanProductBasicDetailsData map(LoanProduct source);
+
+    List<LoanProductBasicDetailsData> map(List<LoanProduct> source);
+
+    @Named("currencyData")
+    default CurrencyData currencyData(final MonetaryCurrency currency) {
+        return currency.toData();
+    }
+
+}
diff --git 
a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductReadBasicDetailsService.java
 
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductReadBasicDetailsService.java
new file mode 100644
index 0000000000..b790823e81
--- /dev/null
+++ 
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductReadBasicDetailsService.java
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.portfolio.loanproduct.service;
+
+import java.util.Collection;
+import 
org.apache.fineract.portfolio.loanproduct.data.LoanProductBasicDetailsData;
+
+public interface LoanProductReadBasicDetailsService {
+
+    Collection<LoanProductBasicDetailsData> retrieveProducts();
+
+}
diff --git 
a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductReadBasicDetailsServiceImpl.java
 
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductReadBasicDetailsServiceImpl.java
new file mode 100644
index 0000000000..b966dc6b59
--- /dev/null
+++ 
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductReadBasicDetailsServiceImpl.java
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.portfolio.loanproduct.service;
+
+import java.util.Collection;
+import lombok.RequiredArgsConstructor;
+import org.apache.fineract.infrastructure.core.service.DateUtils;
+import 
org.apache.fineract.portfolio.loanproduct.data.LoanProductBasicDetailsData;
+import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRepository;
+import 
org.apache.fineract.portfolio.loanproduct.mapper.LoanProductBasicDetailsMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional(readOnly = true)
+@RequiredArgsConstructor
+public class LoanProductReadBasicDetailsServiceImpl implements 
LoanProductReadBasicDetailsService {
+
+    private final LoanProductBasicDetailsMapper loanProductBasicDetailsMapper;
+    private final LoanProductRepository loanProductRepository;
+
+    @Override
+    public Collection<LoanProductBasicDetailsData> retrieveProducts() {
+        return 
loanProductBasicDetailsMapper.map(loanProductRepository.fetchActiveLoanProducts(DateUtils.getBusinessLocalDate()));
+    }
+
+}
diff --git 
a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductReadPlatformService.java
 
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductReadPlatformService.java
index d6ddef51a8..5536b45b33 100644
--- 
a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductReadPlatformService.java
+++ 
b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductReadPlatformService.java
@@ -57,4 +57,5 @@ public interface LoanProductReadPlatformService {
     Collection<CreditAllocationData> retrieveCreditAllocationData(Long 
loanProductId);
 
     LoanProductData retrieveLoanProductFloatingDetails(Long loanProductId);
+
 }
diff --git 
a/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloanproduct/mapper/WorkingCapitalLoanProductBasicDetailsMapper.java
 
b/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloanproduct/mapper/WorkingCapitalLoanProductBasicDetailsMapper.java
new file mode 100644
index 0000000000..9dd7fdf87d
--- /dev/null
+++ 
b/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloanproduct/mapper/WorkingCapitalLoanProductBasicDetailsMapper.java
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.portfolio.workingcapitalloanproduct.mapper;
+
+import java.util.List;
+import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
+import org.apache.fineract.organisation.monetary.data.CurrencyData;
+import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
+import 
org.apache.fineract.portfolio.loanproduct.data.LoanProductBasicDetailsData;
+import 
org.apache.fineract.portfolio.workingcapitalloanproduct.domain.WorkingCapitalLoanProduct;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.Named;
+
+@Mapper(config = MapstructMapperConfig.class)
+public interface WorkingCapitalLoanProductBasicDetailsMapper {
+
+    @Mapping(target = "productType", constant = "working-capital")
+    @Mapping(target = "currency", source = "currency", qualifiedByName = 
"currencyData")
+    LoanProductBasicDetailsData map(WorkingCapitalLoanProduct source);
+
+    List<LoanProductBasicDetailsData> map(List<WorkingCapitalLoanProduct> 
source);
+
+    @Named("currencyData")
+    default CurrencyData currencyData(final MonetaryCurrency currency) {
+        return currency.toData();
+    }
+
+}
diff --git 
a/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloanproduct/repository/WorkingCapitalLoanProductRepository.java
 
b/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloanproduct/repository/WorkingCapitalLoanProductRepository.java
index 2fe8c754f6..c8f647157b 100644
--- 
a/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloanproduct/repository/WorkingCapitalLoanProductRepository.java
+++ 
b/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloanproduct/repository/WorkingCapitalLoanProductRepository.java
@@ -18,6 +18,7 @@
  */
 package org.apache.fineract.portfolio.workingcapitalloanproduct.repository;
 
+import java.time.LocalDate;
 import java.util.List;
 import java.util.Optional;
 import org.apache.fineract.infrastructure.core.domain.ExternalId;
@@ -64,6 +65,9 @@ public interface WorkingCapitalLoanProductRepository
             """)
     Optional<WorkingCapitalLoanProduct> 
findByExternalIdWithDetails(@Param("externalId") ExternalId externalId);
 
+    @Query("select wclp FROM WorkingCapitalLoanProduct wclp where 
wclp.closeDate is null or wclp.closeDate >= :businessDate")
+    List<WorkingCapitalLoanProduct> 
fetchActiveWorkingCapitalLoanProducts(LocalDate businessDate);
+
     // TODO: Check if product is used in any loans (for deletion validation)
     // This will be implemented when Working Capital Loan entity is created
     // @Query("SELECT CASE WHEN COUNT(l)>0 THEN TRUE ELSE FALSE END FROM 
WorkingCapitalLoan l WHERE l.wcpProduct.id =
diff --git 
a/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloanproduct/service/WorkingCapitalLoanProductReadBasicDetailsServiceImpl.java
 
b/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloanproduct/service/WorkingCapitalLoanProductReadBasicDetailsServiceImpl.java
new file mode 100644
index 0000000000..1f2e62fd79
--- /dev/null
+++ 
b/fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloanproduct/service/WorkingCapitalLoanProductReadBasicDetailsServiceImpl.java
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.portfolio.workingcapitalloanproduct.service;
+
+import java.util.Collection;
+import lombok.RequiredArgsConstructor;
+import org.apache.fineract.infrastructure.core.service.DateUtils;
+import 
org.apache.fineract.portfolio.loanproduct.data.LoanProductBasicDetailsData;
+import 
org.apache.fineract.portfolio.loanproduct.service.LoanProductReadBasicDetailsService;
+import 
org.apache.fineract.portfolio.workingcapitalloanproduct.mapper.WorkingCapitalLoanProductBasicDetailsMapper;
+import 
org.apache.fineract.portfolio.workingcapitalloanproduct.repository.WorkingCapitalLoanProductRepository;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional(readOnly = true)
+@RequiredArgsConstructor
+public class WorkingCapitalLoanProductReadBasicDetailsServiceImpl implements 
LoanProductReadBasicDetailsService {
+
+    private final WorkingCapitalLoanProductBasicDetailsMapper 
workingCapitalLoanProductBasicDetailsMapper;
+    private final WorkingCapitalLoanProductRepository productRepository;
+
+    @Override
+    public Collection<LoanProductBasicDetailsData> retrieveProducts() {
+        return workingCapitalLoanProductBasicDetailsMapper
+                
.map(productRepository.fetchActiveWorkingCapitalLoanProducts(DateUtils.getBusinessLocalDate()));
+    }
+
+}
diff --git 
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanProductBasicDetailsTest.java
 
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanProductBasicDetailsTest.java
new file mode 100644
index 0000000000..acb30adddb
--- /dev/null
+++ 
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanProductBasicDetailsTest.java
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.fineract.integrationtests;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.Collection;
+import org.apache.fineract.client.models.LoanProductBasicDetailsData;
+import org.apache.fineract.integrationtests.common.loans.LoanProductHelper;
+import 
org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+@ExtendWith(LoanTestLifecycleExtension.class)
+public class LoanProductBasicDetailsTest {
+
+    @Test
+    public void loanProductBasicDetailsTest() {
+        final Collection<LoanProductBasicDetailsData> productList = 
LoanProductHelper.fetchProductBasicDetailsList();
+        assertNotNull(productList);
+        assertTrue(!productList.isEmpty());
+    }
+}
diff --git 
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanProductHelper.java
 
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanProductHelper.java
index df77558967..031f1c60fd 100644
--- 
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanProductHelper.java
+++ 
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanProductHelper.java
@@ -18,8 +18,10 @@
  */
 package org.apache.fineract.integrationtests.common.loans;
 
+import java.util.Collection;
 import org.apache.fineract.client.models.GetLoanProductsProductIdResponse;
 import org.apache.fineract.client.models.GetLoanProductsTemplateResponse;
+import org.apache.fineract.client.models.LoanProductBasicDetailsData;
 import org.apache.fineract.client.models.PostLoanProductsRequest;
 import org.apache.fineract.client.models.PostLoanProductsResponse;
 import org.apache.fineract.client.models.PutLoanProductsProductIdRequest;
@@ -54,4 +56,8 @@ public class LoanProductHelper {
     public GetLoanProductsTemplateResponse getLoanProductTemplate(boolean 
isProductMixTemplate) {
         return 
Calls.ok(FineractClientHelper.getFineractClient().loanProducts.retrieveTemplate11(isProductMixTemplate));
     }
+
+    public static Collection<LoanProductBasicDetailsData> 
fetchProductBasicDetailsList() {
+        return 
Calls.ok(FineractClientHelper.getFineractClient().loanProductsDetails.fetchProducts());
+    }
 }

Reply via email to