internetee-registry/app/helpers/epp/domains_helper.rb
Martin Lensment acb65c47d6 Refactor
2014-07-02 17:30:50 +03:00

27 lines
670 B
Ruby

module Epp::DomainsHelper
def create_domain
domain = Domain.create!(domain_create_params)
render '/epp/domains/create'
end
def check_domain
ph = get_params_hash('epp command check check')[:check]
@domains = Domain.check_availability(ph[:name])
render '/epp/domains/check'
end
### HELPER METHODS ###
def domain_create_params
ph = get_params_hash('epp command create create')[:create]
{
name: ph[:name],
registrar_id: current_epp_user.registrar.try(:id),
registered_at: Time.now,
valid_from: Date.today,
valid_to: Date.today + ph[:period].to_i.years,
auth_info: ph[:authInfo]
}
end
end