mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 12:47:29 +02:00
Registry lock: Notify Registrar by EPP notification
This commit is contained in:
parent
5de0645d41
commit
66dfa730ec
3 changed files with 17 additions and 3 deletions
|
@ -12,6 +12,7 @@ module Concerns
|
|||
statuses << DomainStatus::SERVER_DELETE_PROHIBITED
|
||||
statuses << DomainStatus::SERVER_TRANSFER_PROHIBITED
|
||||
self.locked_by_registrant_at = Time.zone.now
|
||||
alert_registrar_lock_changes!
|
||||
|
||||
save!
|
||||
end
|
||||
|
@ -42,10 +43,21 @@ module Concerns
|
|||
statuses.delete(DomainStatus::SERVER_DELETE_PROHIBITED)
|
||||
statuses.delete(DomainStatus::SERVER_TRANSFER_PROHIBITED)
|
||||
self.locked_by_registrant_at = nil
|
||||
alert_registrar_lock_changes!
|
||||
|
||||
save!
|
||||
end
|
||||
end
|
||||
|
||||
def alert_registrar_lock_changes!
|
||||
translation = locked_by_registrant? ? 'locked' : 'unlocked'
|
||||
registrar.notifications.create!(
|
||||
text: I18n.t("notifications.texts.registrar_#{translation}",
|
||||
domain_name: name),
|
||||
attached_obj_id: name,
|
||||
attached_obj_type: self.class.name
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,3 +6,5 @@ en:
|
|||
It was associated with registrant %{old_registrant_code}
|
||||
and contacts %{old_contacts_codes}.
|
||||
contact_update: Contact %{contact} has been updated by registrant
|
||||
registrar_locked: Domain %{domain_name} has been locked by registrant
|
||||
registrar_unlocked: Domain %{domain_name} has been unlocked by registrant
|
||||
|
|
|
@ -18,11 +18,11 @@ class DomainUpdateConfirmJobTest < ActiveSupport::TestCase
|
|||
super
|
||||
end
|
||||
|
||||
def test_registrant_locked_domain
|
||||
def test_registrant_locked_domain
|
||||
refute @domain.locked_by_registrant?
|
||||
@domain.apply_registry_lock
|
||||
assert @domain.locked_by_registrant?
|
||||
assert_equal(@domain.registrar.notifications.last.text, 'Domain has been locked by registrant')
|
||||
assert_equal(@domain.registrar.notifications.last.text, "Domain #{@domain.name} has been unlocked by registrant")
|
||||
end
|
||||
|
||||
def test_registrant_unlocked_domain
|
||||
|
@ -31,7 +31,7 @@ class DomainUpdateConfirmJobTest < ActiveSupport::TestCase
|
|||
assert @domain.locked_by_registrant?
|
||||
@domain.remove_registry_lock
|
||||
refute @domain.locked_by_registrant?
|
||||
assert_equal(@domain.registrar.notifications.last.text, 'Domain has been unlocked by registrant')
|
||||
assert_equal(@domain.registrar.notifications.last.text, "Domain #{@domain.name} has been unlocked by registrant")
|
||||
end
|
||||
|
||||
def test_rejected_registrant_verification_notifies_registrar
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue