diff --git a/app/models/depp/contact.rb b/app/models/depp/contact.rb index 2d85d1459..db67c20ed 100644 --- a/app/models/depp/contact.rb +++ b/app/models/depp/contact.rb @@ -77,7 +77,8 @@ module Depp def user=(user) @user = user - @epp_xml = EppXml::Contact.new(cl_trid_prefix: user.tag) + @epp_xml = EppXml::Contact.new(cl_trid_prefix: user.tag, schema_prefix: 'contact-ee', + schema_version: '1.1') end def info_xml(id, password = nil) diff --git a/app/models/depp/domain.rb b/app/models/depp/domain.rb index f9e065241..e75bdd420 100644 --- a/app/models/depp/domain.rb +++ b/app/models/depp/domain.rb @@ -53,11 +53,6 @@ module Depp current_user.request(xml) end - def hostname_present - domain_params[:nameservers_attributes] - .select { |_key, value| value['hostname'].present? }.any? - end - def create(domain_params) dns_hash = {} keys = Domain.create_dnskeys_hash(domain_params) @@ -66,16 +61,16 @@ module Depp period = domain_params[:period].to_i.to_s period_unit = domain_params[:period][-1].to_s - xml = if hostname_present - epp_xml.create({ + xml = if domain_params[:nameservers_attributes].select { |key, value| value['hostname'].present? }.any? + epp_xml.create({ name: { value: domain_params[:name] }, period: { value: period, attrs: { unit: period_unit } }, ns: Domain.create_nameservers_hash(domain_params), registrant: { value: domain_params[:registrant] }, _anonymus: Domain.create_contacts_hash(domain_params) }, dns_hash, Domain.construct_custom_params_hash(domain_params)) - else - epp_xml.create({ + else + epp_xml.create({ name: { value: domain_params[:name] }, period: { value: period, attrs: { unit: period_unit } }, registrant: { value: domain_params[:registrant] }, @@ -242,12 +237,9 @@ module Depp rem_arr << { ns: rem_ns } if rem_ns.any? rem_arr << { _anonymus: rem_anon } if rem_anon.any? - return if domain_params[:registrant] == old_domain_params[:registrant] - - chg = [{ registrant: { value: domain_params[:registrant] } }] - if domain_params[:verified].blank? && (domain_params[:verified]) - chg = [{ registrant: { value: domain_params[:registrant], - attrs: { verified: 'yes' } } }] + if domain_params[:registrant] != old_domain_params[:registrant] + chg = [{ registrant: { value: domain_params[:registrant] } }] unless domain_params[:verified].present? + chg = [{ registrant: { value: domain_params[:registrant], attrs: { verified: 'yes' } } }] if domain_params[:verified] end add_arr = nil if add_arr.none? diff --git a/test/system/registrar_area/domain/domain_test.rb b/test/system/registrar_area/domain/domain_test.rb new file mode 100644 index 000000000..fc6cf9e89 --- /dev/null +++ b/test/system/registrar_area/domain/domain_test.rb @@ -0,0 +1,20 @@ +require 'application_system_test_case' + +class Domainest < ApplicationSystemTestCase + setup do + @user = users(:api_bestnames) + @contact = contacts(:jack) + + @domain = domains(:shop) + + sign_in @user + end + + def test_update_tech_contact + visit edit_registrar_domains_path + "?domain_name=#{@domain.name}" + fill_in 'domain_contacts_attributes_0_code_helper', with: "#{@contact.code} #{@contact.name}" + click_on 'Save' + + assert_redirect_to info_registrar_domains_url(domain_name: @domain_params[:name]) + end +end