fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nazeer1100...@apache.org
Subject [1/2] fineract git commit: FINERACT-482 : allow blocking credits when debits are blocked and vice-versa
Date Mon, 24 Jul 2017 07:19:19 GMT
Repository: fineract
Updated Branches:
  refs/heads/develop c3a602ced -> 1b4147409


FINERACT-482 : allow blocking credits when debits are blocked and vice-versa


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

Branch: refs/heads/develop
Commit: fa5cae625ba61e1aeffb0554b070a1fd6e22e3ec
Parents: 0373ce4
Author: ShruthiRajaram <shruthi@confluxtechnologies.com>
Authored: Thu Jul 20 18:49:05 2017 +0530
Committer: ShruthiRajaram <shruthi@confluxtechnologies.com>
Committed: Thu Jul 20 18:49:35 2017 +0530

----------------------------------------------------------------------
 .../savings/domain/SavingsAccount.java          | 49 +++++++++++++-------
 1 file changed, 32 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/fineract/blob/fa5cae62/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java
index 0acd096..d7a6298 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java
@@ -2896,14 +2896,17 @@ public class SavingsAccount extends AbstractPersistableCustom<Long>
{
             baseDataValidator.reset().parameter(SavingsApiConstants.statusParamName)
                     .failWithCodeNoParameterAddedToErrorCode(SavingsApiConstants.ERROR_MSG_SAVINGS_ACCOUNT_NOT_ACTIVE);
         }
-        if (SavingsAccountSubStatusEnum.BLOCK.hasStateOf(SavingsAccountSubStatusEnum.fromInt(currentSubstatus))
-                || SavingsAccountSubStatusEnum.BLOCK_DEBIT.hasStateOf(SavingsAccountSubStatusEnum.fromInt(currentSubstatus)))
{
+        if (SavingsAccountSubStatusEnum.BLOCK.hasStateOf(SavingsAccountSubStatusEnum.fromInt(currentSubstatus)))
{
 
             baseDataValidator.reset().parameter(SavingsApiConstants.subStatusParamName).value(SavingsAccountSubStatusEnum.fromInt(currentSubstatus))
                     .failWithCodeNoParameterAddedToErrorCode("currently.set");
         }
         if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors);
}
-        this.sub_status = SavingsAccountSubStatusEnum.BLOCK_CREDIT.getValue();
+		if (SavingsAccountSubStatusEnum.BLOCK_DEBIT.hasStateOf(SavingsAccountSubStatusEnum.fromInt(currentSubstatus)))
{
+			this.sub_status = SavingsAccountSubStatusEnum.BLOCK.getValue();
+		} else {
+			this.sub_status = SavingsAccountSubStatusEnum.BLOCK_CREDIT.getValue();
+		}
         actualChanges.put(SavingsApiConstants.subStatusParamName, SavingsEnumerations.subStatus(this.sub_status));
 
         return actualChanges;
@@ -2923,12 +2926,17 @@ public class SavingsAccount extends AbstractPersistableCustom<Long>
{
         }
 
         final SavingsAccountSubStatusEnum currentSubStatus = SavingsAccountSubStatusEnum.fromInt(this.sub_status);
-        if (!SavingsAccountSubStatusEnum.BLOCK_CREDIT.hasStateOf(currentSubStatus)) {
-            baseDataValidator.reset().parameter(SavingsApiConstants.statusParamName)
-                    .failWithCodeNoParameterAddedToErrorCode("credits.are.not.blocked");
-        }
+		if (!(SavingsAccountSubStatusEnum.BLOCK_CREDIT.hasStateOf(currentSubStatus)
+				|| SavingsAccountSubStatusEnum.BLOCK.hasStateOf(currentSubStatus))) {
+			baseDataValidator.reset().parameter(SavingsApiConstants.statusParamName)
+					.failWithCodeNoParameterAddedToErrorCode("credits.are.not.blocked");
+		}
         if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors);
}
-        this.sub_status = SavingsAccountSubStatusEnum.NONE.getValue();
+		if (SavingsAccountSubStatusEnum.BLOCK.hasStateOf(currentSubStatus)) {
+			this.sub_status = SavingsAccountSubStatusEnum.BLOCK_DEBIT.getValue();
+		} else {
+			this.sub_status = SavingsAccountSubStatusEnum.NONE.getValue();
+		}
         actualChanges.put(SavingsApiConstants.subStatusParamName, SavingsEnumerations.subStatus(this.sub_status));
         return actualChanges;
     }
@@ -2947,15 +2955,17 @@ public class SavingsAccount extends AbstractPersistableCustom<Long>
{
                     .failWithCodeNoParameterAddedToErrorCode(SavingsApiConstants.ERROR_MSG_SAVINGS_ACCOUNT_NOT_ACTIVE);
 
         }
-        if (SavingsAccountSubStatusEnum.BLOCK.hasStateOf(SavingsAccountSubStatusEnum.fromInt(currentSubstatus))
-                || SavingsAccountSubStatusEnum.BLOCK_CREDIT.hasStateOf(SavingsAccountSubStatusEnum.fromInt(currentSubstatus)))
{
+        if (SavingsAccountSubStatusEnum.BLOCK.hasStateOf(SavingsAccountSubStatusEnum.fromInt(currentSubstatus)))
{
 
             baseDataValidator.reset().parameter(SavingsApiConstants.subStatusParamName).value(SavingsAccountSubStatusEnum.fromInt(currentSubstatus))
                     .failWithCodeNoParameterAddedToErrorCode("currently.set");
         }
         if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors);
}
-
-        this.sub_status = SavingsAccountSubStatusEnum.BLOCK_DEBIT.getValue();
+		if (SavingsAccountSubStatusEnum.BLOCK_CREDIT.hasStateOf(SavingsAccountSubStatusEnum.fromInt(currentSubstatus)))
{
+			this.sub_status = SavingsAccountSubStatusEnum.BLOCK.getValue();
+		} else {
+			this.sub_status = SavingsAccountSubStatusEnum.BLOCK_DEBIT.getValue();
+		}
         actualChanges.put(SavingsApiConstants.subStatusParamName, SavingsEnumerations.subStatus(this.sub_status));
 
         return actualChanges;
@@ -2978,12 +2988,17 @@ public class SavingsAccount extends AbstractPersistableCustom<Long>
{
         }
 
         final SavingsAccountSubStatusEnum currentSubStatus = SavingsAccountSubStatusEnum.fromInt(this.sub_status);
-        if (!SavingsAccountSubStatusEnum.BLOCK_DEBIT.hasStateOf(currentSubStatus)) {
-            baseDataValidator.reset().parameter(SavingsApiConstants.subStatusParamName)
-                    .failWithCodeNoParameterAddedToErrorCode("debits.are.not.blocked");
-        }
+		if (!(SavingsAccountSubStatusEnum.BLOCK_DEBIT.hasStateOf(currentSubStatus)
+				|| SavingsAccountSubStatusEnum.BLOCK.hasStateOf(currentSubStatus))) {
+			baseDataValidator.reset().parameter(SavingsApiConstants.subStatusParamName)
+					.failWithCodeNoParameterAddedToErrorCode("debits.are.not.blocked");
+		}
         if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors);
}
-        this.sub_status = SavingsAccountSubStatusEnum.NONE.getValue();
+		if (SavingsAccountSubStatusEnum.BLOCK.hasStateOf(currentSubStatus)) {
+			this.sub_status = SavingsAccountSubStatusEnum.BLOCK_CREDIT.getValue();
+		} else {
+			this.sub_status = SavingsAccountSubStatusEnum.NONE.getValue();
+		}
         actualChanges.put(SavingsApiConstants.subStatusParamName, SavingsEnumerations.subStatus(this.sub_status));
         return actualChanges;
     }


Mime
View raw message