rrpawar96 commented on a change in pull request #1235: URL: https://github.com/apache/fineract/pull/1235#discussion_r548881154
########## File path: fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauIntegrationAPI.java ########## @@ -0,0 +1,160 @@ +/** + * 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.infrastructure.creditbureau.api; + +import com.google.gson.Gson; +import io.swagger.v3.oas.annotations.Parameter; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.UriInfo; +import org.apache.fineract.commands.domain.CommandWrapper; +import org.apache.fineract.commands.service.CommandWrapperBuilder; +import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService; +import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper; +import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; +import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings; +import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer; +import org.apache.fineract.infrastructure.creditbureau.data.CreditReportData; +import org.apache.fineract.infrastructure.creditbureau.service.CreditReportReadPlatformService; +import org.apache.fineract.infrastructure.creditbureau.service.CreditReportWritePlatformService; +import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RequestParam; + +@Path("/creditBureauIntegration") +@Component +@Scope("singleton") +public class CreditBureauIntegrationAPI { + + private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "creditBureauId", "nrc", "creditReport")); + + private final PlatformSecurityContext context; + private final DefaultToApiJsonSerializer<CreditReportData> toCreditReportApiJsonSerializer; + private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; + private final ApiRequestParameterHelper apiRequestParameterHelper; + private final CreditReportWritePlatformService creditReportWritePlatformService; + private final CreditReportReadPlatformService creditReportReadPlatformService; + private final DefaultToApiJsonSerializer<CreditReportData> toApiJsonSerializer; + private static final Logger LOG = LoggerFactory.getLogger(CreditBureauIntegrationAPI.class); + + @Autowired + public CreditBureauIntegrationAPI(final PlatformSecurityContext context, + final DefaultToApiJsonSerializer<CreditReportData> toCreditReportApiJsonSerializer, + final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, + final ApiRequestParameterHelper apiRequestParameterHelper, + final CreditReportWritePlatformService creditReportWritePlatformService, + final CreditReportReadPlatformService creditReportReadPlatformService, + final DefaultToApiJsonSerializer<CreditReportData> toApiJsonSerializer) { + this.context = context; + this.toCreditReportApiJsonSerializer = toCreditReportApiJsonSerializer; + this.commandsSourceWritePlatformService = commandsSourceWritePlatformService; + this.apiRequestParameterHelper = apiRequestParameterHelper; + this.creditReportWritePlatformService = creditReportWritePlatformService; + this.creditReportReadPlatformService = creditReportReadPlatformService; + this.toApiJsonSerializer = toApiJsonSerializer; + + } + + @POST + @Path("creditReport") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + public String postCreditReport(@Context final UriInfo uriInfo, @RequestParam("params") final Map<String, Object> params) { Review comment: Comment Addressed. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
