remove redundant validation rules

This commit is contained in:
akulikov 2023-04-11 16:31:14 +03:00
parent 0545a84229
commit c01d1ba0c6

View file

@ -88,47 +88,7 @@ public class BankAccountValidationConfig {
AccountError.RequiredFieldEmpty),
FieldRequiredRule.instance("destination",
BankAccountNewRequest::getDestination,
AccountError.RequiredFieldEmpty),
FieldRequiredRule.instance("correspondentAccount",
BankAccountNewRequest::getCorrespondentAccount,
AccountError.RequiredFieldEmpty,
false,
correspondentAccount -> {
String currency = bankAccountNewRequest.getCurrency();
if (CurrencyCode.RUB.getKey().equalsIgnoreCase(currency) && correspondentAccount == null)
return AccountError.RequiredFieldEmpty;
return null;
}),
FieldRequiredRule.instance("correspondentAccountName",
BankAccountNewRequest::getCorrespondentAccountName,
AccountError.RequiredFieldEmpty,
false,
correspondentAccountName -> {
String currency = bankAccountNewRequest.getCurrency();
if (CurrencyCode.RUB.getKey().equalsIgnoreCase(currency) && correspondentAccountName == null)
return AccountError.RequiredFieldEmpty;
return null;
}),
FieldRequiredRule.instance("taxpayerIdentificationNumber",
BankAccountNewRequest::getTaxpayerIdentificationNumber,
AccountError.RequiredFieldEmpty,
false,
taxpayerIdentificationNumber -> {
String currency = bankAccountNewRequest.getCurrency();
if (CurrencyCode.RUB.getKey().equalsIgnoreCase(currency) && taxpayerIdentificationNumber == null)
return AccountError.RequiredFieldEmpty;
return null;
}),
FieldRequiredRule.instance("taxRegistrationReasonCode",
BankAccountNewRequest::getTaxRegistrationReasonCode,
AccountError.RequiredFieldEmpty,
false,
taxRegistrationReasonCode -> {
String currency = bankAccountNewRequest.getCurrency();
if (CurrencyCode.RUB.getKey().equalsIgnoreCase(currency) && taxRegistrationReasonCode == null)
return AccountError.RequiredFieldEmpty;
return null;
})
AccountError.RequiredFieldEmpty)
);
};
}