REPP: Verify contact ident type

This commit is contained in:
Karl Erik Õunapuu 2020-10-09 11:12:25 +03:00
parent 39c6d20413
commit a73cd53bff
No known key found for this signature in database
GPG key ID: C9DD647298A34764
3 changed files with 17 additions and 9 deletions

View file

@ -26,9 +26,14 @@ module Actions
end
def validate_ident
if ident.present? && ident[:ident_type].blank?
contact.add_epp_error('2003', nil, 'ident_type', I18n.t('errors.messages.required_ident_attribute_missing'))
@error = true
if ident.present?
if ident[:ident_type].blank?
contact.add_epp_error('2003', nil, 'ident_type', I18n.t('errors.messages.required_ident_attribute_missing'))
@error = true
elsif !%w[priv org birthday].include?(ident[:ident_type])
contact.add_epp_error('2003', nil, 'ident_type', 'Invalid ident type')
@error = true
end
end
if ident.present? && ident[:ident_type] != 'birthday' && ident[:ident_country_code].blank?