fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nazeer1100...@apache.org
Subject [2/3] fineract git commit: formatted creditbureau configuration
Date Fri, 09 Jun 2017 10:27:36 GMT
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 <nikhilpawar@yahoo.in>
Authored: Mon Mar 13 04:45:50 2017 -0500
Committer: nikpawar89 <nikhilpawar@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);
+	}
+
+}


Mime
View raw message