mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 13:15:40 +02:00
Return epp error 2306 is tech are admin contacts are duplicated
This commit is contained in:
parent
560d9111ce
commit
3dfb22d79d
2 changed files with 34 additions and 27 deletions
|
@ -162,6 +162,9 @@ class Epp::Domain < Domain
|
|||
at[:admin_domain_contacts_attributes] = admin_domain_contacts_attrs(frame, action)
|
||||
at[:tech_domain_contacts_attributes] = tech_domain_contacts_attrs(frame, action)
|
||||
|
||||
check_for_same_contacts(at[:admin_domain_contacts_attributes], 'admin')
|
||||
check_for_same_contacts(at[:tech_domain_contacts_attributes], 'tech')
|
||||
|
||||
pw = frame.css('authInfo > pw').text
|
||||
at[:transfer_code] = pw if pw.present?
|
||||
|
||||
|
@ -176,6 +179,11 @@ class Epp::Domain < Domain
|
|||
at
|
||||
end
|
||||
|
||||
def check_for_same_contacts(contacts, contact_type)
|
||||
return unless contacts.uniq.count != contacts.count
|
||||
|
||||
add_epp_error('2306', contact_type, nil, %i[domain_contacts invalid])
|
||||
end
|
||||
|
||||
# Adding legal doc to domain and
|
||||
# if something goes wrong - raise Rollback error
|
||||
|
|
|
@ -120,34 +120,33 @@ class EppDomainCreateBaseTest < EppTestCase
|
|||
registrant = contact.becomes(Registrant)
|
||||
|
||||
request_xml = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
<command>
|
||||
<create>
|
||||
<domain:create xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||
<domain:name>#{name}</domain:name>
|
||||
<domain:registrant>#{registrant.code}</domain:registrant>
|
||||
<domain:contact type="admin">#{contact.code}</domain:contact>
|
||||
<domain:contact type="admin">#{contact.code}</domain:contact>
|
||||
<domain:contact type="tech">#{contact.code}</domain:contact>
|
||||
<domain:contact type="tech">#{contact.code}</domain:contact>
|
||||
</domain:create>
|
||||
</create>
|
||||
<extension>
|
||||
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||
<eis:legalDocument type="pdf">#{'test' * 2000}</eis:legalDocument>
|
||||
</eis:extdata>
|
||||
</extension>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
<command>
|
||||
<create>
|
||||
<domain:create xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||
<domain:name>#{name}</domain:name>
|
||||
<domain:registrant>#{registrant.code}</domain:registrant>
|
||||
<domain:contact type="admin">#{contact.code}</domain:contact>
|
||||
<domain:contact type="admin">#{contact.code}</domain:contact>
|
||||
<domain:contact type="tech">#{contact.code}</domain:contact>
|
||||
<domain:contact type="tech">#{contact.code}</domain:contact>
|
||||
</domain:create>
|
||||
</create>
|
||||
<extension>
|
||||
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||
<eis:legalDocument type="pdf">#{'test' * 2000}</eis:legalDocument>
|
||||
</eis:extdata>
|
||||
</extension>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
|
||||
|
||||
assert_no_difference 'Domain.count' do
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
assert_no_difference 'Domain.count' do
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
end
|
||||
|
||||
assert_epp_response :parameter_value_policy_error
|
||||
end
|
||||
|
||||
|
@ -180,7 +179,7 @@ class EppDomainCreateBaseTest < EppTestCase
|
|||
</epp>
|
||||
XML
|
||||
|
||||
|
||||
|
||||
|
||||
assert_no_difference 'Domain.count' do
|
||||
post epp_create_path, params: { frame: request_xml },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue