mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 05:26:17 +02:00
Make admin contacts optional for private registrants
This change makes admin contacts optional for private registrants while keeping them mandatory for organizations. The changes include: - Updated Domain model validations to make admin and tech contacts optional (min=0) for private registrants - Added validation rules methods to handle different requirements based on registrant type - Modified EPP domain creation to support domains without admin contacts for private registrants - Updated attach_default_contacts to skip adding contacts for private registrants - Added comprehensive test coverage for: - Domain model validations with private/org registrants - EPP domain creation without admin contacts for private registrants - REPP API contact management for private registrants This implements the requirement to make admin contacts optional for private registrations of .ee domains while maintaining the existing validation rules for organizations.
This commit is contained in:
parent
bfe2a10889
commit
3c169bb00b
5 changed files with 173 additions and 8 deletions
|
@ -108,9 +108,32 @@ class ReppV1DomainsContactsTest < ActionDispatch::IntegrationTest
|
|||
refute @domain.tech_contacts.find_by(code: contact.code).present?
|
||||
end
|
||||
|
||||
def test_can_remove_all_admin_contacts_for_private_registrant
|
||||
Spy.on_instance_method(Actions::DomainUpdate, :validate_email).and_return(true)
|
||||
|
||||
@domain.registrant.update!(ident_type: 'priv')
|
||||
@domain.reload
|
||||
assert_not @domain.registrant.org?
|
||||
|
||||
contact = @domain.admin_contacts.last
|
||||
|
||||
payload = { contacts: [ { code: contact.code, type: 'admin' } ] }
|
||||
delete "/repp/v1/domains/#{@domain.name}/contacts", headers: @auth_headers, params: payload
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
@domain.reload
|
||||
assert_response :ok
|
||||
assert_equal 1000, json[:code]
|
||||
|
||||
assert_empty @domain.admin_contacts
|
||||
end
|
||||
|
||||
def test_can_not_remove_one_and_only_contact
|
||||
Spy.on_instance_method(Actions::DomainUpdate, :validate_email).and_return(true)
|
||||
|
||||
@domain.registrant.update!(ident_type: 'org')
|
||||
@domain.reload
|
||||
|
||||
contact = @domain.admin_contacts.last
|
||||
|
||||
payload = { contacts: [ { code: contact.code, type: 'admin' } ] }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue