FINERACT-482 : allow blocking credits when debits are blocked and vice-versa
This commit is contained in:
+32
-17
@@ -2896,14 +2896,17 @@ public class SavingsAccount extends AbstractPersistableCustom<Long> {
|
|||||||
baseDataValidator.reset().parameter(SavingsApiConstants.statusParamName)
|
baseDataValidator.reset().parameter(SavingsApiConstants.statusParamName)
|
||||||
.failWithCodeNoParameterAddedToErrorCode(SavingsApiConstants.ERROR_MSG_SAVINGS_ACCOUNT_NOT_ACTIVE);
|
.failWithCodeNoParameterAddedToErrorCode(SavingsApiConstants.ERROR_MSG_SAVINGS_ACCOUNT_NOT_ACTIVE);
|
||||||
}
|
}
|
||||||
if (SavingsAccountSubStatusEnum.BLOCK.hasStateOf(SavingsAccountSubStatusEnum.fromInt(currentSubstatus))
|
if (SavingsAccountSubStatusEnum.BLOCK.hasStateOf(SavingsAccountSubStatusEnum.fromInt(currentSubstatus))) {
|
||||||
|| SavingsAccountSubStatusEnum.BLOCK_DEBIT.hasStateOf(SavingsAccountSubStatusEnum.fromInt(currentSubstatus))) {
|
|
||||||
|
|
||||||
baseDataValidator.reset().parameter(SavingsApiConstants.subStatusParamName).value(SavingsAccountSubStatusEnum.fromInt(currentSubstatus))
|
baseDataValidator.reset().parameter(SavingsApiConstants.subStatusParamName).value(SavingsAccountSubStatusEnum.fromInt(currentSubstatus))
|
||||||
.failWithCodeNoParameterAddedToErrorCode("currently.set");
|
.failWithCodeNoParameterAddedToErrorCode("currently.set");
|
||||||
}
|
}
|
||||||
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
|
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));
|
actualChanges.put(SavingsApiConstants.subStatusParamName, SavingsEnumerations.subStatus(this.sub_status));
|
||||||
|
|
||||||
return actualChanges;
|
return actualChanges;
|
||||||
@@ -2923,12 +2926,17 @@ public class SavingsAccount extends AbstractPersistableCustom<Long> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final SavingsAccountSubStatusEnum currentSubStatus = SavingsAccountSubStatusEnum.fromInt(this.sub_status);
|
final SavingsAccountSubStatusEnum currentSubStatus = SavingsAccountSubStatusEnum.fromInt(this.sub_status);
|
||||||
if (!SavingsAccountSubStatusEnum.BLOCK_CREDIT.hasStateOf(currentSubStatus)) {
|
if (!(SavingsAccountSubStatusEnum.BLOCK_CREDIT.hasStateOf(currentSubStatus)
|
||||||
baseDataValidator.reset().parameter(SavingsApiConstants.statusParamName)
|
|| SavingsAccountSubStatusEnum.BLOCK.hasStateOf(currentSubStatus))) {
|
||||||
.failWithCodeNoParameterAddedToErrorCode("credits.are.not.blocked");
|
baseDataValidator.reset().parameter(SavingsApiConstants.statusParamName)
|
||||||
}
|
.failWithCodeNoParameterAddedToErrorCode("credits.are.not.blocked");
|
||||||
|
}
|
||||||
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
|
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));
|
actualChanges.put(SavingsApiConstants.subStatusParamName, SavingsEnumerations.subStatus(this.sub_status));
|
||||||
return actualChanges;
|
return actualChanges;
|
||||||
}
|
}
|
||||||
@@ -2947,15 +2955,17 @@ public class SavingsAccount extends AbstractPersistableCustom<Long> {
|
|||||||
.failWithCodeNoParameterAddedToErrorCode(SavingsApiConstants.ERROR_MSG_SAVINGS_ACCOUNT_NOT_ACTIVE);
|
.failWithCodeNoParameterAddedToErrorCode(SavingsApiConstants.ERROR_MSG_SAVINGS_ACCOUNT_NOT_ACTIVE);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (SavingsAccountSubStatusEnum.BLOCK.hasStateOf(SavingsAccountSubStatusEnum.fromInt(currentSubstatus))
|
if (SavingsAccountSubStatusEnum.BLOCK.hasStateOf(SavingsAccountSubStatusEnum.fromInt(currentSubstatus))) {
|
||||||
|| SavingsAccountSubStatusEnum.BLOCK_CREDIT.hasStateOf(SavingsAccountSubStatusEnum.fromInt(currentSubstatus))) {
|
|
||||||
|
|
||||||
baseDataValidator.reset().parameter(SavingsApiConstants.subStatusParamName).value(SavingsAccountSubStatusEnum.fromInt(currentSubstatus))
|
baseDataValidator.reset().parameter(SavingsApiConstants.subStatusParamName).value(SavingsAccountSubStatusEnum.fromInt(currentSubstatus))
|
||||||
.failWithCodeNoParameterAddedToErrorCode("currently.set");
|
.failWithCodeNoParameterAddedToErrorCode("currently.set");
|
||||||
}
|
}
|
||||||
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
|
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
|
||||||
|
if (SavingsAccountSubStatusEnum.BLOCK_CREDIT.hasStateOf(SavingsAccountSubStatusEnum.fromInt(currentSubstatus))) {
|
||||||
this.sub_status = SavingsAccountSubStatusEnum.BLOCK_DEBIT.getValue();
|
this.sub_status = SavingsAccountSubStatusEnum.BLOCK.getValue();
|
||||||
|
} else {
|
||||||
|
this.sub_status = SavingsAccountSubStatusEnum.BLOCK_DEBIT.getValue();
|
||||||
|
}
|
||||||
actualChanges.put(SavingsApiConstants.subStatusParamName, SavingsEnumerations.subStatus(this.sub_status));
|
actualChanges.put(SavingsApiConstants.subStatusParamName, SavingsEnumerations.subStatus(this.sub_status));
|
||||||
|
|
||||||
return actualChanges;
|
return actualChanges;
|
||||||
@@ -2978,12 +2988,17 @@ public class SavingsAccount extends AbstractPersistableCustom<Long> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final SavingsAccountSubStatusEnum currentSubStatus = SavingsAccountSubStatusEnum.fromInt(this.sub_status);
|
final SavingsAccountSubStatusEnum currentSubStatus = SavingsAccountSubStatusEnum.fromInt(this.sub_status);
|
||||||
if (!SavingsAccountSubStatusEnum.BLOCK_DEBIT.hasStateOf(currentSubStatus)) {
|
if (!(SavingsAccountSubStatusEnum.BLOCK_DEBIT.hasStateOf(currentSubStatus)
|
||||||
baseDataValidator.reset().parameter(SavingsApiConstants.subStatusParamName)
|
|| SavingsAccountSubStatusEnum.BLOCK.hasStateOf(currentSubStatus))) {
|
||||||
.failWithCodeNoParameterAddedToErrorCode("debits.are.not.blocked");
|
baseDataValidator.reset().parameter(SavingsApiConstants.subStatusParamName)
|
||||||
}
|
.failWithCodeNoParameterAddedToErrorCode("debits.are.not.blocked");
|
||||||
|
}
|
||||||
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
|
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));
|
actualChanges.put(SavingsApiConstants.subStatusParamName, SavingsEnumerations.subStatus(this.sub_status));
|
||||||
return actualChanges;
|
return actualChanges;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user