From c05e6ead2a4a6bf47fc778f3858c3826eb182cc8 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Wed, 20 Sep 2017 10:54:18 +0300 Subject: [PATCH] Improve EPP contact:update ident errors #569 --- app/models/epp/contact.rb | 14 +++++++------- config/locales/epp/contacts.en.yml | 8 ++++---- spec/requests/epp/contact/update/ident_spec.rb | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index 6e62ce185..7548ee4ec 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -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 diff --git a/config/locales/epp/contacts.en.yml b/config/locales/epp/contacts.en.yml index 2175717d0..fe4ed7ccf 100644 --- a/config/locales/epp/contacts.en.yml +++ b/config/locales/epp/contacts.en.yml @@ -5,9 +5,9 @@ en: completed_without_address: Command completed successfully; Postal address data discarded errors: - update_disallowed: >- + valid_ident: >- Ident update is not allowed. Consider creating new contact object - wrong_ident: >- - Ident is wrong. - A valid ident should be provided in order to be able to update missing ident country code or type + ident_update: >- + Only ident type and country can be updated in case of invalid ident. + Please create new contact object to update ident code diff --git a/spec/requests/epp/contact/update/ident_spec.rb b/spec/requests/epp/contact/update/ident_spec.rb index 61ccfc85f..6c016275a 100644 --- a/spec/requests/epp/contact/update/ident_spec.rb +++ b/spec/requests/epp/contact/update/ident_spec.rb @@ -61,7 +61,7 @@ RSpec.describe 'EPP contact:update' do request expect(epp_response).to have_result(:data_management_policy_violation, - t('epp.contacts.errors.update_disallowed')) + t('epp.contacts.errors.valid_ident')) end end @@ -172,7 +172,7 @@ RSpec.describe 'EPP contact:update' do request expect(epp_response).to have_result(:data_management_policy_violation, - t('epp.contacts.errors.wrong_ident')) + t('epp.contacts.errors.ident_update')) end end end