mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 03:30:33 +02:00
Parse contact information on domain creation
This commit is contained in:
parent
8882c36053
commit
338f85224a
3 changed files with 23 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
module Epp::DomainsHelper
|
||||
def create_domain
|
||||
@domain = Domain.new(domain_create_params)
|
||||
@domain.create_contacts(domain_contacts)
|
||||
|
||||
if @domain.save
|
||||
render '/epp/domains/create'
|
||||
|
@ -20,7 +21,6 @@ module Epp::DomainsHelper
|
|||
|
||||
def domain_create_params
|
||||
ph = params_hash['epp']['command']['create']['create']
|
||||
|
||||
{
|
||||
name: ph[:name],
|
||||
registrar_id: current_epp_user.registrar.try(:id),
|
||||
|
@ -32,6 +32,21 @@ module Epp::DomainsHelper
|
|||
}
|
||||
end
|
||||
|
||||
def domain_contacts
|
||||
parsed_frame = Nokogiri::XML(params[:frame]).remove_namespaces!
|
||||
|
||||
res = {tech: [], admin: []}
|
||||
parsed_frame.css('contact[type="tech"]').each do |x|
|
||||
res[:tech] << Hash.from_xml(x.to_s)
|
||||
end
|
||||
|
||||
parsed_frame.css('contact[type="admin"]').each do |x|
|
||||
res[:admin] << Hash.from_xml(x.to_s)
|
||||
end
|
||||
|
||||
res
|
||||
end
|
||||
|
||||
def handle_domain_name_errors
|
||||
[:epp_domain_taken, :epp_domain_reserved].each do |x|
|
||||
if @domain.errors.added?(:name, x)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue