Add registry lock operation to epp notification

This commit is contained in:
Karl Erik Õunapuu 2021-02-10 16:36:57 +02:00
parent 0bc86229e2
commit 7638bff546
No known key found for this signature in database
GPG key ID: C9DD647298A34764
2 changed files with 20 additions and 6 deletions

View file

@ -25,6 +25,10 @@ class Notification < ApplicationRecord
''
end
def registry_lock?
text.include?('has been locked') || text.include?('has been unlocked')
end
private
def set_defaults

View file

@ -15,13 +15,23 @@ xml.epp_head do
end if @object
end
if @notification.action&.contact
if @notification.action&.contact || @notification.registry_lock?
if @notification.registry_lock?
state = @notification.text.include?('unlocked') ? 'unlock' : 'lock'
xml.extension do
xml.tag!('changePoll:changeData',
'xmlns:changePoll': 'https://epp.tld.ee/schema/changePoll-1.0.xsd') do
xml.tag!('changePoll:operation', state)
end
end
else
render(partial: 'epp/poll/action',
locals: {
builder: xml,
action: @notification.action
action: @notification.action,
})
end
end
render('epp/shared/trID', builder: xml)
end