diff --git a/app/controllers/epp/contacts_controller.rb b/app/controllers/epp/contacts_controller.rb index 66791abc5..adaa26070 100644 --- a/app/controllers/epp/contacts_controller.rb +++ b/app/controllers/epp/contacts_controller.rb @@ -27,19 +27,7 @@ module Epp action = Actions::ContactCreate.new(@contact, collected_data.legal_document, collected_data.ident) - if action.call - if !address_processing? && address_given? - @response_code = 1100 - @response_description = t('epp.contacts.completed_without_address') - else - @response_code = 1000 - @response_description = t('epp.contacts.completed') - end - - render_epp_response '/epp/contacts/save' - else - handle_errors(@contact) - end + action_call_response(action: action) end def update @@ -52,19 +40,7 @@ module Epp collected_data.ident, current_user) - if action.call - if !address_processing? && address_given? - @response_code = 1100 - @response_description = t('epp.contacts.completed_without_address') - else - @response_code = 1000 - @response_description = t('epp.contacts.completed') - end - - render_epp_response 'epp/contacts/save' - else - handle_errors(@contact) - end + action_call_response(action: action) end def delete @@ -91,6 +67,20 @@ module Epp private + def action_call_response(action:) + unless action.call + handle_errors(@contact) + return + end + + @response_code = !address_processing? && address_given? ? 1100 : 1000 + str = 'epp.contacts.completed' + str = "#{str}_without_address" if !address_processing? && address_given? + + @response_description = t(str) + render_epp_response('epp/contacts/save') + end + def find_password @password = params[:parsed_frame].css('authInfo pw').text end