diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java b/fineract-provider/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java index 58e4acc50..29f6dd64a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java +++ b/fineract-provider/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java @@ -101,12 +101,12 @@ public class CommandWrapperBuilder { return this; } - public CommandWrapperBuilder createCreditBureauLoanProductMapping(final long creditBureauId) { + public CommandWrapperBuilder createCreditBureauLoanProductMapping(final long organisationCreditBureauId) { this.actionName = "CREATE"; this.entityName = "CREDITBUREAU_LOANPRODUCT_MAPPING"; this.entityId = creditBureauId; this.href = "/creditBureauConfiguration/template"; - this.creditBureauId = creditBureauId; + this.organisationCreditBureauId = organisationCreditBureauId; return this; } @@ -114,7 +114,7 @@ public class CommandWrapperBuilder { this.actionName = "CREATE"; this.entityName = "CREDITBUREAU_CONFIGURATION"; this.entityId = creditBureauId; - this.href = "/creditBureauConfigurationData/"; + this.href = "/addCreditBureauConfigurationData/"; return this; } @@ -122,7 +122,7 @@ public class CommandWrapperBuilder { this.actionName = "UPDATE"; this.entityName = "CREDITBUREAU_CONFIGURATION"; this.entityId = configurationId; - this.href = "/creditBureauConfigurationData/"; + this.href = "/updateCreditBureauConfigurationData/"; return this; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauConfigurationAPI.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauConfigurationAPI.java index 822ac513e..703200820 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauConfigurationAPI.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauConfigurationAPI.java @@ -231,13 +231,13 @@ public class CreditBureauConfigurationAPI { } @POST - @Path("/mappings/{CreditBureauId}") + @Path("/mappings/{organisationCreditBureauId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - public String createCreditBureauLoanProductMapping(@PathParam("CreditBureauId") final Long CreditBureauId, + public String createCreditBureauLoanProductMapping(@PathParam("organisationCreditBureauId") final Long organisationCreditBureauId, final String apiRequestBodyAsJson) { - final CommandWrapper commandRequest = new CommandWrapperBuilder().createCreditBureauLoanProductMapping(CreditBureauId) + final CommandWrapper commandRequest = new CommandWrapperBuilder().createCreditBureauLoanProductMapping(organisationCreditBureauId) .withJson(apiRequestBodyAsJson).build(); final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauIntegrationAPI.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauIntegrationAPI.java index db62c9745..df50ade02 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauIntegrationAPI.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauIntegrationAPI.java @@ -20,7 +20,11 @@ package org.apache.fineract.infrastructure.creditbureau.api; import com.google.gson.Gson; +import com.sun.jersey.core.header.FormDataContentDisposition; +import com.sun.jersey.multipart.FormDataParam; import io.swagger.v3.oas.annotations.Parameter; +import java.io.File; +import java.io.InputStream; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -66,6 +70,7 @@ public class CreditBureauIntegrationAPI { private final DefaultToApiJsonSerializer toCreditReportApiJsonSerializer; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; private final ApiRequestParameterHelper apiRequestParameterHelper; + private final CreditReportWritePlatformService creditReportWritePlatformService; private final CreditReportReadPlatformService creditReportReadPlatformService; private final DefaultToApiJsonSerializer toApiJsonSerializer; private static final Logger LOG = LoggerFactory.getLogger(CreditBureauIntegrationAPI.class); @@ -82,6 +87,7 @@ public class CreditBureauIntegrationAPI { this.toCreditReportApiJsonSerializer = toCreditReportApiJsonSerializer; this.commandsSourceWritePlatformService = commandsSourceWritePlatformService; this.apiRequestParameterHelper = apiRequestParameterHelper; + this.creditReportWritePlatformService = creditReportWritePlatformService; this.creditReportReadPlatformService = creditReportReadPlatformService; this.toApiJsonSerializer = toApiJsonSerializer; @@ -102,6 +108,18 @@ public class CreditBureauIntegrationAPI { } + // submit loan file of clients to Credit Bureau + @POST + @Path("addCreditReport") + @Consumes(MediaType.MULTIPART_FORM_DATA) + public String addCreditReport(@FormDataParam("file") final File creditReport, @FormDataParam("file") InputStream uploadedInputStream, + @FormDataParam("file") final UriInfo uriInfo, @FormDataParam("file") FormDataContentDisposition fileDetail, + @QueryParam("creditBureauId") @Parameter(description = "creditBureauId") final Long creditBureauId) { + + final String responseMessage = this.creditReportWritePlatformService.addCreditReport(creditBureauId, creditReport, fileDetail); + return this.toCreditReportApiJsonSerializer.serialize(responseMessage); + } + // saves fetched-creditreport into database @POST @Path("saveCreditReport") diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/handler/CreateCreditBureauLoanProductMappingCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/handler/CreateCreditBureauLoanProductMappingCommandHandler.java index 3d883d3e1..bac7cb998 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/handler/CreateCreditBureauLoanProductMappingCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/handler/CreateCreditBureauLoanProductMappingCommandHandler.java @@ -41,7 +41,7 @@ public class CreateCreditBureauLoanProductMappingCommandHandler implements NewCo @Override public CommandProcessingResult processCommand(JsonCommand command) { - return this.writePlatformService.addCreditBureauLoanProductMapping(command.getCreditBureauId(), command); + return this.writePlatformService.addCreditBureauLoanProductMapping(command.getOrganisationCreditBureauId(), command); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingWritePlatformServiceImpl.java index edef2fc8c..950b907b3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingWritePlatformServiceImpl.java @@ -61,14 +61,14 @@ public class CreditBureauLoanProductMappingWritePlatformServiceImpl implements C @Transactional @Override - public CommandProcessingResult addCreditBureauLoanProductMapping(Long creditBureau_id, JsonCommand command) { + public CommandProcessingResult addCreditBureauLoanProductMapping(Long organisationCreditBureauId, JsonCommand command) { this.context.authenticatedUser(); - this.fromApiJsonDeserializer.validateForCreate(command.json(), creditBureau_id); + this.fromApiJsonDeserializer.validateForCreate(command.json(), organisationCreditBureauId); final long lpid = command.longValueOfParameterNamed("loanProductId"); - final OrganisationCreditBureau orgcb = this.organisationCreditBureauRepository.getOne(creditBureau_id); + final OrganisationCreditBureau orgcb = this.organisationCreditBureauRepository.getOne(organisationCreditBureauId); final LoanProduct lp = this.loanProductRepository.getOne(lpid); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditReportWritePlatformService.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditReportWritePlatformService.java index 72aca7303..082e21e0e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditReportWritePlatformService.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditReportWritePlatformService.java @@ -18,6 +18,8 @@ */ package org.apache.fineract.infrastructure.creditbureau.service; +import com.sun.jersey.core.header.FormDataContentDisposition; +import java.io.File; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; @@ -32,4 +34,7 @@ public interface CreditReportWritePlatformService { // deletes creditReports which are saved in database CommandProcessingResult deleteCreditReport(Long creditBureauId, JsonCommand command); + // upload CreditReport to CreditBureau + String addCreditReport(Long creditBureauId, File creditReport, FormDataContentDisposition fileDetail); + } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditReportWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditReportWritePlatformServiceImpl.java index 67be89276..e2a2c3987 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditReportWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditReportWritePlatformServiceImpl.java @@ -18,6 +18,8 @@ */ package org.apache.fineract.infrastructure.creditbureau.service; +import com.sun.jersey.core.header.FormDataContentDisposition; +import java.io.File; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; @@ -98,14 +100,9 @@ public class CreditReportWritePlatformServiceImpl implements CreditReportWritePl if (Objects.equals(creditBureauName.get(), CreditBureauConfigurations.THITSAWORKS.toString())) { - // CreditBureauToken creditBureauToken = this.thitsaWorksCreditBureauIntegrationWritePlatformService - // .createToken(creditBureauID); - CreditBureauReportData reportobj = this.thitsaWorksCreditBureauIntegrationWritePlatformService .getCreditReportFromThitsaWorks(command); - // return new - // CommandProcessingResultBuilder().withCreditReport(reportobj).withCreditBureauToken(creditBureauToken).build(); return new CommandProcessingResultBuilder().withCreditReport(reportobj).build(); } @@ -124,6 +121,28 @@ public class CreditReportWritePlatformServiceImpl implements CreditReportWritePl } + @Override + @Transactional + public String addCreditReport(Long bureauId, File creditReport, FormDataContentDisposition fileDetail) { + + Optional creditBureauName = getCreditBureau(bureauId); + String responseMessage = null; + + if (Objects.equals(creditBureauName.get(), CreditBureauConfigurations.THITSAWORKS.toString())) { + responseMessage = this.thitsaWorksCreditBureauIntegrationWritePlatformService.addCreditReport(bureauId, creditReport, + fileDetail); + } else { + + baseDataValidator.reset().failWithCode("creditBureau.has.not.been.Integrated"); + throw new PlatformApiDataValidationException("creditBureau.has.not.been.Integrated", "creditBureau.has.not.been.Integrated", + dataValidationErrors); + + } + + return responseMessage; + + } + private Optional getCreditBureau(Long creditBureauID) { if (creditBureauID != null) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/ThitsaWorksCreditBureauIntegrationWritePlatformService.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/ThitsaWorksCreditBureauIntegrationWritePlatformService.java index 2df21f481..d422f3813 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/ThitsaWorksCreditBureauIntegrationWritePlatformService.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/ThitsaWorksCreditBureauIntegrationWritePlatformService.java @@ -18,6 +18,7 @@ */ package org.apache.fineract.infrastructure.creditbureau.service; +import com.sun.jersey.core.header.FormDataContentDisposition; import java.io.File; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauReportData; @@ -30,8 +31,10 @@ public interface ThitsaWorksCreditBureauIntegrationWritePlatformService { Long extractUniqueId(String jsonResult); String okHttpConnectionMethod(String userName, String password, String subscriptionKey, String subscriptionId, String url, String token, - File report, Long uniqueId, String nrcId, String process); + File report, FormDataContentDisposition fileDetail, Long uniqueId, String nrcId, String process); CreditBureauReportData getCreditReportFromThitsaWorks(JsonCommand command); + String addCreditReport(Long bureauId, File creditReport, FormDataContentDisposition fileDetail); + } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/ThitsaWorksCreditBureauIntegrationWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/ThitsaWorksCreditBureauIntegrationWritePlatformServiceImpl.java index b14156a01..355d37a94 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/ThitsaWorksCreditBureauIntegrationWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/ThitsaWorksCreditBureauIntegrationWritePlatformServiceImpl.java @@ -24,6 +24,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonNull; import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import com.sun.jersey.core.header.FormDataContentDisposition; import java.io.File; import java.io.IOException; import java.net.HttpURLConnection; @@ -32,6 +33,7 @@ import java.util.Date; import java.util.List; import okhttp3.HttpUrl; import okhttp3.MediaType; +import okhttp3.MultipartBody; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; @@ -94,13 +96,20 @@ public class ThitsaWorksCreditBureauIntegrationWritePlatformServiceImpl implemen @Override @SuppressWarnings("deprecation") public String okHttpConnectionMethod(String userName, String password, String subscriptionKey, String subscriptionId, String url, - String token, File file, Long uniqueId, String nrcId, String process) { + String token, File file, FormDataContentDisposition fileData, Long uniqueId, String nrcId, String process) { String reponseMessage = null; RequestBody requestBody = null; OkHttpClient client = new OkHttpClient(); - if (process.equals("token")) { + if (process.equals("UploadCreditReport")) { + String fileName = fileData.getFileName(); + requestBody = RequestBody.create(file, MediaType.parse("multipart/form-data")); + + requestBody = new MultipartBody.Builder().setType(MultipartBody.FORM).addFormDataPart("file", fileName, requestBody) + .addFormDataPart("BODY", "formdata").addFormDataPart("userName", userName).build(); + + } else if (process.equals("token")) { final MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded"); String jsonBody = "" + "BODY=x-www-form-urlencoded&\r" + "grant_type=password&\r" + "userName=" + userName + "&\r" + "password=" @@ -130,6 +139,12 @@ public class ThitsaWorksCreditBureauIntegrationWritePlatformServiceImpl implemen request = new Request.Builder().header("mcix-subscription-key", subscriptionKey) .header("mcix-subscription-id", subscriptionId).header("Content-Type", "application/x-www-form-urlencoded") .header("Authorization", "Bearer " + token).url(urlokhttp).get().build(); + } else if (process.equals("UploadCreditReport")) { // POST for uploading Credit-Report(multipart/form-data) + // To ThitsaWork + request = new Request.Builder().header("mcix-subscription-key", subscriptionKey) + .header("mcix-subscription-id", subscriptionId).header("Content-Type", "multipart/form-data") + .header("Authorization", "Bearer " + token).url(urlokhttp).post(requestBody).build(); + } else { // POST method for application/x-www-form-urlencoded request = new Request.Builder().header("mcix-subscription-key", subscriptionKey) @@ -153,6 +168,12 @@ public class ThitsaWorksCreditBureauIntegrationWritePlatformServiceImpl implemen this.httpResponse(responseCode, reponseMessage); } + if (process.equals("UploadCreditReport")) { // to show the Response on frontEnd + JsonObject reportObject = JsonParser.parseString(reponseMessage).getAsJsonObject(); + String ResponseMessageJson = reportObject.get("ResponseMessage").getAsString(); + this.handleAPIIntegrityIssues(ResponseMessageJson); + } + return reponseMessage; } @@ -201,8 +222,8 @@ public class ThitsaWorksCreditBureauIntegrationWritePlatformServiceImpl implemen String nrcUrl = url + nrcId; - String searchResult = this.okHttpConnectionMethod(userName, password, subscriptionKey, subscriptionId, nrcUrl, token, null, 0L, - nrcId, process); + String searchResult = this.okHttpConnectionMethod(userName, password, subscriptionKey, subscriptionId, nrcUrl, token, null, null, + 0L, nrcId, process); if (process.equals("NRC")) { Long uniqueID = this.extractUniqueId(searchResult); @@ -213,7 +234,7 @@ public class ThitsaWorksCreditBureauIntegrationWritePlatformServiceImpl implemen String creditReportUrl = url + uniqueID; searchResult = this.okHttpConnectionMethod(userName, password, subscriptionKey, subscriptionId, creditReportUrl, token, null, - uniqueID, null, process); + null, uniqueID, null, process); } @@ -270,6 +291,31 @@ public class ThitsaWorksCreditBureauIntegrationWritePlatformServiceImpl implemen writeoffLoanStringArray); } + @Override + @Transactional + public String addCreditReport(Long bureauId, File creditReport, FormDataContentDisposition fileDetail) { + + Integer creditBureauId = bureauId.intValue(); + + String userName = this.getCreditBureauConfiguration(creditBureauId, CreditBureauConfigurations.USERNAME.toString()); + String password = this.getCreditBureauConfiguration(creditBureauId, CreditBureauConfigurations.PASSWORD.toString()); + String subscriptionId = this.getCreditBureauConfiguration(creditBureauId, CreditBureauConfigurations.SUBSCRIPTIONID.toString()); + String subscriptionKey = this.getCreditBureauConfiguration(creditBureauId, CreditBureauConfigurations.SUBSCRIPTIONKEY.toString()); + + CreditBureauToken creditbureautoken = this.createToken(creditBureauId.longValue()); + String token = creditbureautoken.getCurrentToken(); + + CreditBureauConfiguration addReportURL = this.configDataRepository.getCreditBureauConfigData(creditBureauId, "addCreditReporturl"); + String url = addReportURL.getValue(); + + String process = "UploadCreditReport"; + + String responseMessage = this.okHttpConnectionMethod(userName, password, subscriptionKey, subscriptionId, url, token, creditReport, + fileDetail, 0L, null, process); + + return responseMessage; + } + private String[] convertArrayintoStringArray(JsonArray jsonResult) { String[] loanAccounts = new String[jsonResult.size()]; @@ -391,8 +437,8 @@ public class ThitsaWorksCreditBureauIntegrationWritePlatformServiceImpl implemen String process = "token"; String nrcId = null; Long uniqueID = 0L; - String result = this.okHttpConnectionMethod(userName, password, subscriptionKey, subscriptionId, url, null, null, uniqueID, - nrcId, process); + String result = this.okHttpConnectionMethod(userName, password, subscriptionKey, subscriptionId, url, null, null, null, + uniqueID, nrcId, process); // created token will be storing it into database final CommandWrapper wrapper = new CommandWrapperBuilder().withJson(result).build(); final String json = wrapper.getJson(); @@ -434,10 +480,11 @@ public class ThitsaWorksCreditBureauIntegrationWritePlatformServiceImpl implemen creditBureauConfigurationValue = configurationParameterValue.getValue(); if (creditBureauConfigurationValue.isEmpty()) { + baseDataValidator.reset().failWithCode("creditBureau.configuration." + configurationParameterName + ".is.not.available"); - throw new PlatformApiDataValidationException( - "creditBureau.Configuration." + configurationParameterName + ".is.not.available", - "creditBureau.Configuration.is.not.available", dataValidationErrors); + + throw new PlatformDataIntegrityException("creditBureau.Configuration." + configurationParameterName + ".is.not.available", + "creditBureau.Configuration." + configurationParameterName + ".is.not.available"); } } catch (NullPointerException ex) { diff --git a/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/ThitsaworksCreditBureauTest.java b/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/ThitsaworksCreditBureauTest.java index c14c08b42..ed53f30f1 100644 --- a/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/ThitsaworksCreditBureauTest.java +++ b/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/ThitsaworksCreditBureauTest.java @@ -23,7 +23,9 @@ import static org.mockito.Mockito.when; import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import com.sun.jersey.core.header.FormDataContentDisposition; import java.io.File; +import javax.ws.rs.core.UriInfo; import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper; import org.apache.fineract.infrastructure.creditbureau.service.CreditReportWritePlatformServiceImpl; import org.apache.fineract.infrastructure.creditbureau.service.ThitsaWorksCreditBureauIntegrationWritePlatformServiceImpl; @@ -60,7 +62,11 @@ public class ThitsaworksCreditBureauTest { static String url = "url"; static String token = "token"; static Long uniqueId = 8113399260L; - static File file; + static byte[] file; + static File report; + static String fileName; + static UriInfo uriInfo; + static FormDataContentDisposition fileData; static String testresult = "{ 'Data': {'BorrowerInfo': {'MainIdentifier': '2113439293', 'Name': 'Aung Khant Min'," + " 'NRC': '13/MiFoS(N)163525', 'Gender': '', 'DOB': '1990-01-20', 'FatherName': '', 'Address': ''," @@ -86,10 +92,10 @@ public class ThitsaworksCreditBureauTest { String searchResult = "{\"Data\":[{\"UniqueID\":\"8113399260\",\"NRC\":\"12/KaMaRa(N)253426\",\"FullName\":\"Aye Aye\",\"DOB\":\"1990-05-22,1991-05-22\",\"FatherFullName\":\"U Aye Myint Maung\",\"Location\":\"Yangon-Thongwa,Twantay,Yankin\",\"Flag\":\"[{\\\"WriteOff\\\":1}]\",\"Active\":\"Y\"}],\"MessageDtm\":\"8/1/2020 6:39:00 PM UTC\",\"SubscriptionID\":\"317A1FF8-625D-41BA-BE0F-F8ED8A644A7C\",\"CallerIP\":\"207.46.228.155\",\"URI\":\"https://qa-mmcix-api.azurewebsites.net/20200324/api/Search/SimpleSearch?nrc=253426\",\"ResponseMessage\":\"Record found\"}"; when(this.thitsaWorksCreditBureauIntegrationWritePlatformServiceImpl.okHttpConnectionMethod(userName, password, subscriptionKey, - subscriptionId, url, token, file, uniqueId, nrcID, process)).thenReturn(searchResult); + subscriptionId, url, token, report, fileData, uniqueId, nrcID, process)).thenReturn(searchResult); final String search = thitsaWorksCreditBureauIntegrationWritePlatformServiceImpl.okHttpConnectionMethod(userName, password, - subscriptionKey, subscriptionId, url, token, file, uniqueId, nrcID, process); + subscriptionKey, subscriptionId, url, token, report, fileData, uniqueId, nrcID, process); when(thitsaWorksCreditBureauIntegrationWritePlatformServiceImpl.extractUniqueId(search)).thenCallRealMethod(); @@ -105,10 +111,10 @@ public class ThitsaworksCreditBureauTest { String curentNrc = "13/MiFoS(N)163525"; when(this.thitsaWorksCreditBureauIntegrationWritePlatformServiceImpl.okHttpConnectionMethod(userName, password, subscriptionKey, - subscriptionId, url, token, file, uniqueId, nrcID, process)).thenReturn(testresult); + subscriptionId, url, token, report, fileData, uniqueId, nrcID, process)).thenReturn(testresult); String creditReport = thitsaWorksCreditBureauIntegrationWritePlatformServiceImpl.okHttpConnectionMethod(userName, password, - subscriptionKey, subscriptionId, url, token, file, uniqueId, nrcID, process); + subscriptionKey, subscriptionId, url, token, report, fileData, uniqueId, nrcID, process); JsonObject resultObject = JsonParser.parseString(creditReport).getAsJsonObject(); String data = resultObject.get("Data").toString();