mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 07:04:47 +02:00
Add test for validating info epp response on disputed domain against our own schema
This commit is contained in:
parent
fbe63ae062
commit
661ab8e0ac
3 changed files with 56 additions and 2 deletions
|
@ -33,6 +33,8 @@ class Domain < ApplicationRecord
|
|||
has_many :tech_domain_contacts
|
||||
accepts_nested_attributes_for :tech_domain_contacts, allow_destroy: true, reject_if: :tech_change_prohibited?
|
||||
|
||||
ID_CHAR_LIMIT = 8
|
||||
|
||||
def registrant_change_prohibited?
|
||||
statuses.include? DomainStatus::SERVER_REGISTRANT_CHANGE_PROHIBITED
|
||||
end
|
||||
|
@ -331,7 +333,12 @@ class Domain < ApplicationRecord
|
|||
end
|
||||
|
||||
def roid
|
||||
"EIS-#{id}"
|
||||
id_size = id.to_s.size
|
||||
if id_size <= ID_CHAR_LIMIT
|
||||
"EIS-#{id}"
|
||||
else
|
||||
roid_with_prefix(id_size)
|
||||
end
|
||||
end
|
||||
|
||||
def puny_label
|
||||
|
@ -734,4 +741,13 @@ class Domain < ApplicationRecord
|
|||
def self.uses_zone?(zone)
|
||||
exists?(["name ILIKE ?", "%.#{zone.origin}"])
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def roid_with_prefix(id_size)
|
||||
id_delta = id_size - ID_CHAR_LIMIT
|
||||
id_prefix = id.to_s.split(//).first(id_delta).join('').to_s
|
||||
id_postfix = id.to_s.split(//).last(id_size - id_delta).join('').to_s
|
||||
"EIS#{id_prefix}-#{id_postfix}"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue