mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
Admin contact cannot be juridical
This commit is contained in:
parent
bc80274109
commit
20be38fd0b
4 changed files with 359 additions and 277 deletions
|
@ -124,12 +124,17 @@ class Epp::EppDomain < Domain
|
||||||
contacts.each do |k, v|
|
contacts.each do |k, v|
|
||||||
v.each do |x|
|
v.each do |x|
|
||||||
contact = Contact.find_by(code: x[:contact])
|
contact = Contact.find_by(code: x[:contact])
|
||||||
if contact
|
unless contact
|
||||||
attach_contact(k, contact)
|
|
||||||
else
|
|
||||||
# Detailed error message with value to display in EPP response
|
|
||||||
add_epp_error('2303', 'contact', x[:contact], [:domain_contacts, :not_found])
|
add_epp_error('2303', 'contact', x[:contact], [:domain_contacts, :not_found])
|
||||||
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if k == :admin && contact.juridical?
|
||||||
|
add_epp_error('2306', 'contact', x[:contact], [:domain_contacts, :admin_contact_can_be_only_citizen])
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
|
attach_contact(k, contact)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@ en:
|
||||||
domain_contacts:
|
domain_contacts:
|
||||||
invalid: 'Contacts are invalid'
|
invalid: 'Contacts are invalid'
|
||||||
not_found: 'Contact was not found'
|
not_found: 'Contact was not found'
|
||||||
|
admin_contact_can_be_only_citizen: 'Admin contact can be only citizen'
|
||||||
admin_contacts:
|
admin_contacts:
|
||||||
out_of_range: 'Admin contacts count must be between %{min}-%{max}'
|
out_of_range: 'Admin contacts count must be between %{min}-%{max}'
|
||||||
less_than_or_equal_to: 'Admin contacts count must be less than or equal to %{count}'
|
less_than_or_equal_to: 'Admin contacts count must be less than or equal to %{count}'
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -888,6 +888,18 @@ describe 'EPP Domain', epp: true do
|
||||||
expect(Domain.count).to eq 0
|
expect(Domain.count).to eq 0
|
||||||
expect(DomainContact.count).to eq 0
|
expect(DomainContact.count).to eq 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'cannot assign juridical person as admin contact' do
|
||||||
|
xml = domain_create_xml({
|
||||||
|
_anonymus: [
|
||||||
|
{ contact: { value: 'jd1234', attrs: { type: 'admin' } } }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
response = epp_request(xml, :xml)
|
||||||
|
expect(response[:result_code]).to eq('2306')
|
||||||
|
expect(response[:msg]).to eq('Admin contact can be only citizen')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with valid domain' do
|
context 'with valid domain' do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue