Return epp error 2306 is tech are admin contacts are duplicated

This commit is contained in:
Alex Sherman 2021-01-28 16:31:35 +05:00
parent 560d9111ce
commit 3dfb22d79d
2 changed files with 34 additions and 27 deletions

View file

@ -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

View file

@ -142,12 +142,11 @@ class EppDomainCreateBaseTest < EppTestCase
</epp>
XML
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