diff --git a/app/controllers/epp/contacts_controller.rb b/app/controllers/epp/contacts_controller.rb index 117aaabc0..e719d8180 100644 --- a/app/controllers/epp/contacts_controller.rb +++ b/app/controllers/epp/contacts_controller.rb @@ -17,9 +17,16 @@ class Epp::ContactsController < EppController def create authorize! :create, Epp::Contact - @contact = Epp::Contact.new(params[:parsed_frame], current_user.registrar) + frame = params[:parsed_frame] + @contact = Epp::Contact.new(frame, current_user.registrar) - @contact.add_legal_file_to_new(params[:parsed_frame]) + @contact.add_legal_file_to_new(frame) + + @response_code = if Contact.address_processing + 1000 + else + frame.css('postalInfo addr').size != 0 ? 1100 : 1000 + end if @contact.save render_epp_response '/epp/contacts/create' @@ -141,7 +148,7 @@ class Epp::ContactsController < EppController def contact_org_disabled return true if ENV['contact_org_enabled'] == 'true' return true if params[:parsed_frame].css('postalInfo org').text.blank? - + epp_errors << { code: '2306', msg: "#{I18n.t(:contact_org_error)}: postalInfo > org [org]" diff --git a/app/views/epp/contacts/create.xml.builder b/app/views/epp/contacts/create.xml.builder index 649198e00..7d628f31b 100644 --- a/app/views/epp/contacts/create.xml.builder +++ b/app/views/epp/contacts/create.xml.builder @@ -1,6 +1,6 @@ xml.epp_head do xml.response do - xml.result('code' => '1000') do + xml.result('code' => @response_code) do xml.msg 'Command completed successfully' end