nikpawar89 commented on a change in pull request #1235:
URL: https://github.com/apache/fineract/pull/1235#discussion_r468293737



##########
File path: 
fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditReportData.java
##########
@@ -0,0 +1,48 @@
+/**
+ * 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.data;
+
+import java.io.Serializable;
+
+public final class CreditReportData implements Serializable {
+
+    @SuppressWarnings("unused")
+    private final Object creditScore;

Review comment:
       change the datatypes to actual datatypes

##########
File path: 
fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureauToken.java
##########
@@ -0,0 +1,101 @@
+package org.apache.fineract.infrastructure.creditbureau.domain;
+
+/**
+ * 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.
+ */
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import 
org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+import org.springframework.stereotype.Component;
+
+@Component
+@Entity
+@Table(name = "m_creditbureau_token")
+public class CreditBureauToken extends AbstractPersistableCustom {
+
+    @Column(name = "username")
+    private String userName;
+
+    @Column(name = "token")
+    private String access_token;
+
+    @Column(name = "token_type")
+    private String token_type;
+
+    @Column(name = "expires_in")
+    private String expires_in;
+
+    @Column(name = "issued")
+    private String issued;
+
+    @Column(name = "expires")

Review comment:
       why String is used instead of date.

##########
File path: 
fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReportsReadPlatformServiceImpl.java
##########
@@ -0,0 +1,303 @@
+/**
+ * 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.service;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.util.Date;
+import java.util.Locale;
+import org.apache.fineract.commands.domain.CommandWrapper;
+import org.apache.fineract.commands.service.CommandWrapperBuilder;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
+import org.apache.fineract.infrastructure.creditbureau.data.CreditReportData;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauToken;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauTokenCredential;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.TokenDataRepositoryWrapper;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.TokenRepositoryWrapper;
+import 
org.apache.fineract.infrastructure.creditbureau.serialization.CreditBureauTokenCommandFromApiJsonDeserializer;
+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.cache.annotation.CacheEvict;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+public class CreditBureauReportsReadPlatformServiceImpl implements 
CreditBureauReportsReadPlatformService {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(CreditBureauReportsReadPlatformServiceImpl.class);
+    private final JdbcTemplate jdbcTemplate;
+    private final PlatformSecurityContext context;
+    private final FromJsonHelper fromApiJsonHelper;
+    private final TokenRepositoryWrapper tokenRepository;
+    private final TokenDataRepositoryWrapper tokenDataRepository;
+    private final CreditBureauTokenCommandFromApiJsonDeserializer 
fromApiJsonDeserializer;
+
+    @Autowired
+    public CreditBureauReportsReadPlatformServiceImpl(final 
PlatformSecurityContext context, final RoutingDataSource dataSource,
+            final FromJsonHelper fromApiJsonHelper, final 
TokenRepositoryWrapper tokenRepository,
+            final TokenDataRepositoryWrapper tokenDataRepository,
+            final CreditBureauTokenCommandFromApiJsonDeserializer 
fromApiJsonDeserializer) {
+        this.context = context;
+        this.jdbcTemplate = new JdbcTemplate(dataSource);
+        this.tokenRepository = tokenRepository;
+        this.tokenDataRepository = tokenDataRepository;
+        this.fromApiJsonHelper = fromApiJsonHelper;
+        this.fromApiJsonDeserializer = fromApiJsonDeserializer;
+    }
+
+    @SuppressWarnings({ "CatchAndPrintStackTrace", "DefaultCharset" })
+    @Override
+    @Transactional
+    @CacheEvict(value = "searchreport", key = 
"T(org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('cv')")
+    public CreditReportData retrieveAllSearchReport(final String searchId) {
+        String result = null;
+        Long uniqueID = 0L;
+        try {
+            this.context.authenticatedUser();
+
+            final CreditBureauTokenCredential credittokendata = 
this.tokenDataRepository.getTokenCredential();
+            String userName = credittokendata.getUserName();
+            String password = credittokendata.getPassword();
+            String subscriptionId = credittokendata.getSubscriptionId();
+            String subscriptionKey = credittokendata.getSubscriptionKey();
+            String tokenDate;
+
+            CreditBureauToken creditbureautoken = 
this.tokenRepository.getToken();
+            LOG.info("credit bureau token : {} ", creditbureautoken);
+
+            // check the expiry date of the previous token.
+            if (creditbureautoken != null) {
+                try {
+                    Date current = new Date();
+
+                    String getDate = creditbureautoken.getTokenExpiryDate();
+                    DateFormat dateformat = new SimpleDateFormat("EEE, dd MMM 
yyyy kk:mm:ss zzz", Locale.ENGLISH);
+                    Date getExpiryDate = dateformat.parse(getDate);
+                    LOG.info("current date : {} ", current);
+                    LOG.info("getExpiryDate : {} ", getExpiryDate);
+
+                    ZoneId zid = ZoneId.of("Asia/Rangoon");

Review comment:
       don't hard code time zones

##########
File path: 
fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReportsReadPlatformServiceImpl.java
##########
@@ -0,0 +1,303 @@
+/**
+ * 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.service;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.util.Date;
+import java.util.Locale;
+import org.apache.fineract.commands.domain.CommandWrapper;
+import org.apache.fineract.commands.service.CommandWrapperBuilder;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
+import org.apache.fineract.infrastructure.creditbureau.data.CreditReportData;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauToken;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauTokenCredential;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.TokenDataRepositoryWrapper;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.TokenRepositoryWrapper;
+import 
org.apache.fineract.infrastructure.creditbureau.serialization.CreditBureauTokenCommandFromApiJsonDeserializer;
+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.cache.annotation.CacheEvict;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+public class CreditBureauReportsReadPlatformServiceImpl implements 
CreditBureauReportsReadPlatformService {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(CreditBureauReportsReadPlatformServiceImpl.class);
+    private final JdbcTemplate jdbcTemplate;
+    private final PlatformSecurityContext context;
+    private final FromJsonHelper fromApiJsonHelper;
+    private final TokenRepositoryWrapper tokenRepository;
+    private final TokenDataRepositoryWrapper tokenDataRepository;
+    private final CreditBureauTokenCommandFromApiJsonDeserializer 
fromApiJsonDeserializer;
+
+    @Autowired
+    public CreditBureauReportsReadPlatformServiceImpl(final 
PlatformSecurityContext context, final RoutingDataSource dataSource,
+            final FromJsonHelper fromApiJsonHelper, final 
TokenRepositoryWrapper tokenRepository,
+            final TokenDataRepositoryWrapper tokenDataRepository,
+            final CreditBureauTokenCommandFromApiJsonDeserializer 
fromApiJsonDeserializer) {
+        this.context = context;
+        this.jdbcTemplate = new JdbcTemplate(dataSource);
+        this.tokenRepository = tokenRepository;
+        this.tokenDataRepository = tokenDataRepository;
+        this.fromApiJsonHelper = fromApiJsonHelper;
+        this.fromApiJsonDeserializer = fromApiJsonDeserializer;
+    }
+
+    @SuppressWarnings({ "CatchAndPrintStackTrace", "DefaultCharset" })
+    @Override
+    @Transactional
+    @CacheEvict(value = "searchreport", key = 
"T(org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('cv')")
+    public CreditReportData retrieveAllSearchReport(final String searchId) {
+        String result = null;
+        Long uniqueID = 0L;
+        try {
+            this.context.authenticatedUser();
+
+            final CreditBureauTokenCredential credittokendata = 
this.tokenDataRepository.getTokenCredential();
+            String userName = credittokendata.getUserName();
+            String password = credittokendata.getPassword();
+            String subscriptionId = credittokendata.getSubscriptionId();
+            String subscriptionKey = credittokendata.getSubscriptionKey();
+            String tokenDate;
+
+            CreditBureauToken creditbureautoken = 
this.tokenRepository.getToken();
+            LOG.info("credit bureau token : {} ", creditbureautoken);
+
+            // check the expiry date of the previous token.
+            if (creditbureautoken != null) {
+                try {
+                    Date current = new Date();
+
+                    String getDate = creditbureautoken.getTokenExpiryDate();

Review comment:
       change data type to Date and come up with better way to compare dates

##########
File path: 
fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureauTokenCredential.java
##########
@@ -0,0 +1,95 @@
+/**
+ * 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.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import 
org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+
+@Entity

Review comment:
       Come up with more generic design to store configurations of credit 
bureau, we can't have one table per credit bureau for storing configurations. 
You may have to refactor this token module.

##########
File path: 
fineract-provider/src/main/resources/sql/migrations/core_db/V273__oauth_changes.sql
##########
@@ -59,3 +59,42 @@ CREATE TABLE `oauth_refresh_token` (
 )
 COLLATE='utf8mb4_general_ci'
 ENGINE=InnoDB;
+
+CREATE TABLE `m_creditbureau_tokendata` (
+  `id` INT(128) NOT NULL AUTO_INCREMENT,
+  `userNames` varchar(128) DEFAULT NULL,
+  `password` varchar(128) DEFAULT NULL,
+  `subscription_id` varchar(128) DEFAULT NULL,
+  `subscription_key` varchar(128) DEFAULT NULL,
+
+  PRIMARY KEY (`id`)
+)
+COLLATE='utf8mb4_general_ci'
+ENGINE=InnoDB;
+
+INSERT INTO `m_creditbureau_tokendata` (`id`, `userNames`, `password`, 
`subscription_id`, `subscription_key`) VALUES
+('1', '[email protected]','Sampleuser123*' 
,'317A1FF8-625D-41BA-BE0F-F8ED8A644A7C', 'cb225c15ff1742feab2f1fb444393ace'),
+('2', '[email protected]','Sampleuser123*' 
,'B76FEFF5-5B42-4A36-AFDA-AB5C7398220C', '91ce69a972b14c7fab057788fe61ce8a'),
+('3', '[email protected]','Sampleuser123*' 
,'31333A80-BDE7-43EE-B1FD-6699C518AF85', '86f4f58542554e0ba9a309003eadd1fc'),
+('4', '[email protected]','Sampleuser123*' 
,'C929C107-E779-4233-8493-176CF6DEA251', '302ed3b928df43ccb0de97f008b07320');
+
+-- permissions added
+
+
+INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, 
`can_maker_checker`) VALUES ('configuration', 'CREATE_CREDITBUREAUTOKEN', 
'CREDITBUREAUTOKEN', 'CREATE', 0);
+INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, 
`can_maker_checker`) VALUES ('configuration', 'CREATE_CREDITBUREAUTOKENDATA', 
'CREDITBUREAUTOKENDATA', 'CREATE', 0);
+
+CREATE TABLE `m_creditbureau_token` (

Review comment:
       come up with more generic design to store configs.

##########
File path: 
fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauTokenWritePlatformServiceImpl.java
##########
@@ -0,0 +1,178 @@
+/**
+ * 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.service;
+
+import com.google.gson.JsonElement;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+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.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import 
org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
+import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauToken;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauTokenCredential;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauTokenRepository;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.TokenDataRepository;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.TokenDataRepositoryWrapper;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.TokenRepositoryWrapper;
+import 
org.apache.fineract.infrastructure.creditbureau.serialization.CreditBureauTokenCommandFromApiJsonDeserializer;
+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.cache.annotation.CacheEvict;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+public class CreditBureauTokenWritePlatformServiceImpl implements 
CreditBureauTokenWritePlatformService {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(CreditBureauTokenWritePlatformServiceImpl.class);
+    private final PlatformSecurityContext context;
+    private final FromJsonHelper fromApiJsonHelper;
+    private final CreditBureauTokenRepository creditBureauTokenRepository;
+    private final CreditBureauTokenCommandFromApiJsonDeserializer 
fromApiJsonDeserializer;
+    private final CreditBureauTokenReadPlatformService 
readPlatformServiceCreditBureauToken;
+    private final PortfolioCommandSourceWritePlatformService 
commandsSourceWritePlatformService;
+    private final CreditBureauToken creditBureauToken;
+    private final TokenDataRepository tokendatRepository;
+    private final TokenRepositoryWrapper tokenRepository;
+    private final TokenDataRepositoryWrapper tokenDataRepository;
+    private static String tokenstr;
+    private final JdbcTemplate jdbcTemplate;
+
+    @Autowired
+    public CreditBureauTokenWritePlatformServiceImpl(final 
PlatformSecurityContext context,
+            final CreditBureauTokenRepository creditBureauTokenRepository, 
final TokenRepositoryWrapper tokenRepository,
+            final TokenDataRepositoryWrapper tokenDataRepository, final 
TokenDataRepository tokendatRepository,
+            final CreditBureauTokenCommandFromApiJsonDeserializer 
fromApiJsonDeserializer, final FromJsonHelper fromApiJsonHelper,
+            final CreditBureauTokenReadPlatformService 
readPlatformServiceCreditBureauToken,
+            final PortfolioCommandSourceWritePlatformService 
commandsSourceWritePlatformService, final CreditBureauToken creditBureauToken,
+            final RoutingDataSource dataSource) {
+        this.context = context;
+        this.creditBureauTokenRepository = creditBureauTokenRepository;
+        this.tokenDataRepository = tokenDataRepository;
+        this.tokenRepository = tokenRepository;
+        this.tokendatRepository = tokendatRepository;
+        this.fromApiJsonDeserializer = fromApiJsonDeserializer;
+        this.fromApiJsonHelper = fromApiJsonHelper;
+        this.readPlatformServiceCreditBureauToken = 
readPlatformServiceCreditBureauToken;
+        this.commandsSourceWritePlatformService = 
commandsSourceWritePlatformService;
+        this.creditBureauToken = creditBureauToken;
+        this.jdbcTemplate = new JdbcTemplate(dataSource);
+    }
+
+    @SuppressWarnings({ "CatchAndPrintStackTrace", "DefaultCharset" })
+    @Override
+    @Transactional
+    @CacheEvict(value = "credittoken", key = 
"T(org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('cv')")
+    public CommandProcessingResult createCreditBureauToken(JsonCommand 
command) {
+        try {
+            this.context.authenticatedUser();
+
+            // fetch the token credentials for using it in header
+            final CreditBureauTokenCredential credittokendata = 
this.tokenDataRepository.getTokenCredential();
+
+            String userName = credittokendata.getUserName();
+            String password = credittokendata.getPassword();
+            String subscriptionId = credittokendata.getSubscriptionId();
+            String subscriptionKey = credittokendata.getSubscriptionKey();
+
+            final String POST_PARAMS = "\n" + 
"BODY=x-www-form-urlencoded&\r\n" + "grant_type=password&\r\n" + "userName=" + 
userName
+                    + "&\r\n" + "password=" + password + "&\r\n";
+
+            URL obj = new URL("https://mmcix.azure-api.net/qa/20200324/Token";);
+            String readLine = null;
+
+            HttpURLConnection postConnection = (HttpURLConnection) 
obj.openConnection();
+            postConnection.setRequestMethod("POST");

Review comment:
       extract http connection code into method

##########
File path: 
fineract-provider/src/main/resources/sql/migrations/core_db/V273__oauth_changes.sql
##########
@@ -59,3 +59,42 @@ CREATE TABLE `oauth_refresh_token` (
 )
 COLLATE='utf8mb4_general_ci'
 ENGINE=InnoDB;
+
+CREATE TABLE `m_creditbureau_tokendata` (
+  `id` INT(128) NOT NULL AUTO_INCREMENT,
+  `userNames` varchar(128) DEFAULT NULL,
+  `password` varchar(128) DEFAULT NULL,
+  `subscription_id` varchar(128) DEFAULT NULL,
+  `subscription_key` varchar(128) DEFAULT NULL,
+
+  PRIMARY KEY (`id`)
+)
+COLLATE='utf8mb4_general_ci'
+ENGINE=InnoDB;
+
+INSERT INTO `m_creditbureau_tokendata` (`id`, `userNames`, `password`, 
`subscription_id`, `subscription_key`) VALUES

Review comment:
       this data should not be given. Take this out

##########
File path: 
fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReportsReadPlatformServiceImpl.java
##########
@@ -0,0 +1,303 @@
+/**
+ * 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.service;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.util.Date;
+import java.util.Locale;
+import org.apache.fineract.commands.domain.CommandWrapper;
+import org.apache.fineract.commands.service.CommandWrapperBuilder;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
+import org.apache.fineract.infrastructure.creditbureau.data.CreditReportData;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauToken;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauTokenCredential;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.TokenDataRepositoryWrapper;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.TokenRepositoryWrapper;
+import 
org.apache.fineract.infrastructure.creditbureau.serialization.CreditBureauTokenCommandFromApiJsonDeserializer;
+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.cache.annotation.CacheEvict;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+public class CreditBureauReportsReadPlatformServiceImpl implements 
CreditBureauReportsReadPlatformService {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(CreditBureauReportsReadPlatformServiceImpl.class);
+    private final JdbcTemplate jdbcTemplate;
+    private final PlatformSecurityContext context;
+    private final FromJsonHelper fromApiJsonHelper;
+    private final TokenRepositoryWrapper tokenRepository;
+    private final TokenDataRepositoryWrapper tokenDataRepository;
+    private final CreditBureauTokenCommandFromApiJsonDeserializer 
fromApiJsonDeserializer;
+
+    @Autowired
+    public CreditBureauReportsReadPlatformServiceImpl(final 
PlatformSecurityContext context, final RoutingDataSource dataSource,
+            final FromJsonHelper fromApiJsonHelper, final 
TokenRepositoryWrapper tokenRepository,
+            final TokenDataRepositoryWrapper tokenDataRepository,
+            final CreditBureauTokenCommandFromApiJsonDeserializer 
fromApiJsonDeserializer) {
+        this.context = context;
+        this.jdbcTemplate = new JdbcTemplate(dataSource);
+        this.tokenRepository = tokenRepository;
+        this.tokenDataRepository = tokenDataRepository;
+        this.fromApiJsonHelper = fromApiJsonHelper;
+        this.fromApiJsonDeserializer = fromApiJsonDeserializer;
+    }
+
+    @SuppressWarnings({ "CatchAndPrintStackTrace", "DefaultCharset" })
+    @Override
+    @Transactional
+    @CacheEvict(value = "searchreport", key = 
"T(org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('cv')")
+    public CreditReportData retrieveAllSearchReport(final String searchId) {
+        String result = null;
+        Long uniqueID = 0L;
+        try {
+            this.context.authenticatedUser();
+
+            final CreditBureauTokenCredential credittokendata = 
this.tokenDataRepository.getTokenCredential();
+            String userName = credittokendata.getUserName();
+            String password = credittokendata.getPassword();
+            String subscriptionId = credittokendata.getSubscriptionId();
+            String subscriptionKey = credittokendata.getSubscriptionKey();
+            String tokenDate;
+
+            CreditBureauToken creditbureautoken = 
this.tokenRepository.getToken();
+            LOG.info("credit bureau token : {} ", creditbureautoken);
+
+            // check the expiry date of the previous token.
+            if (creditbureautoken != null) {
+                try {
+                    Date current = new Date();
+
+                    String getDate = creditbureautoken.getTokenExpiryDate();
+                    DateFormat dateformat = new SimpleDateFormat("EEE, dd MMM 
yyyy kk:mm:ss zzz", Locale.ENGLISH);
+                    Date getExpiryDate = dateformat.parse(getDate);
+                    LOG.info("current date : {} ", current);
+                    LOG.info("getExpiryDate : {} ", getExpiryDate);
+
+                    ZoneId zid = ZoneId.of("Asia/Rangoon");
+                    final LocalDate date = LocalDate.now(zid);

Review comment:
       Please be consistent with date data types, use either of date, LocalDate 
or LocalDateTime.

##########
File path: 
fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReportsReadPlatformServiceImpl.java
##########
@@ -0,0 +1,303 @@
+/**
+ * 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.service;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.util.Date;
+import java.util.Locale;
+import org.apache.fineract.commands.domain.CommandWrapper;
+import org.apache.fineract.commands.service.CommandWrapperBuilder;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
+import org.apache.fineract.infrastructure.creditbureau.data.CreditReportData;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauToken;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauTokenCredential;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.TokenDataRepositoryWrapper;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.TokenRepositoryWrapper;
+import 
org.apache.fineract.infrastructure.creditbureau.serialization.CreditBureauTokenCommandFromApiJsonDeserializer;
+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.cache.annotation.CacheEvict;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+public class CreditBureauReportsReadPlatformServiceImpl implements 
CreditBureauReportsReadPlatformService {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(CreditBureauReportsReadPlatformServiceImpl.class);
+    private final JdbcTemplate jdbcTemplate;
+    private final PlatformSecurityContext context;
+    private final FromJsonHelper fromApiJsonHelper;
+    private final TokenRepositoryWrapper tokenRepository;
+    private final TokenDataRepositoryWrapper tokenDataRepository;
+    private final CreditBureauTokenCommandFromApiJsonDeserializer 
fromApiJsonDeserializer;
+
+    @Autowired
+    public CreditBureauReportsReadPlatformServiceImpl(final 
PlatformSecurityContext context, final RoutingDataSource dataSource,
+            final FromJsonHelper fromApiJsonHelper, final 
TokenRepositoryWrapper tokenRepository,
+            final TokenDataRepositoryWrapper tokenDataRepository,
+            final CreditBureauTokenCommandFromApiJsonDeserializer 
fromApiJsonDeserializer) {
+        this.context = context;
+        this.jdbcTemplate = new JdbcTemplate(dataSource);
+        this.tokenRepository = tokenRepository;
+        this.tokenDataRepository = tokenDataRepository;
+        this.fromApiJsonHelper = fromApiJsonHelper;
+        this.fromApiJsonDeserializer = fromApiJsonDeserializer;
+    }
+
+    @SuppressWarnings({ "CatchAndPrintStackTrace", "DefaultCharset" })
+    @Override
+    @Transactional
+    @CacheEvict(value = "searchreport", key = 
"T(org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('cv')")
+    public CreditReportData retrieveAllSearchReport(final String searchId) {
+        String result = null;
+        Long uniqueID = 0L;
+        try {
+            this.context.authenticatedUser();
+
+            final CreditBureauTokenCredential credittokendata = 
this.tokenDataRepository.getTokenCredential();
+            String userName = credittokendata.getUserName();
+            String password = credittokendata.getPassword();
+            String subscriptionId = credittokendata.getSubscriptionId();
+            String subscriptionKey = credittokendata.getSubscriptionKey();
+            String tokenDate;
+
+            CreditBureauToken creditbureautoken = 
this.tokenRepository.getToken();
+            LOG.info("credit bureau token : {} ", creditbureautoken);
+
+            // check the expiry date of the previous token.
+            if (creditbureautoken != null) {
+                try {
+                    Date current = new Date();
+
+                    String getDate = creditbureautoken.getTokenExpiryDate();
+                    DateFormat dateformat = new SimpleDateFormat("EEE, dd MMM 
yyyy kk:mm:ss zzz", Locale.ENGLISH);
+                    Date getExpiryDate = dateformat.parse(getDate);
+                    LOG.info("current date : {} ", current);
+                    LOG.info("getExpiryDate : {} ", getExpiryDate);
+
+                    ZoneId zid = ZoneId.of("Asia/Rangoon");
+                    final LocalDate date = LocalDate.now(zid);
+                    LOG.info("local date : {} ", date);
+
+                    if (getExpiryDate.before(current)) {
+                        LOG.info("The token is expired");
+                        final CreditBureauToken credittoken = 
this.tokenRepository.getToken();
+                        if (credittoken != null) {
+
+                            this.tokenRepository.delete(credittoken);
+                            creditbureautoken = null;
+                        }
+
+                    }
+
+                } catch (ParseException Ex) {
+                    LOG.error("Error occured.", Ex);
+                }
+            }
+
+            // if token is not available or previous token is expired then 
create a new token
+            if (creditbureautoken == null) {
+
+                LOG.info("-----creating new token-----");
+                final String POST_PARAMS = "\n" + 
"BODY=x-www-form-urlencoded&\r\n" + "grant_type=password&\r\n" + "userName=" + 
userName
+                        + "&\r\n" + "password=" + password + "&\r\n";
+
+                URL obj = new 
URL("https://mmcix.azure-api.net/qa/20200324/Token";);
+                String readLine = null;
+
+                HttpURLConnection postConnection = (HttpURLConnection) 
obj.openConnection();

Review comment:
       encapsulate http connection into method, so that it can be resued.

##########
File path: 
fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReportsReadPlatformServiceImpl.java
##########
@@ -0,0 +1,303 @@
+/**
+ * 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.service;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.util.Date;
+import java.util.Locale;
+import org.apache.fineract.commands.domain.CommandWrapper;
+import org.apache.fineract.commands.service.CommandWrapperBuilder;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
+import org.apache.fineract.infrastructure.creditbureau.data.CreditReportData;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauToken;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauTokenCredential;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.TokenDataRepositoryWrapper;
+import 
org.apache.fineract.infrastructure.creditbureau.domain.TokenRepositoryWrapper;
+import 
org.apache.fineract.infrastructure.creditbureau.serialization.CreditBureauTokenCommandFromApiJsonDeserializer;
+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.cache.annotation.CacheEvict;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+public class CreditBureauReportsReadPlatformServiceImpl implements 
CreditBureauReportsReadPlatformService {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(CreditBureauReportsReadPlatformServiceImpl.class);
+    private final JdbcTemplate jdbcTemplate;
+    private final PlatformSecurityContext context;
+    private final FromJsonHelper fromApiJsonHelper;
+    private final TokenRepositoryWrapper tokenRepository;
+    private final TokenDataRepositoryWrapper tokenDataRepository;
+    private final CreditBureauTokenCommandFromApiJsonDeserializer 
fromApiJsonDeserializer;
+
+    @Autowired
+    public CreditBureauReportsReadPlatformServiceImpl(final 
PlatformSecurityContext context, final RoutingDataSource dataSource,
+            final FromJsonHelper fromApiJsonHelper, final 
TokenRepositoryWrapper tokenRepository,
+            final TokenDataRepositoryWrapper tokenDataRepository,
+            final CreditBureauTokenCommandFromApiJsonDeserializer 
fromApiJsonDeserializer) {
+        this.context = context;
+        this.jdbcTemplate = new JdbcTemplate(dataSource);
+        this.tokenRepository = tokenRepository;
+        this.tokenDataRepository = tokenDataRepository;
+        this.fromApiJsonHelper = fromApiJsonHelper;
+        this.fromApiJsonDeserializer = fromApiJsonDeserializer;
+    }
+
+    @SuppressWarnings({ "CatchAndPrintStackTrace", "DefaultCharset" })
+    @Override
+    @Transactional
+    @CacheEvict(value = "searchreport", key = 
"T(org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('cv')")
+    public CreditReportData retrieveAllSearchReport(final String searchId) {
+        String result = null;
+        Long uniqueID = 0L;
+        try {
+            this.context.authenticatedUser();
+
+            final CreditBureauTokenCredential credittokendata = 
this.tokenDataRepository.getTokenCredential();
+            String userName = credittokendata.getUserName();
+            String password = credittokendata.getPassword();
+            String subscriptionId = credittokendata.getSubscriptionId();
+            String subscriptionKey = credittokendata.getSubscriptionKey();
+            String tokenDate;
+
+            CreditBureauToken creditbureautoken = 
this.tokenRepository.getToken();
+            LOG.info("credit bureau token : {} ", creditbureautoken);
+
+            // check the expiry date of the previous token.
+            if (creditbureautoken != null) {
+                try {
+                    Date current = new Date();
+
+                    String getDate = creditbureautoken.getTokenExpiryDate();
+                    DateFormat dateformat = new SimpleDateFormat("EEE, dd MMM 
yyyy kk:mm:ss zzz", Locale.ENGLISH);
+                    Date getExpiryDate = dateformat.parse(getDate);
+                    LOG.info("current date : {} ", current);
+                    LOG.info("getExpiryDate : {} ", getExpiryDate);
+
+                    ZoneId zid = ZoneId.of("Asia/Rangoon");
+                    final LocalDate date = LocalDate.now(zid);
+                    LOG.info("local date : {} ", date);
+
+                    if (getExpiryDate.before(current)) {
+                        LOG.info("The token is expired");
+                        final CreditBureauToken credittoken = 
this.tokenRepository.getToken();
+                        if (credittoken != null) {
+
+                            this.tokenRepository.delete(credittoken);
+                            creditbureautoken = null;
+                        }
+
+                    }
+
+                } catch (ParseException Ex) {
+                    LOG.error("Error occured.", Ex);
+                }
+            }
+
+            // if token is not available or previous token is expired then 
create a new token
+            if (creditbureautoken == null) {
+
+                LOG.info("-----creating new token-----");
+                final String POST_PARAMS = "\n" + 
"BODY=x-www-form-urlencoded&\r\n" + "grant_type=password&\r\n" + "userName=" + 
userName
+                        + "&\r\n" + "password=" + password + "&\r\n";
+
+                URL obj = new 
URL("https://mmcix.azure-api.net/qa/20200324/Token";);
+                String readLine = null;
+
+                HttpURLConnection postConnection = (HttpURLConnection) 
obj.openConnection();
+                postConnection.setRequestMethod("POST");
+                postConnection.setRequestProperty("mcix-subscription-key", 
subscriptionKey);
+                postConnection.setRequestProperty("mcix-subscription-id", 
subscriptionId);
+                postConnection.setRequestProperty("Content-Type", 
"application/x-www-form-urlencoded");
+
+                postConnection.setDoOutput(true);
+
+                OutputStream os = postConnection.getOutputStream();
+                os.write(POST_PARAMS.getBytes(StandardCharsets.UTF_8));
+                os.flush();
+                os.close();
+
+                int responseCode = postConnection.getResponseCode();
+
+                String ResponseMessage = postConnection.getResponseMessage();
+
+                if (responseCode == HttpURLConnection.HTTP_OK) {
+                    BufferedReader in = new BufferedReader(new 
InputStreamReader(postConnection.getInputStream(), StandardCharsets.UTF_8));
+                    StringBuilder response = new StringBuilder();
+                    while ((readLine = in.readLine()) != null) {
+                        response.append(readLine);
+                    }
+                    in.close();
+
+                    result = response.toString();
+
+                    final CommandWrapper wrapper = new 
CommandWrapperBuilder().withJson(result).build();
+                    final String json = wrapper.getJson();
+                    result = null;
+                    JsonCommand apicommand = null;
+                    boolean isApprovedByChecker = false;
+                    final JsonElement parsedCommand = 
this.fromApiJsonHelper.parse(json);
+
+                    apicommand = JsonCommand.from(json, parsedCommand, 
this.fromApiJsonHelper, wrapper.getEntityName(),
+                            wrapper.getEntityId(), wrapper.getSubentityId(), 
wrapper.getGroupId(), wrapper.getClientId(),
+                            wrapper.getLoanId(), wrapper.getSavingsId(), 
wrapper.getTransactionId(), wrapper.getHref(),
+                            wrapper.getProductId(), 
wrapper.getCreditBureauId(), wrapper.getOrganisationCreditBureauId());
+
+                    
this.fromApiJsonDeserializer.validateForCreate(apicommand.json());
+
+                    final CreditBureauToken generatedtoken = 
CreditBureauToken.fromJson(apicommand);
+
+                    this.tokenRepository.save(generatedtoken);
+
+                } else {
+                    LOG.info("Request is Invalid");
+
+                }
+            }
+
+            // Search Methods
+            LOG.info("-----Search by NRC-----");
+            StringBuilder response = new StringBuilder();
+            creditbureautoken = this.tokenRepository.getToken();
+            String token = creditbureautoken.getCurrentToken();
+
+            final String POST_PARAMS = "BODY=x-www-form-urlencoded&nrc=" + 
searchId + "&";
+
+            URL obj = new 
URL("https://mmcix.azure-api.net/qa/20200324/api/Search/SimpleSearch?nrc="; + 
searchId);
+            String readLine = null;
+            LOG.info("POST_PARAMS : {} ", POST_PARAMS);
+            LOG.info("obj : {} ", obj);
+            LOG.info("subscriptionId : {} ", subscriptionId);
+            LOG.info("subscriptionKey : {} ", subscriptionKey);
+            LOG.info("token : {} ", token);
+
+            HttpURLConnection postConnection = (HttpURLConnection) 
obj.openConnection();

Review comment:
       refactor http connection into method.




----------------------------------------------------------------
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]


Reply via email to