SDF01 проверка curr_code RUR/RUB
This commit is contained in:
parent
b10d6bb0c3
commit
edb00e4608
3 changed files with 5 additions and 4 deletions
|
|
@ -202,7 +202,7 @@ public class ValidationConfig {
|
|||
Sdf01NewValidationRule.CompanyPresent,
|
||||
Sdf01NewValidationRule.AccountType,
|
||||
Sdf01NewValidationRule.AccountPresent,
|
||||
Sdf01NewValidationRule.CurrencyCode,
|
||||
Sdf01NewValidationRule.CurrencyCodeCheck,
|
||||
Sdf01NewValidationRule.DatIsCurrentDt
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import ru.spcex.clearing.error.ClearingError;
|
|||
import ru.spcex.clearing.error.ClearingErrorInternal;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.platform.enumeration.AccType;
|
||||
import ru.spcex.platform.enumeration.CurrencyCode;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.validation.ImdgValidationContext;
|
||||
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
||||
|
|
@ -59,11 +60,11 @@ public enum Sdf01NewValidationRule implements IValidationRule<ImdgValidationCont
|
|||
context.storeObject(ValidationStored.Sdf01Account, acc);
|
||||
return empty();
|
||||
}
|
||||
}, CurrencyCode() {
|
||||
}, CurrencyCodeCheck() {
|
||||
@Override
|
||||
public Optional<EnumMessage> validate(ImdgValidationContext<SDf01> context) {
|
||||
SDf01 sdf01 = context.getValidatedObject();
|
||||
if (!ru.spcex.platform.enumeration.CurrencyCode.RUR.equalsByKey(sdf01.getCurr_code())) {
|
||||
if (!IEnumKey.contains(sdf01.getCurr_code(), CurrencyCode.class)) {
|
||||
return of(ClearingError.CurrencyNotFound, sdf01.getCurr_code());
|
||||
}
|
||||
return empty();
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public interface IEnumKey extends Serializable {
|
|||
* Проверяет что среди всех Enum данного класса, присутствует элемент с данным id
|
||||
* id может быть null
|
||||
*/
|
||||
static <T extends Enum<T> & IEnumKey> boolean contains(Class<T> enumClass, String key) {
|
||||
static <T extends Enum<T> & IEnumKey> boolean contains(String key, Class<T> enumClass) {
|
||||
for (T e : enumClass.getEnumConstants()) {
|
||||
if (Objects.equals(key, e.getKey()))
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue