You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by na...@apache.org on 2017/06/09 10:27:35 UTC

[1/3] fineract git commit: formatted creditbureau configuration

Repository: fineract
Updated Branches:
  refs/heads/develop 5473e3713 -> 06c959ebb


http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/handler/UpdateCreditBureauLoanProductMappingCommandHandler.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/handler/UpdateCreditBureauLoanProductMappingCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/handler/UpdateCreditBureauLoanProductMappingCommandHandler.java
new file mode 100644
index 0000000..aa3d845
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/handler/UpdateCreditBureauLoanProductMappingCommandHandler.java
@@ -0,0 +1,49 @@
+/**
+ * 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.handler;
+
+import org.apache.fineract.commands.annotation.CommandType;
+import org.apache.fineract.commands.handler.NewCommandSourceHandler;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.infrastructure.creditbureau.service.CreditBureauLoanProductMappingWritePlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@CommandType(entity = "CREDITBUREAU_LOANPRODUCT_MAPPING", action = "UPDATE")
+public class UpdateCreditBureauLoanProductMappingCommandHandler implements NewCommandSourceHandler {
+
+	private final CreditBureauLoanProductMappingWritePlatformService writePlatformService;
+
+	@Autowired
+	public UpdateCreditBureauLoanProductMappingCommandHandler(final CreditBureauLoanProductMappingWritePlatformService writePlatformService) {
+
+		this.writePlatformService = writePlatformService;
+	}
+
+	@Transactional
+	@Override
+	public CommandProcessingResult processCommand(final JsonCommand command) {
+
+		return this.writePlatformService.updateCreditBureauLoanProductMapping(command);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/serialization/CreditBureauCommandFromApiJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/serialization/CreditBureauCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/serialization/CreditBureauCommandFromApiJsonDeserializer.java
new file mode 100644
index 0000000..fdc9acc
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/serialization/CreditBureauCommandFromApiJsonDeserializer.java
@@ -0,0 +1,90 @@
+/**
+ * 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.serialization;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.fineract.infrastructure.core.data.ApiParameterError;
+import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
+import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
+import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
+import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import org.joda.time.LocalDate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.google.gson.JsonElement;
+import com.google.gson.reflect.TypeToken;
+
+@Component
+public class CreditBureauCommandFromApiJsonDeserializer {
+
+	private final Set<String> supportedParameters = new HashSet<>(Arrays.asList("alias", "is_active"));
+
+	private final FromJsonHelper fromApiJsonHelper;
+
+	@Autowired
+	public CreditBureauCommandFromApiJsonDeserializer(final FromJsonHelper fromApiJsonHelper) {
+		this.fromApiJsonHelper = fromApiJsonHelper;
+	}
+
+	public void validateForCreate(final String json, final Long creditBureauId) {
+		if (StringUtils.isBlank(json)) {
+			throw new InvalidJsonException();
+		}
+
+		final Type typeOfMap = new TypeToken<Map<String, Object>>() {
+		}.getType();
+		this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters);
+
+		final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
+		final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
+				.resource("CreditBureau");
+
+		final JsonElement element = this.fromApiJsonHelper.parse(json);
+	
+		baseDataValidator.reset().value(creditBureauId).notBlank().integerGreaterThanZero();
+
+		final String alias = this.fromApiJsonHelper.extractStringNamed("alias", element);
+		baseDataValidator.reset().parameter("alias").value(alias).notNull().notBlank().notExceedingLengthOf(100);
+
+		final String is_activeParameter = "is_active";
+		if (this.fromApiJsonHelper.parameterExists(is_activeParameter, element)) {
+			final boolean is_active = this.fromApiJsonHelper.extractBooleanNamed("is_active", element);
+			baseDataValidator.reset().parameter("is_active").value(is_active).notNull().notBlank().trueOrFalseRequired(is_active);
+		}
+
+		throwExceptionIfValidationWarningsExist(dataValidationErrors);
+	}
+
+	private void throwExceptionIfValidationWarningsExist(final List<ApiParameterError> dataValidationErrors) {
+		if (!dataValidationErrors.isEmpty()) {
+			throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist",
+					"Validation errors exist.", dataValidationErrors);
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/serialization/CreditBureauLoanProductCommandFromApiJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/serialization/CreditBureauLoanProductCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/serialization/CreditBureauLoanProductCommandFromApiJsonDeserializer.java
new file mode 100644
index 0000000..4aa2fb6
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/serialization/CreditBureauLoanProductCommandFromApiJsonDeserializer.java
@@ -0,0 +1,137 @@
+/**
+ * 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.serialization;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.fineract.infrastructure.core.data.ApiParameterError;
+import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
+import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
+import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
+import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.google.gson.JsonElement;
+import com.google.gson.reflect.TypeToken;
+
+@Component
+public class CreditBureauLoanProductCommandFromApiJsonDeserializer {
+	private final Set<String> supportedParameters = new HashSet<>(Arrays.asList("loan_product_id",
+			"is_creditcheck_mandatory", "skip_creditcheck_in_failure", "stale_period", "is_active", "locale"));
+
+	private final FromJsonHelper fromApiJsonHelper;
+
+	@Autowired
+	public CreditBureauLoanProductCommandFromApiJsonDeserializer(final FromJsonHelper fromApiJsonHelper) {
+		this.fromApiJsonHelper = fromApiJsonHelper;
+	}
+
+	public void validateForCreate(final String json, final Long cb_id) {
+		if (StringUtils.isBlank(json)) {
+			throw new InvalidJsonException();
+		}
+
+		final Type typeOfMap = new TypeToken<Map<String, Object>>() {
+		}.getType();
+		this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters);
+
+		final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
+		final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
+				.resource("CREDITBUREAU_LOANPRODUCT_MAPPING");
+
+		final JsonElement element = this.fromApiJsonHelper.parse(json);
+
+		baseDataValidator.reset().value(cb_id).notBlank().integerGreaterThanZero();
+
+		final long loan_product_id = this.fromApiJsonHelper.extractLongNamed("loan_product_id", element);
+		baseDataValidator.reset().parameter("loan_product_id").value(loan_product_id).notBlank()
+				.integerGreaterThanZero();
+		System.out.println("loan product id " + loan_product_id);
+			
+		if(this.fromApiJsonHelper.extractBooleanNamed("is_creditcheck_mandatory",element)!= null)
+		{
+			final boolean is_creditcheck_mandatory = this.fromApiJsonHelper.extractBooleanNamed("is_creditcheck_mandatory",
+					element);
+			baseDataValidator.reset().parameter("is_creditcheck_mandatory").value(is_creditcheck_mandatory).notBlank()
+					.trueOrFalseRequired(is_creditcheck_mandatory);	
+		}
+		else
+		{
+			baseDataValidator.reset().parameter("is_creditcheck_mandatory").value(this.fromApiJsonHelper.extractBooleanNamed("is_creditcheck_mandatory",
+					element)).notBlank()
+			.trueOrFalseRequired(this.fromApiJsonHelper.extractBooleanNamed("is_creditcheck_mandatory",
+					element));	
+		}
+		
+		
+		if( this.fromApiJsonHelper.extractBooleanNamed("skip_creditcheck_in_failure", element)!=null)
+		{
+			final boolean skip_creditcheck_in_failure = this.fromApiJsonHelper.extractBooleanNamed("skip_creditcheck_in_failure", element);
+			baseDataValidator.reset().parameter("skip_creditcheck_in_failure").value(skip_creditcheck_in_failure).notBlank().trueOrFalseRequired(skip_creditcheck_in_failure);
+				
+		}
+		else
+		{
+			baseDataValidator.reset().parameter("skip_creditcheck_in_failure").value(this.fromApiJsonHelper.extractBooleanNamed("skip_creditcheck_in_failure", element)).notBlank().trueOrFalseRequired(this.fromApiJsonHelper.extractBooleanNamed("skip_creditcheck_in_failure", element));	
+		}
+		
+
+		if(this.fromApiJsonHelper.extractLongNamed("stale_period", element)!=null)
+		{
+			final long stale_period = this.fromApiJsonHelper.extractLongNamed("stale_period", element);
+			baseDataValidator.reset().parameter("stale_period").value(stale_period).notBlank().integerGreaterThanZero();	
+		}
+		else
+		{
+			baseDataValidator.reset().parameter("stale_period").value(this.fromApiJsonHelper.extractLongNamed("stale_period", element)).notBlank().integerGreaterThanZero();		
+		}
+
+		
+		if(this.fromApiJsonHelper.extractBooleanNamed("is_active", element)!=null)
+		{
+			Boolean is_active = this.fromApiJsonHelper.extractBooleanNamed("is_active", element);
+			if (is_active == null) {
+				is_active = false;
+			} else {
+
+				baseDataValidator.reset().parameter("is_active").value(is_active).notBlank().trueOrFalseRequired(is_active);
+			}	
+		}
+
+	
+
+		throwExceptionIfValidationWarningsExist(dataValidationErrors);
+
+	}
+
+	private void throwExceptionIfValidationWarningsExist(final List<ApiParameterError> dataValidationErrors) {
+		if (!dataValidationErrors.isEmpty()) {
+			throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist",
+					"Validation errors exist.", dataValidationErrors);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingReadPlatformService.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingReadPlatformService.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingReadPlatformService.java
new file mode 100644
index 0000000..d5a74f2
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingReadPlatformService.java
@@ -0,0 +1,33 @@
+/**
+ * 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 java.util.Collection;
+
+import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauLoanProductMappingData;
+
+public interface CreditBureauLoanProductMappingReadPlatformService {
+
+	Collection<CreditBureauLoanProductMappingData> readCreditBureauLoanProductMapping();
+
+	Collection<CreditBureauLoanProductMappingData> fetchLoanProducts();
+
+	CreditBureauLoanProductMappingData readMappingByLoanId(long loanProductId);
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingReadPlatformServiceImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingReadPlatformServiceImpl.java
new file mode 100644
index 0000000..b5f7145
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingReadPlatformServiceImpl.java
@@ -0,0 +1,122 @@
+/**
+ * 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 java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Collection;
+
+import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
+import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauLoanProductMappingData;
+import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.RowMapper;
+import org.springframework.stereotype.Service;
+
+@Service
+public class CreditBureauLoanProductMappingReadPlatformServiceImpl implements CreditBureauLoanProductMappingReadPlatformService {
+	private final JdbcTemplate jdbcTemplate;
+	private final PlatformSecurityContext context;
+
+	@Autowired
+	public CreditBureauLoanProductMappingReadPlatformServiceImpl(final PlatformSecurityContext context,
+			final RoutingDataSource dataSource) {
+		this.context = context;
+		this.jdbcTemplate = new JdbcTemplate(dataSource);
+	}
+
+	private static final class CreditBureauLoanProductMapper implements RowMapper<CreditBureauLoanProductMappingData> {
+
+		public String schema() {
+			return "cblp.id as mappingId, cblp.organisation_creditbureau_id as orgcbId,"
+					+ "orgcb.alias as alias,concat( cb.product,' - ' ,cb.name,' - ',cb.country) as creditbureau,"
+					+ "cblp.loan_product_id as lpId,lp.name as loan_product_name,cblp.is_creditcheck_mandatory as crCheck,cblp.skip_creditcheck_in_failure as skipcheck,"
+					+ "cblp.stale_period as staleperiod,cblp.is_active as is_active from"
+					+ " m_creditbureau_loanproduct_mapping cblp, m_organisation_creditbureau orgcb,m_product_loan lp,m_creditbureau cb"
+					+ " where cblp.organisation_creditbureau_id=orgcb.id and cblp.loan_product_id=lp.id and orgcb.creditbureau_id=cb.id";
+		}
+
+		@Override
+		public CreditBureauLoanProductMappingData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
+				throws SQLException {
+			final Long mapping_id = rs.getLong("mappingId");
+			final Long orgcbID = rs.getLong("orgcbId");
+			final String alias = rs.getString("alias");
+			final String credit_bureau_name = rs.getString("creditbureau");
+			final String loan_product_name = rs.getString("loan_product_name");
+			final Long lpId = rs.getLong("lpId");
+			final boolean is_creditcheck_mandatory = rs.getBoolean("crCheck");
+			final boolean skip_credit_check_in_failure = rs.getBoolean("skipcheck");
+			final int stale_period = rs.getInt("staleperiod");
+			final boolean is_active = rs.getBoolean("is_active");
+
+			return CreditBureauLoanProductMappingData.instance(mapping_id, orgcbID, alias, credit_bureau_name, loan_product_name,
+					lpId, is_creditcheck_mandatory, skip_credit_check_in_failure, stale_period, is_active);
+		}
+	}
+
+	private static final class LoanProductMapper implements RowMapper<CreditBureauLoanProductMappingData> {
+
+		public String schema() {
+			return "lp.name as loan_product_name,lp.id as loanid from m_product_loan lp";
+		}
+
+		@Override
+		public CreditBureauLoanProductMappingData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
+				throws SQLException {
+			final Long loanid = rs.getLong("loanid");
+
+			final String loan_product_name = rs.getString("loan_product_name");
+
+			return CreditBureauLoanProductMappingData.instance1(loan_product_name, loanid);
+		}
+	}
+
+	@Override
+	public Collection<CreditBureauLoanProductMappingData> readCreditBureauLoanProductMapping() {
+		this.context.authenticatedUser();
+
+		final CreditBureauLoanProductMapper rm = new CreditBureauLoanProductMapper();
+		final String sql = "select " + rm.schema() + " order by cblp.id";
+
+		return this.jdbcTemplate.query(sql, rm, new Object[] {});
+	}
+
+	@Override
+	public CreditBureauLoanProductMappingData readMappingByLoanId(long loanProductId) {
+		this.context.authenticatedUser();
+
+		final CreditBureauLoanProductMapper rm = new CreditBureauLoanProductMapper();
+		final String sql = "select " + rm.schema() + " and cblp.loan_product_id=?";
+
+		return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanProductId });
+	}
+
+	@Override
+	public Collection<CreditBureauLoanProductMappingData> fetchLoanProducts() {
+		this.context.authenticatedUser();
+
+		final LoanProductMapper rm = new LoanProductMapper();
+		final String sql = "select " + rm.schema() + " order by lp.id";
+
+		return this.jdbcTemplate.query(sql, rm, new Object[] {});
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingWritePlatformService.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingWritePlatformService.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingWritePlatformService.java
new file mode 100644
index 0000000..41e2977
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingWritePlatformService.java
@@ -0,0 +1,30 @@
+/**
+ * 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 org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+
+public interface CreditBureauLoanProductMappingWritePlatformService {
+
+	CommandProcessingResult addCreditBureauLoanProductMapping(Long creditBureauId, JsonCommand command);
+
+	CommandProcessingResult updateCreditBureauLoanProductMapping(JsonCommand command);
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingWritePlatformServiceImpl.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..b6a04a7
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingWritePlatformServiceImpl.java
@@ -0,0 +1,96 @@
+/**
+ * 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 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.creditbureau.domain.CreditBureauLoanProductMapping;
+import org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauLoanProductMappingRepository;
+import org.apache.fineract.infrastructure.creditbureau.domain.OrganisationCreditBureau;
+import org.apache.fineract.infrastructure.creditbureau.domain.OrganisationCreditBureauRepository;
+import org.apache.fineract.infrastructure.creditbureau.serialization.CreditBureauLoanProductCommandFromApiJsonDeserializer;
+import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
+import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct;
+import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+public class CreditBureauLoanProductMappingWritePlatformServiceImpl implements CreditBureauLoanProductMappingWritePlatformService {
+
+	private final PlatformSecurityContext context;
+
+	private final CreditBureauLoanProductMappingRepository creditBureauLoanProductMappingRepository;
+
+	private final OrganisationCreditBureauRepository organisationCreditBureauRepository;
+
+	private final LoanProductRepository loanProductRepository;
+
+	private final CreditBureauLoanProductCommandFromApiJsonDeserializer fromApiJsonDeserializer;
+
+	@Autowired
+	public CreditBureauLoanProductMappingWritePlatformServiceImpl(final PlatformSecurityContext context,
+			final CreditBureauLoanProductMappingRepository creditbureauLoanProductMappingRepository,
+			final OrganisationCreditBureauRepository organisationCreditBureauRepository, LoanProductRepository loanProductRepository,
+			final CreditBureauLoanProductCommandFromApiJsonDeserializer fromApiJsonDeserializer) {
+		this.context = context;
+		this.creditBureauLoanProductMappingRepository = creditbureauLoanProductMappingRepository;
+		this.organisationCreditBureauRepository = organisationCreditBureauRepository;
+		this.loanProductRepository = loanProductRepository;
+		this.fromApiJsonDeserializer = fromApiJsonDeserializer;
+
+	}
+
+	@Transactional
+	@Override
+	public CommandProcessingResult addCreditBureauLoanProductMapping(Long creditBureau_id, JsonCommand command) {
+		this.context.authenticatedUser();
+		
+		System.out.println("mapping called for creditBureau_id "+creditBureau_id);
+		this.fromApiJsonDeserializer.validateForCreate(command.json(), creditBureau_id);
+
+		final long lpid = command.longValueOfParameterNamed("loan_product_id");
+
+		final OrganisationCreditBureau orgcb = this.organisationCreditBureauRepository.getOne(creditBureau_id);
+
+		final LoanProduct lp = this.loanProductRepository.getOne(lpid);
+
+		final CreditBureauLoanProductMapping cb_lp = CreditBureauLoanProductMapping.fromJson(command, orgcb, lp);
+
+		this.creditBureauLoanProductMappingRepository.save(cb_lp);
+
+		return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(cb_lp.getId())
+				.build();
+
+	}
+
+	@Override
+	public CommandProcessingResult updateCreditBureauLoanProductMapping(JsonCommand command) {
+
+		final Long mappingid = command.longValueOfParameterNamed("creditbureauLoanProductMappingId");
+		final boolean is_active = command.booleanPrimitiveValueOfParameterNamed("is_active");
+		final CreditBureauLoanProductMapping cblpmapping = this.creditBureauLoanProductMappingRepository.getOne(mappingid);
+		cblpmapping.setIs_active(is_active);
+		this.creditBureauLoanProductMappingRepository.saveAndFlush(cblpmapping);
+		return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(cblpmapping.getId())
+				.build();
+	}
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauMasterReadPlatformService.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauMasterReadPlatformService.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauMasterReadPlatformService.java
new file mode 100644
index 0000000..ef295a8
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauMasterReadPlatformService.java
@@ -0,0 +1,31 @@
+/**
+ * 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 java.util.Collection;
+
+import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauMasterData;
+
+public interface CreditBureauMasterReadPlatformService {
+
+	Collection<CreditBureauMasterData> retrieveCreditBureauByCountry(String country);
+
+	Collection<CreditBureauMasterData> retrieveCreditBureauByCountry();
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReadConfigurationService.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReadConfigurationService.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReadConfigurationService.java
new file mode 100644
index 0000000..5cdd959
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReadConfigurationService.java
@@ -0,0 +1,33 @@
+/**
+ * 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 java.util.Collection;
+import java.util.Map;
+
+import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauConfigurationData;
+
+public interface CreditBureauReadConfigurationService {
+
+	Collection<CreditBureauConfigurationData> readConfigurationByOrganisationCreditBureauId(long id);
+
+	Map<String, String> retrieveConfigMap(long id);
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReadConfigurationServiceImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReadConfigurationServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReadConfigurationServiceImpl.java
new file mode 100644
index 0000000..6a3a917
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReadConfigurationServiceImpl.java
@@ -0,0 +1,102 @@
+/**
+ * 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 java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
+import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauConfigurationData;
+import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.RowMapper;
+import org.springframework.stereotype.Service;
+
+@Service
+public class CreditBureauReadConfigurationServiceImpl implements CreditBureauReadConfigurationService {
+
+	private final JdbcTemplate jdbcTemplate;
+	private final PlatformSecurityContext context;
+
+	@Autowired
+	public CreditBureauReadConfigurationServiceImpl(final PlatformSecurityContext context,
+			final RoutingDataSource dataSource) {
+		this.context = context;
+		this.jdbcTemplate = new JdbcTemplate(dataSource);
+	}
+
+	private static final class CbConfigMapper implements RowMapper<CreditBureauConfigurationData> {
+		public String schema() {
+
+			return "cbconfig.id as configId,cbconfig.configkey,cbconfig.value as configValue,"
+					+ "cbconfig.organisation_creditbureau_id as orgCBId,cbconfig.description as description from m_creditbureau_configuration cbconfig ";
+
+		}
+
+		@Override
+		public CreditBureauConfigurationData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
+				throws SQLException {
+			final long configId = rs.getLong("configId");
+			final String configkey = rs.getString("configkey");
+			final String configValue = rs.getString("configValue");
+			final long orgCBId = rs.getLong("orgCBId");
+			final String desc = rs.getString("description");
+
+			return CreditBureauConfigurationData.instance(configId, configkey, configValue, orgCBId, desc);
+
+		}
+	}
+
+	@Override
+	public Collection<CreditBureauConfigurationData> readConfigurationByOrganisationCreditBureauId(long id) {
+
+		this.context.authenticatedUser();
+
+		final CbConfigMapper rm = new CbConfigMapper();
+		final String sql = "select " + rm.schema() + " where cbconfig.organisation_creditbureau_id=?";
+
+		return this.jdbcTemplate.query(sql, rm, new Object[] { id });
+
+	}
+
+	@Override
+	public Map<String, String> retrieveConfigMap(long id) {
+		this.context.authenticatedUser();
+
+		final CbConfigMapper rm = new CbConfigMapper();
+		final String sql = "select " + rm.schema() + " where cbconfig.organisation_creditbureau_id=" + id;
+
+		List<CreditBureauConfigurationData> config = (List<CreditBureauConfigurationData>) this.jdbcTemplate.query(sql,
+				rm, new Object[] {});
+		Map<String, String> configuration = new HashMap<String, String>();
+		for (CreditBureauConfigurationData data : config) {
+			configuration.put(data.getConfigurationKey(), data.getValue());
+
+		}
+
+		return configuration;
+
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReadPlatformService.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReadPlatformService.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReadPlatformService.java
new file mode 100644
index 0000000..ebc64f0
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReadPlatformService.java
@@ -0,0 +1,29 @@
+/**
+ * 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 java.util.Collection;
+
+import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauData;
+
+public interface CreditBureauReadPlatformService {
+
+	Collection<CreditBureauData> retrieveCreditBureau();
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReadPlatformServiceImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReadPlatformServiceImpl.java
new file mode 100644
index 0000000..ea90f80
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauReadPlatformServiceImpl.java
@@ -0,0 +1,77 @@
+/**
+ * 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 java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Collection;
+
+import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
+import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauData;
+import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.RowMapper;
+import org.springframework.stereotype.Service;
+
+@Service
+public class CreditBureauReadPlatformServiceImpl implements CreditBureauReadPlatformService {
+
+	private final JdbcTemplate jdbcTemplate;
+	private final PlatformSecurityContext context;
+
+	@Autowired
+	public CreditBureauReadPlatformServiceImpl(final PlatformSecurityContext context,
+			final RoutingDataSource dataSource) {
+		this.context = context;
+		this.jdbcTemplate = new JdbcTemplate(dataSource);
+	}
+
+	private static final class CBMapper implements RowMapper<CreditBureauData> {
+		public String schema() {
+			return "cb.id as creditBureauID,cb.name as creditBureauName,cb.product as creditBureauProduct,"
+					+ "cb.country as country,concat(cb.product,' - ',cb.name,' - ',cb.country) as cbSummary,cb.implementationKey as implementationKey from m_creditbureau cb";
+		}
+
+		@Override
+		public CreditBureauData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
+				throws SQLException {
+			final long id = rs.getLong("creditBureauID");
+			final String name = rs.getString("creditBureauName");
+			final String product = rs.getString("creditBureauProduct");
+			final String country = rs.getString("country");
+			final String cbSummary = rs.getString("cbSummary");
+			final long implementationKey = rs.getLong("implementationKey");
+
+			return CreditBureauData.instance(id, name, product, country, cbSummary, implementationKey);
+
+		}
+	}
+
+	@Override
+	public Collection<CreditBureauData> retrieveCreditBureau() {
+		this.context.authenticatedUser();
+
+		final CBMapper rm = new CBMapper();
+		final String sql = "select " + rm.schema() + " order by id";
+
+		return this.jdbcTemplate.query(sql, rm, new Object[] {});
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauReadPlatformService.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauReadPlatformService.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauReadPlatformService.java
new file mode 100644
index 0000000..bb74b08
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauReadPlatformService.java
@@ -0,0 +1,29 @@
+/**
+ * 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 java.util.Collection;
+
+import org.apache.fineract.infrastructure.creditbureau.data.OrganisationCreditBureauData;
+
+public interface OrganisationCreditBureauReadPlatformService {
+	Collection<OrganisationCreditBureauData> retrieveOrgCreditBureau();
+
+	OrganisationCreditBureauData retrieveOrgCreditBureauById(long orgCbId);
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauReadPlatformServiceImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauReadPlatformServiceImpl.java
new file mode 100644
index 0000000..f711663
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauReadPlatformServiceImpl.java
@@ -0,0 +1,93 @@
+/**
+ * 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 java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Collection;
+
+import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
+import org.apache.fineract.infrastructure.creditbureau.data.OrganisationCreditBureauData;
+import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.RowMapper;
+import org.springframework.stereotype.Service;
+
+@Service
+public class OrganisationCreditBureauReadPlatformServiceImpl implements OrganisationCreditBureauReadPlatformService {
+
+	private final JdbcTemplate jdbcTemplate;
+	private final PlatformSecurityContext context;
+
+	@Autowired
+	public OrganisationCreditBureauReadPlatformServiceImpl(final PlatformSecurityContext context,
+			final RoutingDataSource dataSource) {
+		this.context = context;
+		this.jdbcTemplate = new JdbcTemplate(dataSource);
+	}
+
+	private static final class OrganisationCreditBureauMapper implements RowMapper<OrganisationCreditBureauData> {
+		public String schema() {
+			return "ocb.id as orgCbId,ocb.alias as orgCbAlias,cb.name as creditbureauName,cb.product as creditbureauProduct,cb.country as creditbureauCountry,"
+					+ "concat(cb.product,' - ',cb.name,' - ',cb.country) as CreditBureauSummary,"
+					+ "ocb.creditbureau_id as cbid,ocb.is_active as is_active"
+					+ " from m_organisation_creditbureau ocb,m_creditbureau cb where ocb.creditbureau_id=cb.id";
+
+		}
+
+		@Override
+		public OrganisationCreditBureauData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
+				throws SQLException {
+			final long orgCbId = rs.getLong("orgCbId");
+			final String orgCbAlias = rs.getString("orgCbAlias");
+			final String creditbureauName = rs.getString("creditbureauName");
+			final String creditbureauProduct = rs.getString("creditbureauProduct");
+			final String creditbureauCountry = rs.getString("creditbureauCountry");
+			final String CreditBureauSummary = rs.getString("CreditBureauSummary");
+			final long cbid = rs.getLong("cbid");
+			final boolean is_active = rs.getBoolean("is_active");
+
+			return OrganisationCreditBureauData.instance(orgCbId, orgCbAlias, cbid, creditbureauName,
+					creditbureauProduct, creditbureauCountry, CreditBureauSummary, is_active);
+
+		}
+	}
+
+	@Override
+	public Collection<OrganisationCreditBureauData> retrieveOrgCreditBureau() {
+		this.context.authenticatedUser();
+
+		final OrganisationCreditBureauMapper rm = new OrganisationCreditBureauMapper();
+		final String sql = "select " + rm.schema() + " order by ocb.id";
+
+		return this.jdbcTemplate.query(sql, rm, new Object[] {});
+	}
+
+	@Override
+	public OrganisationCreditBureauData retrieveOrgCreditBureauById(long orgCbId) {
+		this.context.authenticatedUser();
+
+		final OrganisationCreditBureauMapper rm = new OrganisationCreditBureauMapper();
+		final String sql = "select " + rm.schema() + " and ocb.id=?";
+
+		return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { orgCbId });
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauWritePlatflormService.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauWritePlatflormService.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauWritePlatflormService.java
new file mode 100644
index 0000000..21ffc74
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauWritePlatflormService.java
@@ -0,0 +1,29 @@
+/**
+ * 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 org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+
+public interface OrganisationCreditBureauWritePlatflormService {
+
+	CommandProcessingResult addOrganisationCreditBureau(Long ocb_id, JsonCommand command);
+
+	CommandProcessingResult updateCreditBureau(JsonCommand command);
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauWritePlatflormServiceImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauWritePlatflormServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauWritePlatflormServiceImpl.java
new file mode 100644
index 0000000..1131d58
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauWritePlatflormServiceImpl.java
@@ -0,0 +1,94 @@
+/**
+ * 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 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.creditbureau.domain.CreditBureau;
+import org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauRepository;
+import org.apache.fineract.infrastructure.creditbureau.domain.OrganisationCreditBureau;
+import org.apache.fineract.infrastructure.creditbureau.domain.OrganisationCreditBureauRepository;
+import org.apache.fineract.infrastructure.creditbureau.serialization.CreditBureauCommandFromApiJsonDeserializer;
+import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+public class OrganisationCreditBureauWritePlatflormServiceImpl
+		implements OrganisationCreditBureauWritePlatflormService {
+
+	private final PlatformSecurityContext context;
+
+	private final OrganisationCreditBureauRepository organisationCreditBureauRepository;
+
+	private final CreditBureauRepository creditBureauRepository;
+
+	private final CreditBureauCommandFromApiJsonDeserializer fromApiJsonDeserializer;
+
+	@Autowired
+	public OrganisationCreditBureauWritePlatflormServiceImpl(final PlatformSecurityContext context,
+			final OrganisationCreditBureauRepository organisationCreditBureauRepository, final CreditBureauRepository creditBureauRepository,
+			final CreditBureauCommandFromApiJsonDeserializer fromApiJsonDeserializer) {
+		this.context = context;
+		this.organisationCreditBureauRepository = organisationCreditBureauRepository;
+		this.creditBureauRepository = creditBureauRepository;
+		this.fromApiJsonDeserializer = fromApiJsonDeserializer;
+
+	}
+
+	@Override
+	public CommandProcessingResult addOrganisationCreditBureau(Long creditBureauId, JsonCommand command) {
+		this.context.authenticatedUser();
+		this.fromApiJsonDeserializer.validateForCreate(command.json(), creditBureauId);
+
+		final CreditBureau creditBureau = this.creditBureauRepository.getOne(creditBureauId);
+
+		final OrganisationCreditBureau organisationCreditBureau = OrganisationCreditBureau.fromJson(command, creditBureau);
+
+		this.organisationCreditBureauRepository.save(organisationCreditBureau);
+
+		return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(organisationCreditBureau.getId())
+				.build();
+	}
+
+	@Transactional
+	@Override
+	public CommandProcessingResult updateCreditBureau(JsonCommand command) {
+		// this.context.authenticatedUser();
+		// this.fromApiJsonDeserializer.validateForCreate(command.json());
+
+		final long creditbureauID = command.longValueOfParameterNamed("creditBureauId");
+		//System.out.println("creditbureauID is " + creditbureauID);
+
+		final boolean is_active = command.booleanPrimitiveValueOfParameterNamed("is_active");
+
+		final OrganisationCreditBureau orgcb = organisationCreditBureauRepository.getOne(creditbureauID);
+
+		orgcb.setIsActive(is_active);
+
+		organisationCreditBureauRepository.saveAndFlush(orgcb);
+
+		return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(orgcb.getId())
+				.build();
+
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformService.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformService.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformService.java
index f7aeb60..73f41cf 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformService.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformService.java
@@ -130,4 +130,6 @@ public interface LoanReadPlatformService {
     Collection<Long> retrieveLoanIdsWithPendingIncomePostingTransactions();
 
     LoanTransactionData retrieveLoanForeclosureTemplate(final Long loanId, final LocalDate transactionDate);
+
+	LoanAccountData retrieveLoanByLoanAccount(String loanAccountNumber);
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
index 46d9795..7483345 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
@@ -213,6 +213,22 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
             throw new LoanNotFoundException(loanId);
         }
     }
+    
+    @Override
+    public LoanAccountData retrieveLoanByLoanAccount(String loanAccountNumber)
+    {
+
+       
+            //final AppUser currentUser = this.context.authenticatedUser();
+    		this.context.authenticatedUser();
+            final LoanMapper rm = new LoanMapper();
+
+            String sql="select "+rm.loanSchema()+" where l.account_no=?"; 
+            
+
+            return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanAccountNumber });
+       
+    }
 
     @Override
     public LoanScheduleData retrieveRepaymentSchedule(final Long loanId,
@@ -231,6 +247,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
             throw new LoanNotFoundException(loanId);
         }
     }
+    
+    
 
     @Override
     public Collection<LoanTransactionData> retrieveLoanTransactions(final Long loanId) {

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
index 4f02d2e..bfb43f3 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
@@ -2303,7 +2303,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
 
             final JsonElement parsedCommand = this.fromApiJsonHelper.parse(overdueInstallment.toString());
             final JsonCommand command = JsonCommand.from(overdueInstallment.toString(), parsedCommand, this.fromApiJsonHelper, null, null,
-                    null, null, null, loanId, null, null, null, null);
+                    null, null, null, loanId, null, null, null, null,null,null);
             LoanOverdueDTO overdueDTO = applyChargeToOverdueLoanInstallment(loanId, overdueInstallment.getChargeId(),
                     overdueInstallment.getPeriodNumber(), command, loan, existingTransactionIds, existingReversedTransactionIds);
             loan = overdueDTO.getLoan();

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/service/ShareAccountCommandsServiceImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/service/ShareAccountCommandsServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/service/ShareAccountCommandsServiceImpl.java
index 6f56afa..926aa0d 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/service/ShareAccountCommandsServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/service/ShareAccountCommandsServiceImpl.java
@@ -47,7 +47,7 @@ public class ShareAccountCommandsServiceImpl implements AccountsCommandsService
     public Object handleCommand(Long accountId, String command, String jsonBody) {
         final JsonElement parsedCommand = this.fromApiJsonHelper.parse(jsonBody);
         final JsonCommand jsonCommand = JsonCommand.from(jsonBody, parsedCommand, this.fromApiJsonHelper, null, null, null, null, null,
-                null, null, null, null, null);
+                null, null, null, null, null,null,null);
         if(ShareAccountApiConstants.APPROVE_COMMAND.equals(command)){
             return approveShareAccount(accountId, jsonCommand) ;
         }if(ShareAccountApiConstants.REJECT_COMMAND.equals(command)){

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductCommandsServiceImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductCommandsServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductCommandsServiceImpl.java
index ee36863..e95d75c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductCommandsServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductCommandsServiceImpl.java
@@ -47,7 +47,7 @@ public class ShareProductCommandsServiceImpl implements ProductCommandsService {
     public Object handleCommand(Long productId, String command, String jsonBody) {
         final JsonElement parsedCommand = this.fromApiJsonHelper.parse(jsonBody);
         final JsonCommand jsonCommand = JsonCommand.from(jsonBody, parsedCommand, this.fromApiJsonHelper, null, null, null, null, null,
-                null, null, null, null, null);
+                null, null, null, null, null,null,null);
         if (ShareProductApiConstants.PREIEW_DIVIDENDS_COMMAND_STRING.equals(command)) {
             return null ;
         } else if (ShareProductApiConstants.POST_DIVIDENdS_COMMAND_STRING.equals(command)) { return postDividends(productId,

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/resources/META-INF/spring/appContext.xml
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/resources/META-INF/spring/appContext.xml b/fineract-provider/src/main/resources/META-INF/spring/appContext.xml
index 80ebec6..9fe95d4 100644
--- a/fineract-provider/src/main/resources/META-INF/spring/appContext.xml
+++ b/fineract-provider/src/main/resources/META-INF/spring/appContext.xml
@@ -43,6 +43,7 @@
 										  org.apache.fineract.commands.service.*,
 										  org.apache.fineract.commands.*,
 										  org.apache.fineract.audit.*,
+										 org.apache.fineract.infrastructure.creditbureau.*,
 										  org.apache.fineract.infrastructure.*,
 										  org.apache.fineract.scheduledjobs.*,
 										  org.apache.fineract.organisation.*,
@@ -69,7 +70,6 @@
 	<bean id="auditorAware"
 		class="org.apache.fineract.infrastructure.core.domain.AuditorAwareImpl" />
 	<jpa:auditing auditor-aware-ref="auditorAware" />
-
 	<jpa:repositories base-package="org.apache.fineract.commands.domain" />
 	<jpa:repositories base-package="org.apache.fineract.infrastructure.*.domain" />
 	<jpa:repositories base-package="org.apache.fineract.accounting.*.domain" />

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/resources/sql/migrations/core_db/V327__creditbureau_configuration.sql
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/resources/sql/migrations/core_db/V327__creditbureau_configuration.sql b/fineract-provider/src/main/resources/sql/migrations/core_db/V327__creditbureau_configuration.sql
new file mode 100644
index 0000000..d1ebd03
--- /dev/null
+++ b/fineract-provider/src/main/resources/sql/migrations/core_db/V327__creditbureau_configuration.sql
@@ -0,0 +1,89 @@
+--
+-- 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.
+--
+ 
+ -- credit bureau tables 
+CREATE TABLE `m_creditbureau` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `name` varchar(100) NOT NULL,
+  `product` varchar(100) NOT NULL,
+  `country` varchar(100) NOT NULL,
+  `implementationKey` varchar(100) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `unique impl` (`name`,`product`,`country`,`implementationKey`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+
+CREATE TABLE `m_organisation_creditbureau` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `alias` varchar(50) NOT NULL,
+  `creditbureau_id` bigint(20) NOT NULL,
+  `is_active` tinyint(4) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `morgcb` (`alias`,`creditbureau_id`),
+  KEY `orgcb_cbfk` (`creditbureau_id`),
+  CONSTRAINT `orgcb_cbfk` FOREIGN KEY (`creditbureau_id`) REFERENCES `m_creditbureau` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+
+
+
+CREATE TABLE `m_creditbureau_configuration` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `configkey` varchar(50) DEFAULT NULL,
+  `value` varchar(50) DEFAULT NULL,
+  `organisation_creditbureau_id` bigint(20) DEFAULT NULL,
+  `description` varchar(50) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `mcbconfig` (`configkey`,`organisation_creditbureau_id`),
+  KEY `cbConfigfk1` (`organisation_creditbureau_id`),
+  CONSTRAINT `cbConfigfk1` FOREIGN KEY (`organisation_creditbureau_id`) REFERENCES `m_organisation_creditbureau` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+
+
+
+
+CREATE TABLE `m_creditbureau_loanproduct_mapping` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `organisation_creditbureau_id` bigint(20) NOT NULL,
+  `loan_product_id` bigint(20) NOT NULL,
+  `is_creditcheck_mandatory` tinyint(1) DEFAULT NULL,
+  `skip_creditcheck_in_failure` tinyint(1) DEFAULT NULL,
+  `stale_period` int(11) DEFAULT NULL,
+  `is_active` tinyint(1) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `cblpunique_key` (`organisation_creditbureau_id`,`loan_product_id`),
+  KEY `fk_cb_lp2` (`loan_product_id`),
+  CONSTRAINT `cblpfk2` FOREIGN KEY (`organisation_creditbureau_id`) REFERENCES `m_organisation_creditbureau` (`id`),
+  CONSTRAINT `fk_cb_lp2` FOREIGN KEY (`loan_product_id`) REFERENCES `m_product_loan` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+
+--  modify `m_portfolio_command_source` command
+
+ALTER TABLE `m_portfolio_command_source`
+	ADD COLUMN `creditbureau_id` BIGINT(20) NULL DEFAULT NULL AFTER `transaction_id`,
+	ADD COLUMN `organisation_creditbureau_id` BIGINT(20) NULL DEFAULT NULL AFTER `creditbureau_id`;
+
+
+-- permissions
+INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('configuration', 'CREATE_CREDITBUREAU_LOANPRODUCT_MAPPING', 'CREDITBUREAU_LOANPRODUCT_MAPPING', 'CREATE', 0);
+INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('configuration', 'CREATE_ORGANISATIONCREDITBUREAU', 'ORGANISATIONCREDITBUREAU', 'CREATE', 0);
+INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('configuration', 'UPDATE_ORGANISATIONCREDITBUREAU', 'ORGANISATIONCREDITBUREAU', 'UPDATE', 0);
+INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('configuration', 'UPDATE_CREDITBUREAU_LOANPRODUCT_MAPPING', 'CREDITBUREAU_LOANPRODUCT_MAPPING', 'UPDATE', 0);

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/test/java/org/apache/fineract/commands/provider/CommandHandlerProviderTest.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/test/java/org/apache/fineract/commands/provider/CommandHandlerProviderTest.java b/fineract-provider/src/test/java/org/apache/fineract/commands/provider/CommandHandlerProviderTest.java
index 811845b..a3e9aa6 100644
--- a/fineract-provider/src/test/java/org/apache/fineract/commands/provider/CommandHandlerProviderTest.java
+++ b/fineract-provider/src/test/java/org/apache/fineract/commands/provider/CommandHandlerProviderTest.java
@@ -56,7 +56,7 @@ public class CommandHandlerProviderTest {
 
             final CommandProcessingResult result =
                     registeredHandler.processCommand(
-                            JsonCommand.fromExistingCommand(testCommandId, null, null, null, null, null, null, null, null));
+                            JsonCommand.fromExistingCommand(testCommandId, null, null, null, null, null, null, null, null,null,null));
             Assert.assertEquals(testCommandId, result.commandId());
         } catch (UnsupportedCommandException ucex) {
             Assert.fail();


[2/3] fineract git commit: formatted creditbureau configuration

Posted by na...@apache.org.
formatted creditbureau configuration


Project: http://git-wip-us.apache.org/repos/asf/fineract/repo
Commit: http://git-wip-us.apache.org/repos/asf/fineract/commit/34de03e0
Tree: http://git-wip-us.apache.org/repos/asf/fineract/tree/34de03e0
Diff: http://git-wip-us.apache.org/repos/asf/fineract/diff/34de03e0

Branch: refs/heads/develop
Commit: 34de03e045f3171b365e9b6023b427893f288412
Parents: 34b9881
Author: nikpawar89 <ni...@yahoo.in>
Authored: Mon Mar 13 04:45:50 2017 -0500
Committer: nikpawar89 <ni...@yahoo.in>
Committed: Fri Jun 9 14:36:53 2017 +0530

----------------------------------------------------------------------
 .../fineract/commands/domain/CommandSource.java |  23 ++
 .../commands/domain/CommandWrapper.java         |  27 ++-
 .../commands/service/CommandWrapperBuilder.java |  38 ++-
 ...ioCommandSourceWritePlatformServiceImpl.java |   7 +-
 .../infrastructure/core/api/JsonCommand.java    |  29 ++-
 .../core/data/DataValidatorBuilder.java         |  23 +-
 .../api/CreditBureauConfigurationAPI.java       | 239 +++++++++++++++++++
 .../data/CreditBureauConfigurationData.java     |  68 ++++++
 .../creditbureau/data/CreditBureauData.java     |  77 ++++++
 .../CreditBureauLoanProductMappingData.java     | 112 +++++++++
 .../data/CreditBureauMasterData.java            |  52 ++++
 .../creditbureau/data/CreditBureauProduct.java  |  53 ++++
 .../data/OrganisationCreditBureauData.java      |  91 +++++++
 .../creditbureau/domain/CreditBureau.java       | 112 +++++++++
 .../domain/CreditBureauConfiguration.java       | 101 ++++++++
 .../domain/CreditBureauLoanProductMapping.java  | 150 ++++++++++++
 ...reditBureauLoanProductMappingRepository.java |  27 +++
 .../domain/CreditBureauRepository.java          |  30 +++
 .../domain/OrganisationCreditBureau.java        | 100 ++++++++
 .../OrganisationCreditBureauRepository.java     |  27 +++
 ...dOrganisationCreditBureauCommandHandler.java |  45 ++++
 ...tBureauLoanProductMappingCommandHandler.java |  46 ++++
 .../UpdateCreditBureauCommandHandler.java       |  48 ++++
 ...tBureauLoanProductMappingCommandHandler.java |  49 ++++
 ...ditBureauCommandFromApiJsonDeserializer.java |  90 +++++++
 ...anProductCommandFromApiJsonDeserializer.java | 137 +++++++++++
 ...auLoanProductMappingReadPlatformService.java |  33 +++
 ...anProductMappingReadPlatformServiceImpl.java | 122 ++++++++++
 ...uLoanProductMappingWritePlatformService.java |  30 +++
 ...nProductMappingWritePlatformServiceImpl.java |  96 ++++++++
 .../CreditBureauMasterReadPlatformService.java  |  31 +++
 .../CreditBureauReadConfigurationService.java   |  33 +++
 ...reditBureauReadConfigurationServiceImpl.java | 102 ++++++++
 .../CreditBureauReadPlatformService.java        |  29 +++
 .../CreditBureauReadPlatformServiceImpl.java    |  77 ++++++
 ...nisationCreditBureauReadPlatformService.java |  29 +++
 ...tionCreditBureauReadPlatformServiceImpl.java |  93 ++++++++
 ...sationCreditBureauWritePlatflormService.java |  29 +++
 ...onCreditBureauWritePlatflormServiceImpl.java |  94 ++++++++
 .../service/LoanReadPlatformService.java        |   2 +
 .../service/LoanReadPlatformServiceImpl.java    |  18 ++
 ...anWritePlatformServiceJpaRepositoryImpl.java |   2 +-
 .../ShareAccountCommandsServiceImpl.java        |   2 +-
 .../ShareProductCommandsServiceImpl.java        |   2 +-
 .../resources/META-INF/spring/appContext.xml    |   2 +-
 .../V327__creditbureau_configuration.sql        |  89 +++++++
 .../provider/CommandHandlerProviderTest.java    |   2 +-
 47 files changed, 2696 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandSource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandSource.java b/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandSource.java
index a19d22c..06b04b1 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandSource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandSource.java
@@ -95,6 +95,12 @@ public class CommandSource extends AbstractPersistableCustom<Long> {
     
     @Column(name = "transaction_id", length = 100)
     private String transactionId;
+    
+    @Column(name="creditbureau_id")
+    private Long creditBureauId;
+    
+    @Column(name="organisation_creditbureau_id")
+    private Long organisationCreditBureauId;
 
     public static CommandSource fullEntryFrom(final CommandWrapper wrapper, final JsonCommand command, final AppUser maker) {
         return new CommandSource(wrapper.actionName(), wrapper.entityName(), wrapper.getHref(), command.entityId(), command.subentityId(),
@@ -116,8 +122,25 @@ public class CommandSource extends AbstractPersistableCustom<Long> {
         this.maker = maker;
         this.madeOnDate = madeOnDateTime.toDate();
         this.processingResult = CommandProcessingResultType.PROCESSED.getValue();
+    } public Long getCreditBureauId() {
+        return this.creditBureauId;
+    }
+
+    
+    public void setCreditBureauId(Long creditBureauId) {
+        this.creditBureauId = creditBureauId;
     }
 
+    
+    public Long getOrganisationCreditBureauId() {
+        return this.organisationCreditBureauId;
+    }
+
+    
+    public void setOrganisationCreditBureauId(Long OrganisationCreditBureauId) {
+        this.organisationCreditBureauId = OrganisationCreditBureauId;
+    }
+    
     public void markAsChecked(final AppUser checker, final DateTime checkedOnDate) {
         this.checker = checker;
         this.checkedOnDate = checkedOnDate.toDate();

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandWrapper.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandWrapper.java
index 3caa3a6..4590ba2 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandWrapper.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandWrapper.java
@@ -38,6 +38,8 @@ public class CommandWrapper {
     private final String json;
     private final String transactionId;
     private final Long productId;
+    private final Long creditBureauId;
+    private final Long organisationCreditBureauId;
 
     @SuppressWarnings("unused")
     private Long templateId;
@@ -53,9 +55,10 @@ public class CommandWrapper {
 
     public static CommandWrapper fromExistingCommand(final Long commandId, final String actionName, final String entityName,
             final Long resourceId, final Long subresourceId, final String resourceGetUrl, final Long productId, final Long officeId,
-            final Long groupId, final Long clientId, final Long loanId, final Long savingsId, final String transactionId) {
+            final Long groupId, final Long clientId, final Long loanId, final Long savingsId, final String transactionId,
+            final Long creditBureauId,final Long organisationCreditBureauId) {
         return new CommandWrapper(commandId, actionName, entityName, resourceId, subresourceId, resourceGetUrl, productId, officeId,
-                groupId, clientId, loanId, savingsId, transactionId);
+                groupId, clientId, loanId, savingsId, transactionId,creditBureauId,organisationCreditBureauId);
     }
 
     private CommandWrapper(final Long commandId, final String actionName, final String entityName, final Long resourceId,
@@ -75,11 +78,14 @@ public class CommandWrapper {
         this.json = null;
         this.transactionId = null;
         this.productId = productId;
+        this.creditBureauId=null;
+        this.organisationCreditBureauId=null;
     }
 
     public CommandWrapper(final Long officeId, final Long groupId, final Long clientId, final Long loanId, final Long savingsId,
             final String actionName, final String entityName, final Long entityId, final Long subentityId, final String href,
-            final String json, final String transactionId, final Long productId, final Long templateId) {
+            final String json, final String transactionId, final Long productId, final Long templateId,
+            final Long creditBureauId,final Long organisationCreditBureauId) {
 
         this.commandId = null;
         this.officeId = officeId;
@@ -97,11 +103,14 @@ public class CommandWrapper {
         this.transactionId = transactionId;
         this.productId = productId;
         this.templateId = templateId;
+        this.creditBureauId=creditBureauId;
+        this.organisationCreditBureauId=organisationCreditBureauId;
     }
 
     private CommandWrapper(final Long commandId, final String actionName, final String entityName, final Long resourceId,
             final Long subresourceId, final String resourceGetUrl, final Long productId, final Long officeId, final Long groupId,
-            final Long clientId, final Long loanId, final Long savingsId, final String transactionId) {
+            final Long clientId, final Long loanId, final Long savingsId, final String transactionId,
+            final Long creditBureauId,final Long organisationCreditBureauId) {
 
         this.commandId = commandId;
         this.officeId = officeId;
@@ -118,6 +127,16 @@ public class CommandWrapper {
         this.json = null;
         this.transactionId = transactionId;
         this.productId = productId;
+        this.creditBureauId=creditBureauId;
+        this.organisationCreditBureauId=organisationCreditBureauId;
+    }
+    
+    public Long getCreditBureauId() {
+        return this.creditBureauId;
+    }
+    
+    public Long getOrganisationCreditBureauId() {
+        return this.organisationCreditBureauId;
     }
 
     public String getHref() {

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java
----------------------------------------------------------------------
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 2ad6b22..5bcd21a 100755
--- 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
@@ -41,12 +41,48 @@ public class CommandWrapperBuilder {
     private String transactionId;
     private Long productId;
     private Long templateId;
+    private Long creditBureauId;
+    private Long organisationCreditBureauId;
    
 
     public CommandWrapper build() {
         return new CommandWrapper(this.officeId, this.groupId, this.clientId, this.loanId, this.savingsId, this.actionName,
                 this.entityName, this.entityId, this.subentityId, this.href, this.json, this.transactionId, this.productId,
-                this.templateId);
+                this.templateId,this.creditBureauId,this.organisationCreditBureauId);
+    }
+    
+    public CommandWrapperBuilder updateCreditBureau() {
+        this.actionName = "UPDATE";
+        this.entityName = "ORGANISATIONCREDITBUREAU";
+        this.entityId = null;
+        this.href = "/creditBureauConfiguration/template";
+        return this;
+    }
+    
+    public CommandWrapperBuilder updateCreditBureauLoanProductMapping() {
+        this.actionName = "UPDATE";
+        this.entityName = "CREDITBUREAU_LOANPRODUCT_MAPPING";
+        this.entityId = null;
+        this.href = "/creditBureauConfiguration/template";
+        return this;
+    }
+    
+    public CommandWrapperBuilder addOrganisationCreditBureau(final long organisationCreditBureauId) {
+        this.actionName = "CREATE";
+        this.entityName = "ORGANISATIONCREDITBUREAU";
+        this.entityId = organisationCreditBureauId;
+        this.href = "/creditBureauConfiguration/organizationCreditBureau/template";
+        this.organisationCreditBureauId=organisationCreditBureauId;
+        return this;
+    }
+    
+    public CommandWrapperBuilder createCreditBureauLoanProductMapping(final long CreditBureauId) {
+        this.actionName = "CREATE";
+        this.entityName = "CREDITBUREAU_LOANPRODUCT_MAPPING";
+        this.entityId = CreditBureauId;
+        this.href = "/creditBureauConfiguration/template";
+        this.creditBureauId=CreditBureauId;
+        return this;
     }
     
     public CommandWrapperBuilder addClientAddress(final long clientId,final long addressTypeId) {

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java
index 481290e..b0e228c 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java
@@ -92,7 +92,7 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio
         final JsonElement parsedCommand = this.fromApiJsonHelper.parse(json);
         command = 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.getTransactionId(), wrapper.getHref(), wrapper.getProductId(),wrapper.getCreditBureauId(),wrapper.getOrganisationCreditBureauId());
         while (numberOfRetries <= maxNumberOfRetries) {
             try {
                 result = this.processAndLogCommandService.processAndLogCommand(wrapper, command, isApprovedByChecker);
@@ -139,13 +139,14 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio
                 commandSourceInput.getEntityName(), commandSourceInput.resourceId(), commandSourceInput.subresourceId(),
                 commandSourceInput.getResourceGetUrl(), commandSourceInput.getProductId(), commandSourceInput.getOfficeId(),
                 commandSourceInput.getGroupId(), commandSourceInput.getClientId(), commandSourceInput.getLoanId(),
-                commandSourceInput.getSavingsId(), commandSourceInput.getTransactionId());
+                commandSourceInput.getSavingsId(), commandSourceInput.getTransactionId(),commandSourceInput.getCreditBureauId(),commandSourceInput.getOrganisationCreditBureauId());
         final JsonElement parsedCommand = this.fromApiJsonHelper.parse(commandSourceInput.json());
         final JsonCommand command = JsonCommand.fromExistingCommand(makerCheckerId, commandSourceInput.json(), parsedCommand,
                 this.fromApiJsonHelper, commandSourceInput.getEntityName(), commandSourceInput.resourceId(),
                 commandSourceInput.subresourceId(), commandSourceInput.getGroupId(), commandSourceInput.getClientId(),
                 commandSourceInput.getLoanId(), commandSourceInput.getSavingsId(), commandSourceInput.getTransactionId(),
-                commandSourceInput.getResourceGetUrl(), commandSourceInput.getProductId());
+                commandSourceInput.getResourceGetUrl(), commandSourceInput.getProductId(),commandSourceInput.getCreditBureauId(),
+                commandSourceInput.getOrganisationCreditBureauId());
 
         final boolean makerCheckerApproval = true;
         return this.processAndLogCommandService.processAndLogCommand(wrapper, command, makerCheckerApproval);

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/JsonCommand.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/JsonCommand.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/JsonCommand.java
index 488e7ba..da483c6 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/JsonCommand.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/JsonCommand.java
@@ -65,28 +65,31 @@ public final class JsonCommand {
     private final String transactionId;
     private final String url;
     private final Long productId;
+    private final Long creditBureauId;
+    private final Long organisationCreditBureauId;
 
     public static JsonCommand from(final String jsonCommand, final JsonElement parsedCommand, final FromJsonHelper fromApiJsonHelper,
             final String entityName, final Long resourceId, final Long subresourceId, final Long groupId, final Long clientId,
-            final Long loanId, final Long savingsId, final String transactionId, final String url, final Long productId) {
+            final Long loanId, final Long savingsId, final String transactionId, final String url, final Long productId,
+            final Long creditBureauId,final Long organisationCreditBureauId) {
         return new JsonCommand(null, jsonCommand, parsedCommand, fromApiJsonHelper, entityName, resourceId, subresourceId, groupId,
-                clientId, loanId, savingsId, transactionId, url, productId);
+                clientId, loanId, savingsId, transactionId, url, productId,creditBureauId,organisationCreditBureauId);
 
     }
 
     public static JsonCommand fromExistingCommand(final Long commandId, final String jsonCommand, final JsonElement parsedCommand,
             final FromJsonHelper fromApiJsonHelper, final String entityName, final Long resourceId, final Long subresourceId,
-            final String url, final Long productId) {
+            final String url, final Long productId,final Long creditBureauId,final Long organisationCreditBureauId) {
         return new JsonCommand(commandId, jsonCommand, parsedCommand, fromApiJsonHelper, entityName, resourceId, subresourceId, null, null,
-                null, null, null, url, productId);
+                null, null, null, url, productId,creditBureauId,organisationCreditBureauId);
     }
 
     public static JsonCommand fromExistingCommand(final Long commandId, final String jsonCommand, final JsonElement parsedCommand,
             final FromJsonHelper fromApiJsonHelper, final String entityName, final Long resourceId, final Long subresourceId,
             final Long groupId, final Long clientId, final Long loanId, final Long savingsId, final String transactionId, final String url,
-            final Long productId) {
+            final Long productId,Long creditBureauId,final Long organisationCreditBureauId) {
         return new JsonCommand(commandId, jsonCommand, parsedCommand, fromApiJsonHelper, entityName, resourceId, subresourceId, groupId,
-                clientId, loanId, savingsId, transactionId, url, productId);
+                clientId, loanId, savingsId, transactionId, url, productId,creditBureauId,organisationCreditBureauId);
 
     }
 
@@ -94,13 +97,13 @@ public final class JsonCommand {
         final String jsonCommand = command.fromApiJsonHelper.toJson(parsedCommand);
         return new JsonCommand(command.commandId, jsonCommand, parsedCommand, command.fromApiJsonHelper, command.entityName,
                 command.resourceId, command.subresourceId, command.groupId, command.clientId, command.loanId, command.savingsId,
-                command.transactionId, command.url, command.productId);
+                command.transactionId, command.url, command.productId,command.creditBureauId,command.organisationCreditBureauId);
     }
 
     public JsonCommand(final Long commandId, final String jsonCommand, final JsonElement parsedCommand,
             final FromJsonHelper fromApiJsonHelper, final String entityName, final Long resourceId, final Long subresourceId,
             final Long groupId, final Long clientId, final Long loanId, final Long savingsId, final String transactionId, final String url,
-            final Long productId) {
+            final Long productId,final Long creditBureauId, final Long organisationCreditBureauId) {
 
         this.commandId = commandId;
         this.jsonCommand = jsonCommand;
@@ -116,6 +119,16 @@ public final class JsonCommand {
         this.transactionId = transactionId;
         this.url = url;
         this.productId = productId;
+        this.creditBureauId=creditBureauId;
+        this.organisationCreditBureauId=organisationCreditBureauId;
+    }
+    
+    public Long getOrganisationCreditBureauId() {
+        return this.organisationCreditBureauId;
+    }
+    
+    public Long getCreditBureauId() {
+        return this.creditBureauId;
     }
 
     public String json() {

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/DataValidatorBuilder.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/DataValidatorBuilder.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/DataValidatorBuilder.java
index def8d88..1ee1361 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/DataValidatorBuilder.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/DataValidatorBuilder.java
@@ -145,7 +145,7 @@ public class DataValidatorBuilder {
      * param and if it has invalid value or value not passed then call this
      * method, this method is always used with input as false
      */
-    public DataValidatorBuilder trueOrFalseRequired(final boolean trueOfFalseFieldProvided) {
+    public DataValidatorBuilder trueOrFalseRequired1(final boolean trueOfFalseFieldProvided) {
         if (!trueOfFalseFieldProvided && !this.ignoreNullValue) {
             final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".")
                     .append(this.parameter).append(".must.be.true.or.false");
@@ -157,6 +157,27 @@ public class DataValidatorBuilder {
         }
         return this;
     }
+    
+    
+    public DataValidatorBuilder trueOrFalseRequired(final Object trueOfFalseField)
+    {
+    	
+    	if(trueOfFalseField!=null)
+    	{
+    		if((!trueOfFalseField.toString().equalsIgnoreCase("true")) && (!trueOfFalseField.toString().equalsIgnoreCase("false")) )
+    		{
+    			  final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".")
+    	                    .append(this.parameter).append(".must.be.true.or.false");
+    	            final StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(this.parameter).append(
+    	                    " must be set as true or false.");
+    	            final ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(),
+    	                    defaultEnglishMessage.toString(), this.parameter);
+    	            this.dataValidationErrors.add(error);	
+    		}
+    	}
+    	
+    	  return this;
+    }
 
     public DataValidatorBuilder notNull() {
         if (this.value == null && !this.ignoreNullValue) {

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauConfigurationAPI.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..2838ce3
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauConfigurationAPI.java
@@ -0,0 +1,239 @@
+/**
+ * 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 java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+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.CreditBureauConfigurationData;
+import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauData;
+import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauLoanProductMappingData;
+import org.apache.fineract.infrastructure.creditbureau.data.OrganisationCreditBureauData;
+import org.apache.fineract.infrastructure.creditbureau.service.CreditBureauLoanProductMappingReadPlatformService;
+import org.apache.fineract.infrastructure.creditbureau.service.CreditBureauReadConfigurationService;
+import org.apache.fineract.infrastructure.creditbureau.service.CreditBureauReadPlatformService;
+import org.apache.fineract.infrastructure.creditbureau.service.OrganisationCreditBureauReadPlatformService;
+import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+@Path("/CreditBureauConfiguration")
+@Component
+@Scope("singleton")
+public class CreditBureauConfigurationAPI {
+	private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
+			Arrays.asList("creditBureauId", "alias", "country", "creditBureauProductId", "startDate", "endDate", "isActive"));
+	private final String resourceNameForPermissions = "CreditBureau";
+	private final PlatformSecurityContext context;
+	private final CreditBureauReadPlatformService readPlatformService;
+	private final DefaultToApiJsonSerializer<CreditBureauData> toApiJsonSerializer;
+	private final CreditBureauLoanProductMappingReadPlatformService readPlatformServiceCreditBureauLoanProduct;
+	private final OrganisationCreditBureauReadPlatformService readPlatformServiceOrganisationCreditBureau;
+	private final DefaultToApiJsonSerializer<CreditBureauLoanProductMappingData> toApiJsonSerializerCreditBureauLoanProduct;
+	private final DefaultToApiJsonSerializer<OrganisationCreditBureauData> toApiJsonSerializerOrganisationCreditBureau;
+	private final DefaultToApiJsonSerializer<CreditBureauConfigurationData> toApiJsonSerializerReport;
+	private final ApiRequestParameterHelper apiRequestParameterHelper;
+	private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
+	private final CreditBureauReadConfigurationService creditBureauConfiguration;
+
+	@Autowired
+	public CreditBureauConfigurationAPI(final PlatformSecurityContext context,
+			final CreditBureauReadPlatformService readPlatformService,
+			final DefaultToApiJsonSerializer<CreditBureauData> toApiJsonSerializer,
+			final CreditBureauLoanProductMappingReadPlatformService readPlatformServiceCreditBureauLoanProduct,
+			final DefaultToApiJsonSerializer<CreditBureauLoanProductMappingData> toApiJsonSerializerCreditBureauLoanProduct,
+			final OrganisationCreditBureauReadPlatformService readPlatformServiceOrganisationCreditBureau,
+			final DefaultToApiJsonSerializer<OrganisationCreditBureauData> toApiJsonSerializerOrganisationCreditBureau,
+			final ApiRequestParameterHelper apiRequestParameterHelper,
+			final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
+			final DefaultToApiJsonSerializer<CreditBureauConfigurationData> toApiJsonSerializerReport,
+			final CreditBureauReadConfigurationService creditBureauConfiguration) {
+		this.context = context;
+		this.readPlatformService = readPlatformService;
+		this.apiRequestParameterHelper = apiRequestParameterHelper;
+		this.readPlatformServiceCreditBureauLoanProduct = readPlatformServiceCreditBureauLoanProduct;
+		this.toApiJsonSerializerCreditBureauLoanProduct = toApiJsonSerializerCreditBureauLoanProduct;
+		this.readPlatformServiceOrganisationCreditBureau = readPlatformServiceOrganisationCreditBureau;
+		this.toApiJsonSerializerOrganisationCreditBureau = toApiJsonSerializerOrganisationCreditBureau;
+		this.toApiJsonSerializer = toApiJsonSerializer;
+		this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
+		this.toApiJsonSerializerReport = toApiJsonSerializerReport;
+		this.creditBureauConfiguration = creditBureauConfiguration;
+
+	}
+
+	@GET
+	@Consumes({ MediaType.APPLICATION_JSON })
+	@Produces({ MediaType.APPLICATION_JSON })
+	public String getCreditBureau(@Context final UriInfo uriInfo) {
+		this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
+
+		final Collection<CreditBureauData> creditBureau = this.readPlatformService.retrieveCreditBureau();
+
+		final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
+				.process(uriInfo.getQueryParameters());
+		return this.toApiJsonSerializer.serialize(settings, creditBureau, this.RESPONSE_DATA_PARAMETERS);
+
+	}
+
+	@GET
+	@Path("/mappings")
+	@Consumes({ MediaType.APPLICATION_JSON })
+	@Produces({ MediaType.APPLICATION_JSON })
+	public String getCreditBureauLoanProductMapping(@Context final UriInfo uriInfo) {
+		this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
+
+		final Collection<CreditBureauLoanProductMappingData> creditBureauLoanProductMapping = this.readPlatformServiceCreditBureauLoanProduct
+				.readCreditBureauLoanProductMapping();
+
+		final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
+				.process(uriInfo.getQueryParameters());
+		return this.toApiJsonSerializerCreditBureauLoanProduct.serialize(settings, creditBureauLoanProductMapping, this.RESPONSE_DATA_PARAMETERS);
+
+	}
+
+	@GET
+	@Path("/organisationCreditBureau")
+	@Consumes({ MediaType.APPLICATION_JSON })
+	@Produces({ MediaType.APPLICATION_JSON })
+	public String getOrganisationCreditBureau(@Context final UriInfo uriInfo) {
+		this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
+
+		final Collection<OrganisationCreditBureauData> organisationCreditBureau = this.readPlatformServiceOrganisationCreditBureau
+				.retrieveOrgCreditBureau();
+
+		final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
+				.process(uriInfo.getQueryParameters());
+		return this.toApiJsonSerializerOrganisationCreditBureau.serialize(settings, organisationCreditBureau,
+				this.RESPONSE_DATA_PARAMETERS);
+
+	}
+
+	@GET
+	@Path("/config/{organisationCreditBureauId}")
+	@Consumes({ MediaType.APPLICATION_JSON })
+	@Produces({ MediaType.APPLICATION_JSON })
+	public String getConfiguration(@PathParam("organisationCreditBureauId") final Long organisationCreditBureauId, @Context final UriInfo uriInfo) {
+		// System.out.println("config triggered");
+
+		this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
+
+		final Collection<CreditBureauConfigurationData> configurationData = this.creditBureauConfiguration
+				.readConfigurationByOrganisationCreditBureauId(organisationCreditBureauId);
+
+		return this.toApiJsonSerializerReport.serialize(configurationData);
+	}
+	
+	
+	@GET
+	@Path("/loanProduct")
+	@Consumes({ MediaType.APPLICATION_JSON })
+	@Produces({ MediaType.APPLICATION_JSON })
+	public String fetchLoanProducts(@Context final UriInfo uriInfo) {
+		this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
+
+		final Collection<CreditBureauLoanProductMappingData> creditBureauLoanProductMapping = this.readPlatformServiceCreditBureauLoanProduct
+				.fetchLoanProducts();
+
+		final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
+				.process(uriInfo.getQueryParameters());
+		return this.toApiJsonSerializerCreditBureauLoanProduct.serialize(settings, creditBureauLoanProductMapping, this.RESPONSE_DATA_PARAMETERS);
+	}
+
+	@PUT
+	@Path("/organisationCreditBureau")
+	@Consumes({ MediaType.APPLICATION_JSON })
+	@Produces({ MediaType.APPLICATION_JSON })
+	public String updateCreditBureau(final String apiRequestBodyAsJson) {
+
+		final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCreditBureau()
+				.withJson(apiRequestBodyAsJson).build();
+
+		final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
+
+		return this.toApiJsonSerializer.serialize(result);
+	}
+
+	@PUT
+	@Path("/mappings")
+	@Consumes({ MediaType.APPLICATION_JSON })
+	@Produces({ MediaType.APPLICATION_JSON })
+	public String updateCreditBureauLoanProductMapping(final String apiRequestBodyAsJson) {
+
+		final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCreditBureauLoanProductMapping()
+				.withJson(apiRequestBodyAsJson).build();
+
+		final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
+
+		return this.toApiJsonSerializer.serialize(result);
+	}
+
+	@POST
+	@Path("/organisationCreditBureau/{organisationCreditBureauId}")
+	@Consumes({ MediaType.APPLICATION_JSON })
+	@Produces({ MediaType.APPLICATION_JSON })
+	public String addOrganisationCreditBureau(@PathParam("organisationCreditBureauId") final Long organisationCreditBureauId, final String apiRequestBodyAsJson) {
+
+		final CommandWrapper commandRequest = new CommandWrapperBuilder().addOrganisationCreditBureau(organisationCreditBureauId)
+				.withJson(apiRequestBodyAsJson).build();
+
+		final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
+
+		return this.toApiJsonSerializer.serialize(result);
+	}
+
+	@POST
+	@Path("/mappings/{CreditBureauId}")
+	@Consumes({ MediaType.APPLICATION_JSON })
+	@Produces({ MediaType.APPLICATION_JSON })
+	public String createCreditBureauLoanProductMapping(@PathParam("CreditBureauId") final Long CreditBureauId, final String apiRequestBodyAsJson) {
+
+		final CommandWrapper commandRequest = new CommandWrapperBuilder().createCreditBureauLoanProductMapping(CreditBureauId)
+				.withJson(apiRequestBodyAsJson).build();
+
+		final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
+
+		return this.toApiJsonSerializer.serialize(result);
+	}
+
+	
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauConfigurationData.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauConfigurationData.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauConfigurationData.java
new file mode 100644
index 0000000..ad47d1c
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauConfigurationData.java
@@ -0,0 +1,68 @@
+/**
+ * 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;
+
+public class CreditBureauConfigurationData {
+	private final long creditBureauConfigurationId;
+
+	private final String configurationKey;
+
+	private final String value;
+
+	private final long organizationCreditBureauId;
+
+	private final String description;
+
+	private CreditBureauConfigurationData(final long creditBureauConfigurationId, final String configurationKey,
+			final String value, final long organizationCreditBureauId, final String description) {
+		this.creditBureauConfigurationId = creditBureauConfigurationId;
+		this.configurationKey = configurationKey;
+		this.value = value;
+		this.organizationCreditBureauId = organizationCreditBureauId;
+		this.description = description;
+
+	}
+
+	public static CreditBureauConfigurationData instance(final long creditBureauConfigurationId, final String configurationKey,
+			final String value, final long organizationCreditBureauId, final String description) {
+		return new CreditBureauConfigurationData(creditBureauConfigurationId, configurationKey, value,
+				organizationCreditBureauId, description);
+	}
+
+	public long getCreditBureauConfigurationId() {
+		return this.creditBureauConfigurationId;
+	}
+
+	public String getConfigurationKey() {
+		return this.configurationKey;
+	}
+
+	public String getValue() {
+		return this.value;
+	}
+
+	public long getOrganizationCreditBureauId() {
+		return this.organizationCreditBureauId;
+	}
+
+	public String getDescription() {
+		return this.description;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauData.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauData.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauData.java
new file mode 100644
index 0000000..d1cf2ea
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauData.java
@@ -0,0 +1,77 @@
+/**
+ * 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;
+
+public class CreditBureauData {
+
+	private final long creditBureauId;
+
+	private final String creditBureauName;
+
+	private final String country;
+
+	private final String productName;
+
+	private final String creditBureauSummary;
+
+	private final long implementationKey;
+
+	private CreditBureauData(final long creditBureauId, final String creditBureauName, final String country,
+			final String productName, final String creditBureauSummary, final long implementationKey) {
+		this.creditBureauId = creditBureauId;
+		this.creditBureauName = creditBureauName;
+		this.country = country;
+		this.productName = productName;
+		this.creditBureauSummary = creditBureauSummary;
+		this.implementationKey = implementationKey;
+
+	}
+
+	public static CreditBureauData instance(final long creditBureauId, final String creditBureauName,
+			final String country, final String productName, final String creditBureauSummary, final long implementationKey) {
+
+		return new CreditBureauData(creditBureauId, creditBureauName, country, productName, creditBureauSummary,
+				implementationKey);
+	}
+
+	public String getCreditBureauSummary() {
+		return this.creditBureauSummary;
+	}
+
+	public long getCreditBureauId() {
+		return this.creditBureauId;
+	}
+
+	public String getCreditBureauName() {
+		return this.creditBureauName;
+	}
+
+	public String getCountry() {
+		return this.country;
+	}
+
+	public String getProductName() {
+		return this.productName;
+	}
+
+	public long getImplementationKey() {
+		return this.implementationKey;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauLoanProductMappingData.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauLoanProductMappingData.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauLoanProductMappingData.java
new file mode 100644
index 0000000..356e003
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauLoanProductMappingData.java
@@ -0,0 +1,112 @@
+/**
+ * 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;
+
+public class CreditBureauLoanProductMappingData {
+
+	private final long creditbureauLoanProductMappingId;
+
+	private final long organisationCreditBureauId;
+
+	private final String alias;
+
+	private final String creditbureauSummary;
+
+	private final String loanProductName;
+
+	private final long loanProductId;
+
+	private final boolean isCreditCheckMandatory;
+
+	private final boolean skipCrediCheckInFailure;
+
+	private final long stalePeriod;
+
+	private final boolean is_active;
+
+	private CreditBureauLoanProductMappingData(final long creditbureauLoanProductMappingId,
+			final long organisationCreditBureauId, final String alias, final String creditbureauSummary,
+			final String loanProductName, final long loanProductId, final boolean isCreditCheckMandatory,
+			final boolean skipCrediCheckInFailure, final long stalePeriod, final boolean is_active) {
+		this.creditbureauLoanProductMappingId = creditbureauLoanProductMappingId;
+		this.organisationCreditBureauId = organisationCreditBureauId;
+		this.alias = alias;
+		this.creditbureauSummary = creditbureauSummary;
+		this.loanProductName = loanProductName;
+		this.loanProductId = loanProductId;
+		this.isCreditCheckMandatory = isCreditCheckMandatory;
+		this.skipCrediCheckInFailure = skipCrediCheckInFailure;
+		this.stalePeriod = stalePeriod;
+		this.is_active = is_active;
+	}
+
+	public static CreditBureauLoanProductMappingData instance(final long creditbureauLoanProductMappingId,
+			final long organisationCreditBureauId, final String alias, final String creditbureauSummary,
+			final String loanProductName, final long loanProductId, final boolean isCreditCheckMandatory,
+			final boolean skipCrediCheckInFailure, final long stalePeriod, final boolean is_active) {
+		return new CreditBureauLoanProductMappingData(creditbureauLoanProductMappingId, organisationCreditBureauId, alias,
+				creditbureauSummary, loanProductName, loanProductId, isCreditCheckMandatory, skipCrediCheckInFailure,
+				stalePeriod, is_active);
+	}
+
+	public static CreditBureauLoanProductMappingData instance1(final String loanProductName, final long loanProductId) {
+		return new CreditBureauLoanProductMappingData(0, 0, "", "", loanProductName, loanProductId, false, false, 0, false);
+	}
+
+	public long getCreditbureauLoanProductMappingId() {
+		return this.creditbureauLoanProductMappingId;
+	}
+
+	public String getAlias() {
+		return this.alias;
+	}
+
+	public String getCreditbureauSummary() {
+		return this.creditbureauSummary;
+	}
+
+	public String getLoanProductName() {
+		return this.loanProductName;
+	}
+
+	public long getOrganisationCreditBureauId() {
+		return this.organisationCreditBureauId;
+	}
+
+	public long getLoanProductId() {
+		return this.loanProductId;
+	}
+
+	public boolean isCreditCheckMandatory() {
+		return this.isCreditCheckMandatory;
+	}
+
+	public boolean isSkipCrediCheckInFailure() {
+		return this.skipCrediCheckInFailure;
+	}
+
+	public long getStalePeriod() {
+		return this.stalePeriod;
+	}
+
+	public boolean isIs_active() {
+		return this.is_active;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauMasterData.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauMasterData.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauMasterData.java
new file mode 100644
index 0000000..bf73b81
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauMasterData.java
@@ -0,0 +1,52 @@
+/**
+ * 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;
+
+public class CreditBureauMasterData {
+
+	private final long creditBureauId;
+
+	private final String creditBureauName;
+
+	private final String country;
+
+	public static CreditBureauMasterData instance(final Long creditBureauId, final String creditBureauName, final String country) {
+		return new CreditBureauMasterData(creditBureauId, creditBureauName, country);
+	}
+
+	private CreditBureauMasterData(final Long creditBureauId, final String creditBureauName, final String country) {
+		this.creditBureauId = creditBureauId;
+		this.creditBureauName = creditBureauName;
+		this.country = country;
+
+	}
+
+	public String getCreditBureauName() {
+		return this.creditBureauName;
+	}
+
+	public String getCountry() {
+		return this.country;
+	}
+
+	public Long getCreditBureauId() {
+		return this.creditBureauId;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauProduct.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauProduct.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauProduct.java
new file mode 100644
index 0000000..d5f88fd
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/CreditBureauProduct.java
@@ -0,0 +1,53 @@
+/**
+ * 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;
+
+public class CreditBureauProduct {
+
+	private final long creditBureauProductId;
+
+	private final String creditBureauProductName;
+
+	private final long creditBureauMasterId;
+
+	private CreditBureauProduct(final long creditBureauProductId, final String creditBureauProductName,
+			final long creditBureauMasterId) {
+		this.creditBureauProductId = creditBureauProductId;
+		this.creditBureauProductName = creditBureauProductName;
+		this.creditBureauMasterId = creditBureauMasterId;
+	}
+
+	public static CreditBureauProduct instance(final long creditBureauProductId, final String creditBureauProductName,
+			final long creditBureauMasterId) {
+		return new CreditBureauProduct(creditBureauProductId, creditBureauProductName, creditBureauMasterId);
+	}
+
+	public long getCreditBureauProductId() {
+		return this.creditBureauProductId;
+	}
+
+	public String getCreditBureauProductName() {
+		return this.creditBureauProductName;
+	}
+
+	public long getCreditBureauMasterId() {
+		return this.creditBureauMasterId;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/OrganisationCreditBureauData.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/OrganisationCreditBureauData.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/OrganisationCreditBureauData.java
new file mode 100644
index 0000000..c08c2be
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/data/OrganisationCreditBureauData.java
@@ -0,0 +1,91 @@
+/**
+ * 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;
+
+public class OrganisationCreditBureauData {
+
+	private final long organisationCreditBureauId;
+
+	private final String alias;
+
+	private final long creditBureauId;
+
+	private final String creditBureauName;
+
+	private final String creditBureauProduct;
+
+	private final String creditBureauCountry;
+
+	private final String creditBureauSummary;
+
+	private final boolean is_active;
+
+	private OrganisationCreditBureauData(final long organisationCreditBureauId, final String alias,
+			final long creditBureauId, final String creditBureauName, final String creditBureauProduct,
+			final String creditBureauCountry, final String creditBureauSummary, final boolean is_active) {
+		this.organisationCreditBureauId = organisationCreditBureauId;
+		this.alias = alias;
+		this.creditBureauId = creditBureauId;
+		this.creditBureauName = creditBureauName;
+		this.creditBureauProduct = creditBureauProduct;
+		this.creditBureauCountry = creditBureauCountry;
+		this.creditBureauSummary = creditBureauSummary;
+		this.is_active = is_active;
+	}
+
+	public static OrganisationCreditBureauData instance(final long organisationCreditBureauId, final String alias,
+			final long creditBureauId, final String creditBureauName, final String creditBureauProduct,
+			final String creditBureauCountry, final String creditBureauSummary, final boolean is_active) {
+		return new OrganisationCreditBureauData(organisationCreditBureauId, alias, creditBureauId, creditBureauName,
+				creditBureauProduct, creditBureauCountry, creditBureauSummary, is_active);
+	}
+
+	public long getOrganisationCreditBureauId() {
+		return this.organisationCreditBureauId;
+	}
+
+	public String getCreditBureauName() {
+		return this.creditBureauName;
+	}
+
+	public String getCreditBureauProduct() {
+		return this.creditBureauProduct;
+	}
+
+	public String getCreditBureauCountry() {
+		return this.creditBureauCountry;
+	}
+
+	public String getCreditBureauSummary() {
+		return this.creditBureauSummary;
+	}
+
+	public String getAlias() {
+		return this.alias;
+	}
+
+	public long getCreditBureauId() {
+		return this.creditBureauId;
+	}
+
+	public boolean isActive() {
+		return this.is_active;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureau.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureau.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureau.java
new file mode 100644
index 0000000..ad3fab7
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureau.java
@@ -0,0 +1,112 @@
+/**
+ * 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 java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+
+@Entity
+@Table(name = "m_creditbureau")
+public class CreditBureau extends AbstractPersistableCustom<Long> {
+
+
+	private String name;
+
+	private String product;
+
+	private String country;
+
+	private String implementationKey;
+
+	@OneToMany(mappedBy = "organisation_creditbureau", cascade = CascadeType.ALL)
+	private List<CreditBureauLoanProductMapping> CreditBureauLoanProductMapping = new ArrayList<>();
+
+	public CreditBureau(String name, String product, String country, String implementationKey,
+			List<CreditBureauLoanProductMapping> CreditBureauLoanProductMapping) {
+		this.name = name;
+		this.product = product;
+		this.country = country;
+		this.implementationKey = implementationKey;
+		this.CreditBureauLoanProductMapping = CreditBureauLoanProductMapping;
+	}
+
+	public CreditBureau() {
+
+	}
+
+	public static CreditBureau fromJson(final JsonCommand command) {
+
+		final String tname = command.stringValueOfParameterNamed("name");
+		final String tproduct = command.stringValueOfParameterNamed("product");
+		final String tcountry = command.stringValueOfParameterNamed("country");
+		final String timplementationKey = command.stringValueOfParameterNamed("implementationKey");
+
+		return new CreditBureau(tname, tproduct, tcountry, timplementationKey, null);
+
+	}
+
+	public String getName() {
+		return this.name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getProduct() {
+		return this.product;
+	}
+
+	public void setProduct(String product) {
+		this.product = product;
+	}
+
+	public String getCountry() {
+		return this.country;
+	}
+
+	public void setCountry(String country) {
+		this.country = country;
+	}
+
+	public String getImplementationKey() {
+		return this.implementationKey;
+	}
+
+	public void setImplementationKey(String implementationKey) {
+		this.implementationKey = implementationKey;
+	}
+
+	public List<CreditBureauLoanProductMapping> getCreditBureauLpMapping() {
+		return this.CreditBureauLoanProductMapping;
+	}
+
+	public void setCreditBureauLpMapping(List<CreditBureauLoanProductMapping> CreditBureauLoanProductMapping) {
+		this.CreditBureauLoanProductMapping = CreditBureauLoanProductMapping;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureauConfiguration.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureauConfiguration.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureauConfiguration.java
new file mode 100644
index 0000000..bdd7f6f
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureauConfiguration.java
@@ -0,0 +1,101 @@
+/**
+ * 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.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+
+@Entity
+@Table(name = "m_creditbureau_configuration")
+public class CreditBureauConfiguration extends AbstractPersistableCustom<Long> {
+	@Column(name = "configkey")
+	private String configurationKey;
+
+	@Column(name = "value")
+	private String value;
+
+	@Column(name = "description")
+	private String description;
+
+	@ManyToOne
+	@JoinColumn(name = "organisation_creditbureau_id")
+	private OrganisationCreditBureau organisationCreditbureau;
+
+	public CreditBureauConfiguration() {
+
+	}
+
+	public CreditBureauConfiguration(String configkey, String value, String description,
+			OrganisationCreditBureau organisationCreditbureau) {
+		this.configurationKey = configkey;
+		this.value = value;
+		this.description = description;
+		this.organisationCreditbureau = organisationCreditbureau;
+
+	}
+
+	public CreditBureauConfiguration fromJson(JsonCommand command, OrganisationCreditBureau organisation_creditbureau) {
+		final String configkey = command.stringValueOfParameterNamed("configkey");
+		final String value = command.stringValueOfParameterNamed("value");
+		final String description = command.stringValueOfParameterNamed("description");
+
+		return new CreditBureauConfiguration(configkey, value, description, organisation_creditbureau);
+
+	}
+
+	public String getConfigkey() {
+		return this.configurationKey;
+	}
+
+	public void setConfigkey(String configkey) {
+		this.configurationKey = configkey;
+	}
+
+	public String getValue() {
+		return this.value;
+	}
+
+	public void setValue(String value) {
+		this.value = value;
+	}
+
+	public String getDescription() {
+		return this.description;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	public OrganisationCreditBureau getOrganisation_creditbureau() {
+		return this.organisationCreditbureau;
+	}
+
+	public void setOrganisation_creditbureau(OrganisationCreditBureau organisation_creditbureau) {
+		this.organisationCreditbureau = organisation_creditbureau;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureauLoanProductMapping.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureauLoanProductMapping.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureauLoanProductMapping.java
new file mode 100644
index 0000000..8c3cdb4
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureauLoanProductMapping.java
@@ -0,0 +1,150 @@
+/**
+ * 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.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+
+@Entity
+@Table(name = "m_creditbureau_loanproduct_mapping")
+public class CreditBureauLoanProductMapping extends AbstractPersistableCustom<Long> {
+	
+	@Column(name = "is_CreditCheck_Mandatory")
+	private boolean isCreditCheckMandatory;
+	
+	@Column(name = "skip_CreditCheck_in_Failure")
+	private boolean skipCreditCheckInFailure;
+	
+	@Column(name = "stale_Period")
+	private int stalePeriod;
+
+	private boolean is_active;
+
+	@ManyToOne
+	private OrganisationCreditBureau organisation_creditbureau;
+
+	@OneToOne
+	@JoinColumn(name="loan_product_id")
+	private LoanProduct loanProduct;
+	
+	public CreditBureauLoanProductMapping() {
+
+	}
+
+	public CreditBureauLoanProductMapping(boolean isCreditCheckMandatory, boolean skipCreditCheckInFailure, int stalePeriod,
+			boolean is_active, OrganisationCreditBureau organisationCreditbureau, LoanProduct loanProduct) {
+		this.isCreditCheckMandatory = isCreditCheckMandatory;
+		this.skipCreditCheckInFailure = skipCreditCheckInFailure;
+		this.stalePeriod = stalePeriod;
+		this.is_active = is_active;
+		this.organisation_creditbureau = organisationCreditbureau;
+		this.loanProduct = loanProduct;
+	}
+
+	public static CreditBureauLoanProductMapping fromJson(final JsonCommand command,
+			OrganisationCreditBureau organisation_creditbureau, LoanProduct loanProduct) {
+		 Boolean isCreditCheckMandatory=false;
+		 Boolean skipCreditCheckInFailure=false;
+		 Integer stalePeriod=-1;
+		 Boolean is_active=false;
+		 if((Boolean)command.booleanPrimitiveValueOfParameterNamed("isCreditcheckMandatory")!=null)
+		 {
+			 isCreditCheckMandatory = command.booleanPrimitiveValueOfParameterNamed("isCreditcheckMandatory");	 
+		 }
+		
+		 if((Boolean)command.booleanPrimitiveValueOfParameterNamed("skipCreditcheckInFailure")!=null)
+		 {
+			 skipCreditCheckInFailure = command.booleanPrimitiveValueOfParameterNamed("skipCreditcheckInFailure");	 
+		 }
+		 
+		 if((Integer)command.integerValueOfParameterNamed("stalePeriod")!=null)
+		 {
+			 stalePeriod = command.integerValueOfParameterNamed("stalePeriod");	 
+		 }
+		
+		 if((Boolean) command.booleanPrimitiveValueOfParameterNamed("is_active"))
+		 {
+			 is_active = command.booleanPrimitiveValueOfParameterNamed("is_active");	 
+		 }
+	
+
+		return new CreditBureauLoanProductMapping(isCreditCheckMandatory, skipCreditCheckInFailure, stalePeriod, is_active,
+				organisation_creditbureau, loanProduct);
+
+	}
+
+	public boolean isCreditCheckMandatory() {
+		return this.isCreditCheckMandatory;
+	}
+
+	public void setCreditCheckMandatory(boolean isCreditCheckMandatory) {
+		this.isCreditCheckMandatory = isCreditCheckMandatory;
+	}
+
+	public boolean isSkipCreditCheckInFailure() {
+		return this.skipCreditCheckInFailure;
+	}
+
+	public void setSkipCreditCheckInFailure(boolean skipCreditCheckInFailure) {
+		this.skipCreditCheckInFailure = skipCreditCheckInFailure;
+	}
+
+	public int getStalePeriod() {
+		return this.stalePeriod;
+	}
+
+	public void setStalePeriod(int stalePeriod) {
+		this.stalePeriod = stalePeriod;
+	}
+
+	public boolean isIs_active() {
+		return this.is_active;
+	}
+
+	public void setIs_active(boolean is_active) {
+		this.is_active = is_active;
+	}
+
+	public OrganisationCreditBureau getOrganisationCreditbureau() {
+		return this.organisation_creditbureau;
+	}
+
+	public void setOrganisationCreditbureau(OrganisationCreditBureau organisationCreditbureau) {
+		this.organisation_creditbureau = organisationCreditbureau;
+	}
+
+	public LoanProduct getLoanProduct() {
+		return this.loanProduct;
+	}
+
+	public void setLoanProduct(LoanProduct loanProduct) {
+		this.loanProduct = loanProduct;
+	}
+
+	
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureauLoanProductMappingRepository.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureauLoanProductMappingRepository.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureauLoanProductMappingRepository.java
new file mode 100644
index 0000000..3280b83
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureauLoanProductMappingRepository.java
@@ -0,0 +1,27 @@
+/**
+ * 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 org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+public interface CreditBureauLoanProductMappingRepository
+		extends JpaRepository<CreditBureauLoanProductMapping, Long>, JpaSpecificationExecutor<CreditBureauLoanProductMapping> {
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureauRepository.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureauRepository.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureauRepository.java
new file mode 100644
index 0000000..03dee5b
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureauRepository.java
@@ -0,0 +1,30 @@
+/**
+ * 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 org.apache.fineract.infrastructure.jobs.domain.ScheduledJobDetail;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+public interface CreditBureauRepository
+		extends JpaRepository<CreditBureau, Long>, JpaSpecificationExecutor<CreditBureau> {
+
+	// CreditBureau findOne(long id);
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/OrganisationCreditBureau.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/OrganisationCreditBureau.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/OrganisationCreditBureau.java
new file mode 100644
index 0000000..8a88ed5
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/OrganisationCreditBureau.java
@@ -0,0 +1,100 @@
+/**
+ * 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 java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+
+@Entity
+@Table(name = "m_organisation_creditbureau")
+public class OrganisationCreditBureau extends AbstractPersistableCustom<Long> {
+
+	private String alias;
+
+	@OneToOne
+	private CreditBureau creditbureau;
+
+	private boolean is_active;
+
+	@OneToMany(mappedBy = "organisation_creditbureau", cascade = CascadeType.ALL)
+	private List<CreditBureauLoanProductMapping> creditBureauLoanProductMapping = new ArrayList<>();
+
+	public OrganisationCreditBureau(String alias, CreditBureau creditBureau, boolean is_active,
+			List<CreditBureauLoanProductMapping> creditBureauLoanProductMapping) {
+		this.alias = alias;
+		this.creditbureau = creditBureau;
+		this.is_active = is_active;
+		this.creditBureauLoanProductMapping = creditBureauLoanProductMapping;
+	}
+
+	public OrganisationCreditBureau() {
+
+	}
+
+	public static OrganisationCreditBureau fromJson(final JsonCommand command, CreditBureau creditBureau) {
+		final String alias = command.stringValueOfParameterNamed("alias");
+		final boolean is_active = command.booleanPrimitiveValueOfParameterNamed("is_active");
+
+		return new OrganisationCreditBureau(alias, creditBureau, is_active, null);
+	}
+
+	public String getAlias() {
+		return this.alias;
+	}
+
+	public void setAlias(String alias) {
+		this.alias = alias;
+	}
+
+	public CreditBureau getCreditBureau() {
+		return this.creditbureau;
+	}
+
+	public void setCreditBureau(CreditBureau creditBureau) {
+		this.creditbureau = creditBureau;
+	}
+
+	public boolean isActive() {
+		return this.is_active;
+	}
+
+	public void setIsActive(boolean is_active) {
+		this.is_active = is_active;
+	}
+
+	public List<CreditBureauLoanProductMapping> getCreditBureauLoanProductMapping() {
+		return this.creditBureauLoanProductMapping;
+	}
+
+	public void setCreditBureauLoanProductMapping(List<CreditBureauLoanProductMapping> creditBureauLoanProductMapping) {
+		this.creditBureauLoanProductMapping = creditBureauLoanProductMapping;
+	}
+
+	
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/OrganisationCreditBureauRepository.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/OrganisationCreditBureauRepository.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/OrganisationCreditBureauRepository.java
new file mode 100644
index 0000000..b0b05c9
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/OrganisationCreditBureauRepository.java
@@ -0,0 +1,27 @@
+/**
+ * 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 org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+public interface OrganisationCreditBureauRepository
+		extends JpaRepository<OrganisationCreditBureau, Long>, JpaSpecificationExecutor<OrganisationCreditBureau> {
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/handler/AddOrganisationCreditBureauCommandHandler.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/handler/AddOrganisationCreditBureauCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/handler/AddOrganisationCreditBureauCommandHandler.java
new file mode 100644
index 0000000..f9b0851
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/handler/AddOrganisationCreditBureauCommandHandler.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.infrastructure.creditbureau.handler;
+
+import org.apache.fineract.commands.annotation.CommandType;
+import org.apache.fineract.commands.handler.NewCommandSourceHandler;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.infrastructure.creditbureau.service.OrganisationCreditBureauWritePlatflormService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+@CommandType(entity = "ORGANISATIONCREDITBUREAU", action = "CREATE")
+public class AddOrganisationCreditBureauCommandHandler implements NewCommandSourceHandler {
+
+	private final OrganisationCreditBureauWritePlatflormService writePlatformService;
+
+	@Autowired
+	public AddOrganisationCreditBureauCommandHandler(final OrganisationCreditBureauWritePlatflormService writePlatformService) {
+		this.writePlatformService = writePlatformService;
+	}
+
+	@Override
+	public CommandProcessingResult processCommand(JsonCommand command) {
+
+		return this.writePlatformService.addOrganisationCreditBureau(command.getOrganisationCreditBureauId(), command);
+	}
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/handler/CreateCreditBureauLoanProductMappingCommandHandler.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..2b68b3e
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/handler/CreateCreditBureauLoanProductMappingCommandHandler.java
@@ -0,0 +1,46 @@
+/**
+ * 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.handler;
+
+import org.apache.fineract.commands.annotation.CommandType;
+import org.apache.fineract.commands.handler.NewCommandSourceHandler;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.infrastructure.creditbureau.service.CreditBureauLoanProductMappingWritePlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+@CommandType(entity = "CREDITBUREAU_LOANPRODUCT_MAPPING", action = "CREATE")
+public class CreateCreditBureauLoanProductMappingCommandHandler implements NewCommandSourceHandler {
+
+	private final CreditBureauLoanProductMappingWritePlatformService writePlatformService;
+
+	@Autowired
+	public CreateCreditBureauLoanProductMappingCommandHandler(final CreditBureauLoanProductMappingWritePlatformService writePlatformService) {
+		this.writePlatformService = writePlatformService;
+	}
+
+	@Override
+	public CommandProcessingResult processCommand(JsonCommand command) {
+
+		return this.writePlatformService.addCreditBureauLoanProductMapping(command.getCreditBureauId(), command);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/fineract/blob/34de03e0/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/handler/UpdateCreditBureauCommandHandler.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/handler/UpdateCreditBureauCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/handler/UpdateCreditBureauCommandHandler.java
new file mode 100644
index 0000000..0af5560
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/handler/UpdateCreditBureauCommandHandler.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.handler;
+
+import org.apache.fineract.commands.annotation.CommandType;
+import org.apache.fineract.commands.handler.NewCommandSourceHandler;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.infrastructure.creditbureau.service.OrganisationCreditBureauWritePlatflormService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@CommandType(entity = "ORGANISATIONCREDITBUREAU", action = "UPDATE")
+public class UpdateCreditBureauCommandHandler implements NewCommandSourceHandler {
+
+	private final OrganisationCreditBureauWritePlatflormService writePlatformService;
+
+	@Autowired
+	public UpdateCreditBureauCommandHandler(final OrganisationCreditBureauWritePlatflormService writePlatformService) {
+		this.writePlatformService = writePlatformService;
+	}
+
+	@Transactional
+	@Override
+	public CommandProcessingResult processCommand(final JsonCommand command) {
+
+		return this.writePlatformService.updateCreditBureau(command);
+	}
+
+}


[3/3] fineract git commit: Merge branch 'PR356' into develop

Posted by na...@apache.org.
Merge branch 'PR356' into develop


Project: http://git-wip-us.apache.org/repos/asf/fineract/repo
Commit: http://git-wip-us.apache.org/repos/asf/fineract/commit/06c959eb
Tree: http://git-wip-us.apache.org/repos/asf/fineract/tree/06c959eb
Diff: http://git-wip-us.apache.org/repos/asf/fineract/diff/06c959eb

Branch: refs/heads/develop
Commit: 06c959ebb616bfc2ca577779fc0fc3dd98e7230e
Parents: 5473e37 34de03e
Author: Nazeer Hussain Shaik <na...@confluxtechnologies.com>
Authored: Fri Jun 9 15:27:39 2017 +0530
Committer: Nazeer Hussain Shaik <na...@confluxtechnologies.com>
Committed: Fri Jun 9 15:27:39 2017 +0530

----------------------------------------------------------------------
 .../fineract/commands/domain/CommandSource.java |  23 ++
 .../commands/domain/CommandWrapper.java         |  27 ++-
 .../commands/service/CommandWrapperBuilder.java |  38 ++-
 ...ioCommandSourceWritePlatformServiceImpl.java |   7 +-
 .../infrastructure/core/api/JsonCommand.java    |  29 ++-
 .../core/data/DataValidatorBuilder.java         |  23 +-
 .../api/CreditBureauConfigurationAPI.java       | 239 +++++++++++++++++++
 .../data/CreditBureauConfigurationData.java     |  68 ++++++
 .../creditbureau/data/CreditBureauData.java     |  77 ++++++
 .../CreditBureauLoanProductMappingData.java     | 112 +++++++++
 .../data/CreditBureauMasterData.java            |  52 ++++
 .../creditbureau/data/CreditBureauProduct.java  |  53 ++++
 .../data/OrganisationCreditBureauData.java      |  91 +++++++
 .../creditbureau/domain/CreditBureau.java       | 112 +++++++++
 .../domain/CreditBureauConfiguration.java       | 101 ++++++++
 .../domain/CreditBureauLoanProductMapping.java  | 150 ++++++++++++
 ...reditBureauLoanProductMappingRepository.java |  27 +++
 .../domain/CreditBureauRepository.java          |  30 +++
 .../domain/OrganisationCreditBureau.java        | 100 ++++++++
 .../OrganisationCreditBureauRepository.java     |  27 +++
 ...dOrganisationCreditBureauCommandHandler.java |  45 ++++
 ...tBureauLoanProductMappingCommandHandler.java |  46 ++++
 .../UpdateCreditBureauCommandHandler.java       |  48 ++++
 ...tBureauLoanProductMappingCommandHandler.java |  49 ++++
 ...ditBureauCommandFromApiJsonDeserializer.java |  90 +++++++
 ...anProductCommandFromApiJsonDeserializer.java | 137 +++++++++++
 ...auLoanProductMappingReadPlatformService.java |  33 +++
 ...anProductMappingReadPlatformServiceImpl.java | 122 ++++++++++
 ...uLoanProductMappingWritePlatformService.java |  30 +++
 ...nProductMappingWritePlatformServiceImpl.java |  96 ++++++++
 .../CreditBureauMasterReadPlatformService.java  |  31 +++
 .../CreditBureauReadConfigurationService.java   |  33 +++
 ...reditBureauReadConfigurationServiceImpl.java | 102 ++++++++
 .../CreditBureauReadPlatformService.java        |  29 +++
 .../CreditBureauReadPlatformServiceImpl.java    |  77 ++++++
 ...nisationCreditBureauReadPlatformService.java |  29 +++
 ...tionCreditBureauReadPlatformServiceImpl.java |  93 ++++++++
 ...sationCreditBureauWritePlatflormService.java |  29 +++
 ...onCreditBureauWritePlatflormServiceImpl.java |  94 ++++++++
 .../service/LoanReadPlatformService.java        |   2 +
 .../service/LoanReadPlatformServiceImpl.java    |  18 ++
 ...anWritePlatformServiceJpaRepositoryImpl.java |   2 +-
 .../ShareAccountCommandsServiceImpl.java        |   2 +-
 .../ShareProductCommandsServiceImpl.java        |   2 +-
 .../resources/META-INF/spring/appContext.xml    |   2 +-
 .../V327__creditbureau_configuration.sql        |  89 +++++++
 .../provider/CommandHandlerProviderTest.java    |   2 +-
 47 files changed, 2696 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/fineract/blob/06c959eb/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/JsonCommand.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/fineract/blob/06c959eb/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/fineract/blob/06c959eb/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
----------------------------------------------------------------------