mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 23:24:48 +02:00
REPP: Simplify ident validation
This commit is contained in:
parent
3e27869379
commit
c59b47a519
1 changed files with 14 additions and 10 deletions
|
@ -26,16 +26,7 @@ module Actions
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_ident
|
def validate_ident
|
||||||
if ident.present?
|
validate_ident_integrity
|
||||||
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?
|
if ident.present? && ident[:ident_type] != 'birthday' && ident[:ident_country_code].blank?
|
||||||
contact.add_epp_error('2003', nil, 'ident_country_code',
|
contact.add_epp_error('2003', nil, 'ident_country_code',
|
||||||
|
@ -50,6 +41,19 @@ module Actions
|
||||||
contact.identifier = identifier
|
contact.identifier = identifier
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def validate_ident_integrity
|
||||||
|
return if ident.blank?
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
def maybe_attach_legal_doc
|
def maybe_attach_legal_doc
|
||||||
return unless legal_document
|
return unless legal_document
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue