Registry lock: Notify Registrar by EPP notification

This commit is contained in:
Karl Erik Õunapuu 2021-02-09 16:27:15 +02:00
parent 5de0645d41
commit 66dfa730ec
No known key found for this signature in database
GPG key ID: C9DD647298A34764
3 changed files with 17 additions and 3 deletions

View file

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