diff --git a/app/controllers/repp/v1/domains_controller.rb b/app/controllers/repp/v1/domains_controller.rb index 05cb5b754..dcf7a15cb 100644 --- a/app/controllers/repp/v1/domains_controller.rb +++ b/app/controllers/repp/v1/domains_controller.rb @@ -27,7 +27,7 @@ module Repp desc 'Create a new domain' param :domain, Hash, required: true, desc: 'Parameters for new domain' do param :name, String, required: true, desc: 'Domain name to be registered' - param :registrant_id, String, required: true, desc: 'Registrant contact code' + param :registrant, String, required: true, desc: 'Registrant contact code' param :period, Integer, required: true, desc: 'Registration period in months or years' param :period_unit, String, required: true, desc: 'Period type (month m) or (year y)' param :nameservers_attributes, Array, required: false, desc: 'Domain nameservers' do @@ -170,7 +170,7 @@ module Repp def forward_registrar_id return unless params[:domain] - params[:domain][:registrar_id] = current_user.registrar.id + params[:domain][:registrar] = current_user.registrar.id end def set_domain @@ -216,7 +216,7 @@ module Repp end def domain_create_params - params.require(:domain).permit(:name, :registrant_id, :period, :period_unit, :registrar_id, + params.require(:domain).permit(:name, :registrant, :period, :period_unit, :registrar, dnskeys_attributes: [%i[flags alg protocol public_key]], nameservers_attributes: [[:hostname, ipv4: [], ipv6: []]], admin_contacts: [], diff --git a/app/interactions/actions/domain_create.rb b/app/interactions/actions/domain_create.rb index 4534dfa5e..ec6e83b0e 100644 --- a/app/interactions/actions/domain_create.rb +++ b/app/interactions/actions/domain_create.rb @@ -66,16 +66,16 @@ module Actions end def assign_registrant - unless params[:registrant_id] + unless params[:registrant] domain.add_epp_error('2306', nil, nil, %i[registrant cannot_be_missing]) return end - regt = Registrant.find_by(code: params[:registrant_id]) + regt = Registrant.find_by(code: params[:registrant]) if regt domain.registrant = regt else - domain.add_epp_error('2303', 'registrant', params[:registrant_id], %i[registrant not_found]) + domain.add_epp_error('2303', 'registrant', params[:registrant], %i[registrant not_found]) end end @@ -207,7 +207,7 @@ module Actions end def current_registrar - Registrar.find(params[:registrar_id]) + Registrar.find(params[:registrar]) end end end diff --git a/app/interactions/actions/domain_update.rb b/app/interactions/actions/domain_update.rb index e93162fd5..0df036654 100644 --- a/app/interactions/actions/domain_update.rb +++ b/app/interactions/actions/domain_update.rb @@ -49,7 +49,7 @@ module Actions regt = Registrant.find_by(code: params[:registrant][:code]) unless regt - domain.add_epp_error('2303', 'registrant', params[:registrant_id], %i[registrant not_found]) + domain.add_epp_error('2303', 'registrant', params[:registrant], %i[registrant not_found]) return end @@ -234,7 +234,7 @@ module Actions def ask_registrant_verification if verify_registrant_change? && !bypass_verify && Setting.request_confirmation_on_registrant_change_enabled - domain.registrant_verification_asked!(params, params[:registrar_id]) + domain.registrant_verification_asked!(params, params[:registrar]) end end diff --git a/lib/deserializers/xml/domain.rb b/lib/deserializers/xml/domain.rb index c663d4e7e..e406a8de7 100644 --- a/lib/deserializers/xml/domain.rb +++ b/lib/deserializers/xml/domain.rb @@ -11,8 +11,8 @@ module Deserializers def call attributes = { name: if_present('name'), - registrar_id: registrar, - registrant_id: if_present('registrant'), + registrar: registrar, + registrant: if_present('registrant'), reserved_pw: if_present('reserved > pw'), } diff --git a/test/integration/repp/v1/domains/create_test.rb b/test/integration/repp/v1/domains/create_test.rb index ca1c08c5e..bcce43e58 100644 --- a/test/integration/repp/v1/domains/create_test.rb +++ b/test/integration/repp/v1/domains/create_test.rb @@ -17,7 +17,7 @@ class ReppV1DomainsCreateTest < ActionDispatch::IntegrationTest payload = { domain: { name: 'domeener.test', - registrant_id: contact.code, + registrant: contact.code, period: 1, period_unit: 'y' } @@ -39,7 +39,7 @@ class ReppV1DomainsCreateTest < ActionDispatch::IntegrationTest payload = { domain: { name: 'domeener.test', - registrant_id: contact.code, + registrant: contact.code, period: 3, period_unit: 'y' } @@ -61,7 +61,7 @@ class ReppV1DomainsCreateTest < ActionDispatch::IntegrationTest payload = { domain: { name: 'domeener.test', - registrant_id: contact.code, + registrant: contact.code, period: 1, period_unit: 'y', nameservers_attributes: [ @@ -91,7 +91,7 @@ class ReppV1DomainsCreateTest < ActionDispatch::IntegrationTest payload = { domain: { name: 'domeener.test', - registrant_id: contact.code, + registrant: contact.code, period: 1, period_unit: 'y', admin_contacts: [ admin_contact.code ],