Improve EPP contact:update ident errors

#569
This commit is contained in:
Artur Beljajev 2017-09-20 10:54:18 +03:00
parent ec4b3abae4
commit c05e6ead2a
3 changed files with 13 additions and 13 deletions

View file

@ -158,10 +158,10 @@ class Epp::Contact < Contact
# https://github.com/internetee/registry/issues/576
if ident_frame
if identifier.valid?
report_update_disallowed_error
report_valid_ident_error
else
wrong_ident = ident_frame.text.present? && (ident_frame.text != ident)
report_wrong_ident_error if wrong_ident
ident_update_attempt = ident_frame.text.present? && (ident_frame.text != ident)
report_ident_update_error if ident_update_attempt
identifier = Ident.new(code: ident,
type: ident_frame.attr('type'),
@ -240,11 +240,11 @@ class Epp::Contact < Contact
private
def report_update_disallowed_error
throw :epp_error, { code: '2308', msg: I18n.t('epp.contacts.errors.update_disallowed') }
def report_valid_ident_error
throw :epp_error, { code: '2308', msg: I18n.t('epp.contacts.errors.valid_ident') }
end
def report_wrong_ident_error
throw :epp_error, { code: '2308', msg: I18n.t('epp.contacts.errors.wrong_ident') }
def report_ident_update_error
throw :epp_error, { code: '2308', msg: I18n.t('epp.contacts.errors.ident_update') }
end
end