diff --git a/app/models/domain.rb b/app/models/domain.rb
index 56dd91919..4a246d76f 100644
--- a/app/models/domain.rb
+++ b/app/models/domain.rb
@@ -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
diff --git a/lib/schemas/domain-eis-1.0.xsd b/lib/schemas/domain-eis-1.0.xsd
index edf8676af..42b47bed4 100644
--- a/lib/schemas/domain-eis-1.0.xsd
+++ b/lib/schemas/domain-eis-1.0.xsd
@@ -414,6 +414,7 @@ than English.
+
diff --git a/test/integration/epp/domain/info/base_test.rb b/test/integration/epp/domain/info/base_test.rb
index 26f0ecce1..b9054e553 100644
--- a/test/integration/epp/domain/info/base_test.rb
+++ b/test/integration/epp/domain/info/base_test.rb
@@ -34,6 +34,43 @@ class EppDomainInfoBaseTest < EppTestCase
assert_equal '2010-07-07T00:00:00+03:00', response_xml.at_xpath('//domain:exDate', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
end
+ def test_returns_valid_response_if_disputed
+ dispute = disputes(:expired)
+ dispute.update!(starts_at: Time.zone.now, expires_at: Time.zone.now + 5.days, closed: nil)
+
+ domain = domains(:shop)
+ domain.update_columns(statuses: [DomainStatus::DISPUTED],
+ created_at: Time.zone.parse('2010-07-05'),
+ updated_at: Time.zone.parse('2010-07-06'),
+ creator_str: 'test',
+ valid_to: Time.zone.parse('2010-07-07'))
+
+ domain.versions.destroy_all
+
+ request_xml = <<-XML
+
+
+
+
+
+ shop.test
+
+
+
+
+ XML
+
+ post epp_info_path, params: { frame: request_xml },
+ headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
+
+ response_xml = Nokogiri::XML(response.body)
+ assert_epp_response :completed_successfully
+ schema = EPP_ALL_SCHEMA
+
+ schema_validation_errors = schema.validate(response_xml)
+ assert_equal 0, schema_validation_errors.size
+ end
+
def test_reveals_transfer_code_when_domain_is_owned_by_current_user
assert_equal '65078d5', domains(:shop).transfer_code
@@ -109,4 +146,4 @@ class EppDomainInfoBaseTest < EppTestCase
assert_nil response_xml.at_xpath('//domain:authInfo/domain:pw',
'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')
end
-end
\ No newline at end of file
+end