fixes EnumPresentRule
This commit is contained in:
parent
804b659227
commit
342db96a1e
2 changed files with 7 additions and 26 deletions
|
|
@ -77,11 +77,6 @@ public class AccountValidationConfig {
|
|||
if (statusValue == null || AccountStatus.ACTIVE.equalsByKey(statusValue)) return null;
|
||||
return AccountError.WrongFieldValue;
|
||||
}),
|
||||
EnumPresentRule.instance("accountType",
|
||||
CorrespondentAccountNewRequest::getAccountType,
|
||||
AccountType.values(),
|
||||
AccountError.WrongFieldValue,
|
||||
AccountError.RequiredFieldEmpty),
|
||||
DictionaryPresentRule.instance("accountType",
|
||||
CorrespondentAccountNewRequest::getAccountType,
|
||||
IMDGDistributedNames.Map_AccountTypeDictionary,
|
||||
|
|
@ -89,7 +84,7 @@ public class AccountValidationConfig {
|
|||
AccountError.RequiredFieldEmpty,
|
||||
AccountError.WrongFieldValue,
|
||||
accountType -> {
|
||||
if (accountType.getCode().equalsIgnoreCase(AccountType.Corr.getKey())) return null;
|
||||
if (AccountType.Corr.equalsByKey(accountType.getCode())) return null;
|
||||
return AccountError.WrongFieldValue;
|
||||
})
|
||||
);
|
||||
|
|
@ -138,11 +133,6 @@ public class AccountValidationConfig {
|
|||
false,
|
||||
AccountError.WrongFieldValue,
|
||||
AccountError.RequiredFieldEmpty),
|
||||
EnumPresentRule.instance("accountType",
|
||||
CorrespondentAccountUpdateRequest::getAccountType,
|
||||
AccountType.values(),
|
||||
AccountError.WrongFieldValue,
|
||||
AccountError.RequiredFieldEmpty),
|
||||
DictionaryPresentRule.instance("accountType",
|
||||
CorrespondentAccountUpdateRequest::getAccountType,
|
||||
IMDGDistributedNames.Map_AccountTypeDictionary,
|
||||
|
|
@ -150,7 +140,7 @@ public class AccountValidationConfig {
|
|||
AccountError.RequiredFieldEmpty,
|
||||
AccountError.WrongFieldValue,
|
||||
accountType -> {
|
||||
if (accountType.getCode().equalsIgnoreCase(AccountType.Corr.getKey())) return null;
|
||||
if (AccountType.Corr.equalsByKey(accountType.getCode())) return null;
|
||||
return AccountError.WrongFieldValue;
|
||||
})
|
||||
);
|
||||
|
|
@ -172,7 +162,11 @@ public class AccountValidationConfig {
|
|||
IMDGDistributedNames.Map_Account,
|
||||
Account.class,
|
||||
AccountError.RequiredFieldEmpty,
|
||||
AccountError.AccountNotFound)
|
||||
AccountError.AccountNotFound,
|
||||
account -> {
|
||||
if (AccountStatus.ACTIVE.equalsByKey(account.getStatus())) return null;
|
||||
return AccountError.AccountNotActive;
|
||||
})
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,13 +12,11 @@ import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountNewReq
|
|||
import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountUpdateRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.cud.common.CommonDeleteRequest;
|
||||
import ru.spcex.clearing.validation.common.rules.DictionaryPresentRule;
|
||||
import ru.spcex.clearing.validation.common.rules.EnumPresentRule;
|
||||
import ru.spcex.clearing.validation.common.rules.FieldRequiredRule;
|
||||
import ru.spcex.clearing.validation.common.rules.IdPresentRule;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.enumeration.AccountStatus;
|
||||
import ru.spcex.platform.enumeration.AccountType;
|
||||
import ru.spcex.platform.enumeration.CurrencyCode;
|
||||
import ru.spcex.platform.enumeration.WorkflowStatus;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||
|
|
@ -73,11 +71,6 @@ public class BankAccountValidationConfig {
|
|||
if (accounts.isEmpty()) return null;
|
||||
return AccountError.AccountAlreadyExist;
|
||||
}),
|
||||
EnumPresentRule.instance("currency",
|
||||
BankAccountNewRequest::getCurrency,
|
||||
CurrencyCode.values(),
|
||||
AccountError.WrongFieldValue,
|
||||
AccountError.RequiredFieldEmpty),
|
||||
DictionaryPresentRule.instance("currency",
|
||||
BankAccountNewRequest::getCurrency,
|
||||
IMDGDistributedNames.Map_CurrencyCodeDictionary,
|
||||
|
|
@ -126,12 +119,6 @@ public class BankAccountValidationConfig {
|
|||
if (!AccountStatus.ACTIVE.equalsByKey(account.getStatus())) return AccountError.AccountNotActive;
|
||||
return null;
|
||||
}),
|
||||
EnumPresentRule.instance("currency",
|
||||
BankAccountUpdateRequest::getCurrency,
|
||||
CurrencyCode.values(),
|
||||
false,
|
||||
AccountError.WrongFieldValue,
|
||||
AccountError.RequiredFieldEmpty),
|
||||
DictionaryPresentRule.instance("currency",
|
||||
BankAccountUpdateRequest::getCurrency,
|
||||
IMDGDistributedNames.Map_CurrencyCodeDictionary,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue