diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index 5962c31e1..6e62ce185 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? - deny_ident_update + report_update_disallowed_error else - ident_change_disallowed = ident_frame.text.present? && (ident_frame.text != ident) - deny_ident_update if ident_change_disallowed + wrong_ident = ident_frame.text.present? && (ident_frame.text != ident) + report_wrong_ident_error if wrong_ident identifier = Ident.new(code: ident, type: ident_frame.attr('type'), @@ -240,7 +240,11 @@ class Epp::Contact < Contact private - def deny_ident_update - throw :epp_error, { code: '2308', msg: I18n.t(:ident_update_error) } + def report_update_disallowed_error + throw :epp_error, { code: '2308', msg: I18n.t('epp.contacts.errors.update_disallowed') } + end + + def report_wrong_ident_error + throw :epp_error, { code: '2308', msg: I18n.t('epp.contacts.errors.wrong_ident') } end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 62d145b28..e44ca22ed 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -473,9 +473,6 @@ en: crt_revoked: 'CRT (revoked)' contact_org_error: 'Parameter value policy error. Org must be blank' contact_fax_error: 'Parameter value policy error. Fax must be blank' - ident_update_error: >- - Data management policy violation: - update of ident not allowed, please consider creating new contact object invoices: 'Invoices' no_such_user: 'No such user' phone_no: 'Phone number' diff --git a/config/locales/epp/contacts.en.yml b/config/locales/epp/contacts.en.yml index a669310ab..2175717d0 100644 --- a/config/locales/epp/contacts.en.yml +++ b/config/locales/epp/contacts.en.yml @@ -3,3 +3,11 @@ en: contacts: completed: Command completed successfully completed_without_address: Command completed successfully; Postal address data discarded + + errors: + update_disallowed: >- + 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 diff --git a/spec/requests/epp/contact/update/ident_spec.rb b/spec/requests/epp/contact/update/ident_spec.rb index 87879f35d..61ccfc85f 100644 --- a/spec/requests/epp/contact/update/ident_spec.rb +++ b/spec/requests/epp/contact/update/ident_spec.rb @@ -60,9 +60,8 @@ RSpec.describe 'EPP contact:update' do specify do request - message = 'Data management policy violation:' \ - ' update of ident not allowed, please consider creating new contact object' - expect(epp_response).to have_result(:data_management_policy_violation, message) + expect(epp_response).to have_result(:data_management_policy_violation, + t('epp.contacts.errors.update_disallowed')) end end @@ -172,9 +171,8 @@ RSpec.describe 'EPP contact:update' do specify do request - message = 'Data management policy violation:' \ - ' update of ident not allowed, please consider creating new contact object' - expect(epp_response).to have_result(:data_management_policy_violation, message) + expect(epp_response).to have_result(:data_management_policy_violation, + t('epp.contacts.errors.wrong_ident')) end end end