mirror of
https://github.com/internetee/registry.git
synced 2025-06-12 23:54:44 +02:00
Mode DomainDeleteConfirm job to interactor
This commit is contained in:
parent
fce16f924d
commit
a3e6bc4cf9
2 changed files with 23 additions and 17 deletions
|
@ -0,0 +1,22 @@
|
||||||
|
module DomainDeleteConfirmInteraction
|
||||||
|
class SendRequest < ActiveInteraction::Base
|
||||||
|
object :domain,
|
||||||
|
class: Domain,
|
||||||
|
description: 'Domain to send delete confirmation'
|
||||||
|
|
||||||
|
def execute
|
||||||
|
log
|
||||||
|
DomainDeleteMailer.confirmation_request(domain: domain,
|
||||||
|
registrar: domain.registrar,
|
||||||
|
registrant: domain.registrant).deliver_now
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def log
|
||||||
|
message = "Send DomainDeleteMailer#confirm email for domain #{domain.name} (##{domain.id})" \
|
||||||
|
" to #{domain.registrant.email}"
|
||||||
|
Rails.logger.info(message)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,22 +1,6 @@
|
||||||
class DomainDeleteConfirmEmailJob < Que::Job
|
class DomainDeleteConfirmEmailJob < Que::Job
|
||||||
def run(domain_id)
|
def run(domain_id)
|
||||||
domain = Domain.find(domain_id)
|
domain = Domain.find(domain_id)
|
||||||
|
DomainDeleteConfirmInteraction::SendRequest.run(domain: domain)
|
||||||
log(domain)
|
|
||||||
DomainDeleteMailer.confirmation_request(domain: domain,
|
|
||||||
registrar: domain.registrar,
|
|
||||||
registrant: domain.registrant).deliver_now
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def log(domain)
|
|
||||||
message = "Send DomainDeleteMailer#confirm email for domain #{domain.name} (##{domain.id})" \
|
|
||||||
" to #{domain.registrant.email}"
|
|
||||||
logger.info(message)
|
|
||||||
end
|
|
||||||
|
|
||||||
def logger
|
|
||||||
Rails.logger
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue