mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 11:16:00 +02:00
Add a new test for domain info query, epp_errors improvement
This commit is contained in:
parent
5b91acb343
commit
28a6b59a55
7 changed files with 34 additions and 3 deletions
|
@ -29,6 +29,8 @@ module Epp::DomainsHelper
|
|||
def info_domain
|
||||
@domain = find_domain
|
||||
|
||||
handle_errors(@domain) and return unless @domain
|
||||
|
||||
render '/epp/domains/info'
|
||||
end
|
||||
|
||||
|
|
|
@ -22,7 +22,9 @@ module EppErrors
|
|||
values.each do |err|
|
||||
if err.is_a?(Hash)
|
||||
next unless code = find_epp_code(err[:msg])
|
||||
epp_errors << {code: code, msg: err[:msg], value: {val: err[:val], obj: err[:obj]}}
|
||||
err_msg = {code: code, msg: err[:msg]}
|
||||
err_msg[:value] = {val: err[:val], obj: err[:obj]} if err[:val]
|
||||
epp_errors << err_msg
|
||||
else
|
||||
next unless code = find_epp_code(err)
|
||||
err = {code: code, msg: err}
|
||||
|
|
|
@ -8,7 +8,8 @@ class Domain < ActiveRecord::Base
|
|||
'2302' => ['Domain name already exists', 'Domain name is reserved or restricted'], # Object exists
|
||||
'2306' => ['Registrant is missing', 'Admin contact is missing', 'Given and current expire dates do not match'], # Parameter policy error
|
||||
'2004' => ['Nameservers count must be between 1-13', 'Period must add up to 1, 2 or 3 years'], # Parameter value range error
|
||||
'2303' => ['Registrant not found', 'Contact was not found'] # Object does not exist
|
||||
'2303' => ['Registrant not found', 'Contact was not found'], # Object does not exist
|
||||
'2200' => ['Authentication error']
|
||||
}
|
||||
|
||||
EPP_ATTR_MAP = {
|
||||
|
@ -156,6 +157,14 @@ class Domain < ActiveRecord::Base
|
|||
}) if cur_exp_date.to_date != valid_to
|
||||
end
|
||||
|
||||
## SHARED
|
||||
|
||||
# For domain transfer
|
||||
def authenticate(pw)
|
||||
errors.add(:auth_info, {msg: errors.generate_message(:auth_info, :wrong_pw)}) if pw != auth_info
|
||||
errors.empty?
|
||||
end
|
||||
|
||||
class << self
|
||||
def convert_period_to_time(period, unit)
|
||||
return period.to_i.days if unit == 'd'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue