mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 07:04:47 +02:00
Rename auth_info / authorization_code to transfer_code
This commit is contained in:
parent
6e624a7898
commit
117b682990
5 changed files with 32 additions and 6 deletions
|
@ -28,6 +28,8 @@ module Repp
|
|||
param :domain, Hash, required: true, desc: 'Parameters for new domain' do
|
||||
param :name, String, required: true, desc: 'Domain name to be registered'
|
||||
param :registrant, String, required: true, desc: 'Registrant contact code'
|
||||
param :reserved_pw, String, required: false, desc: 'Reserved password for domain'
|
||||
param :transfer_code, String, required: false, desc: 'Desired transfer code for domain'
|
||||
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
|
||||
|
@ -71,7 +73,7 @@ module Repp
|
|||
param :verified, [true, false], required: false,
|
||||
desc: 'Registrant change is already verified'
|
||||
end
|
||||
param :auth_info, String, required: false, desc: 'New authorization code'
|
||||
param :transfer_code, String, required: false, desc: 'New authorization code'
|
||||
end
|
||||
def update
|
||||
action = Actions::DomainUpdate.new(@domain, params[:domain], false)
|
||||
|
@ -215,10 +217,10 @@ module Repp
|
|||
|
||||
def domain_create_params
|
||||
params.require(:domain).permit(:name, :registrant, :period, :period_unit, :registrar,
|
||||
:transfer_code, :reserved_pw,
|
||||
dnskeys_attributes: [%i[flags alg protocol public_key]],
|
||||
nameservers_attributes: [[:hostname, ipv4: [], ipv6: []]],
|
||||
admin_contacts: [],
|
||||
tech_contacts: [])
|
||||
admin_contacts: [], tech_contacts: [])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -35,7 +35,7 @@ module Actions
|
|||
end
|
||||
|
||||
def validate_domain_integrity
|
||||
domain.auth_info = params[:auth_info] if params[:auth_info]
|
||||
domain.auth_info = params[:transfer_code] if params[:transfer_code]
|
||||
|
||||
return unless domain.discarded?
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ module Deserializers
|
|||
|
||||
def call
|
||||
obj = { domain: frame.css('name')&.text, registrant: registrant, contacts: contacts,
|
||||
auth_info: if_present('authInfo > pw'), nameservers: nameservers,
|
||||
transfer_code: if_present('authInfo > pw'), nameservers: nameservers,
|
||||
registrar_id: registrar, statuses: statuses, dns_keys: dns_keys,
|
||||
reserved_pw: if_present('reserved > pw'), legal_document: @legal_document }
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ module Serializers
|
|||
name: obj.name, registrant: obj.registrant.code, created_at: obj.created_at,
|
||||
updated_at: obj.updated_at, expire_time: obj.expire_time, outzone_at: obj.outzone_at,
|
||||
delete_date: obj.delete_date, force_delete_date: obj.force_delete_date,
|
||||
authorization_code: obj.auth_info, contacts: contacts, nameservers: nameservers,
|
||||
transfer_code: obj.auth_info, contacts: contacts, nameservers: nameservers,
|
||||
dnssec_keys: dnssec_keys, statuses: obj.statuses
|
||||
}
|
||||
|
||||
|
|
|
@ -110,4 +110,28 @@ class ReppV1DomainsCreateTest < ActionDispatch::IntegrationTest
|
|||
assert_equal tech_contact, domain.tech_domain_contacts.first.contact
|
||||
assert_equal admin_contact, domain.admin_domain_contacts.first.contact
|
||||
end
|
||||
|
||||
def test_creates_new_domain_with_desired_transfer_code
|
||||
@auth_headers['Content-Type'] = 'application/json'
|
||||
contact = contacts(:john)
|
||||
|
||||
payload = {
|
||||
domain: {
|
||||
name: 'domeener.test',
|
||||
registrant: contact.code,
|
||||
transfer_code: 'ABADIATS',
|
||||
period: 1,
|
||||
period_unit: 'y'
|
||||
}
|
||||
}
|
||||
|
||||
post "/repp/v1/domains", headers: @auth_headers, params: payload.to_json
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_response :ok
|
||||
assert_equal 1000, json[:code]
|
||||
assert_equal 'Command completed successfully', json[:message]
|
||||
|
||||
assert @user.registrar.domains.find_by(name: 'domeener.test').present?
|
||||
assert_equal 'ABADIATS', @user.registrar.domains.find_by(name: 'domeener.test').transfer_code
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue