internetee-registry/app/models/registrant_verification.rb
Timo Võhmar 2fc4c9df14
Merge pull request #1770 from internetee/1769-move-domain-release-processing-to-interactor
Move domain delete confirm procedure to interactor
2020-12-16 16:46:42 +02:00

41 lines
1.3 KiB
Ruby

# Used in Registrant portal to collect registrant verifications
# Registrant postgres user can access this table directly.
class RegistrantVerification < ApplicationRecord
include Versions # version/domain_version.rb
# actions
CONFIRMED = 'confirmed'
REJECTED = 'rejected'
# action types
DOMAIN_REGISTRANT_CHANGE = 'domain_registrant_change'
DOMAIN_DELETE = 'domain_delete'
belongs_to :domain
validates :verification_token, :domain, :action, :action_type, presence: true
def domain_registrant_change_confirm!(initiator)
self.action_type = DOMAIN_REGISTRANT_CHANGE
self.action = CONFIRMED
DomainUpdateConfirmJob.perform_later domain.id, CONFIRMED, initiator if save
end
def domain_registrant_change_reject!(initiator)
self.action_type = DOMAIN_REGISTRANT_CHANGE
self.action = REJECTED
DomainUpdateConfirmJob.perform_later domain.id, REJECTED, initiator if save
end
def domain_registrant_delete_confirm!(initiator)
self.action_type = DOMAIN_DELETE
self.action = CONFIRMED
DomainDeleteConfirmJob.perform_later domain.id, CONFIRMED, initiator if save
end
def domain_registrant_delete_reject!(initiator)
self.action_type = DOMAIN_DELETE
self.action = REJECTED
DomainDeleteConfirmJob.perform_later domain.id, REJECTED, initiator if save
end
end