Fix some interaction calls

This commit is contained in:
Alex Sherman 2021-04-26 13:34:16 +05:00
parent 289d06e926
commit c6f0c3f6a7
9 changed files with 30 additions and 25 deletions

View file

@ -2,10 +2,10 @@ module Domains
module CancelForceDelete module CancelForceDelete
class CancelForceDelete < Base class CancelForceDelete < Base
def execute def execute
compose(RemoveForceDeleteStatuses, inputs) compose(RemoveForceDeleteStatuses, inputs.to_h)
compose(RestoreStatusesBeforeForceDelete, inputs) compose(RestoreStatusesBeforeForceDelete, inputs.to_h)
compose(ClearForceDeleteData, inputs) compose(ClearForceDeleteData, inputs.to_h)
compose(NotifyRegistrar, inputs) compose(NotifyRegistrar, inputs.to_h)
end end
end end
end end

View file

@ -6,7 +6,7 @@ module Domains
WhoisRecord.where(domain_id: domain.id).destroy_all WhoisRecord.where(domain_id: domain.id).destroy_all
domain.destroy domain.destroy
compose(Domains::Delete::NotifyRegistrar, inputs) Domains::Delete::NotifyRegistrar.run(inputs.to_h)
end end
end end
end end

View file

@ -7,9 +7,9 @@ module Domains
case action case action
when RegistrantVerification::CONFIRMED when RegistrantVerification::CONFIRMED
compose(ProcessDeleteConfirmed, inputs) compose(ProcessDeleteConfirmed, inputs.to_h)
when RegistrantVerification::REJECTED when RegistrantVerification::REJECTED
compose(ProcessDeleteRejected, inputs) compose(ProcessDeleteRejected, inputs.to_h)
end end
end end
end end

View file

@ -2,12 +2,12 @@ module Domains
module ForceDelete module ForceDelete
class SetForceDelete < Base class SetForceDelete < Base
def execute def execute
compose(CheckDiscarded, inputs) compose(CheckDiscarded, inputs.to_h)
compose(PrepareDomain, inputs) compose(PrepareDomain, inputs.to_h)
compose(SetStatus, inputs) compose(SetStatus, inputs.to_h)
compose(PostSetProcess, inputs) compose(PostSetProcess, inputs.to_h)
compose(NotifyRegistrar, inputs) compose(NotifyRegistrar, inputs.to_h)
compose(NotifyByEmail, inputs) compose(NotifyByEmail, inputs.to_h)
end end
end end
end end

View file

@ -7,9 +7,9 @@ module Domains
case action case action
when RegistrantVerification::CONFIRMED when RegistrantVerification::CONFIRMED
compose(ProcessUpdateConfirmed, inputs) Domains::UpdateConfirm::ProcessUpdateConfirmed.run(inputs.to_h)
when RegistrantVerification::REJECTED when RegistrantVerification::REJECTED
compose(ProcessUpdateRejected, inputs) Domains::UpdateConfirm::ProcessUpdateRejected.run(inputs.to_h)
end end
end end
end end

View file

@ -13,7 +13,7 @@ module Whois
Array(names).each do |name| Array(names).each do |name|
record = find_record(klass, name) record = find_record(klass, name)
if record if record
Whois::UpdateRecord.run(record: record, type: type) Whois::UpdateRecord.run(record: { klass: klass.to_s, id: record.id, type: type })
else else
Whois::DeleteRecord.run(name: name, type: type) Whois::DeleteRecord.run(name: name, type: type)
end end

View file

@ -1,12 +1,14 @@
module Whois module Whois
class UpdateRecord < ActiveInteraction::Base class UpdateRecord < ActiveInteraction::Base
interface :record hash :record do
string :type string :klass
integer :id
validates :type, inclusion: { in: %w[reserved blocked domain disputed zone] } string :type
end
def execute def execute
send "update_#{type}", record data = record['klass'].constantize.find_by(id: record['id'])
send "update_#{record['type']}", data
end end
def update_domain(domain) def update_domain(domain)

View file

@ -1,8 +1,11 @@
class DomainUpdateConfirmJob < ApplicationJob class DomainUpdateConfirmJob < ApplicationJob
def perform(domain_id, action, initiator = nil) def perform(domain_id, action, initiator = nil)
domain = Epp::Domain.find(domain_id) domain = Epp::Domain.find(domain_id)
Domains::UpdateConfirm::ProcessAction.run(domain: domain, attrs = {
action: action, domain: domain,
initiator: initiator) action: action,
initiator: initiator,
}
Domains::UpdateConfirm::ProcessAction.run(attrs)
end end
end end

View file

@ -56,7 +56,7 @@ class DisputeStatusUpdateJobTest < ActiveJob::TestCase
# Dispute status is added automatically if starts_at is not in future # Dispute status is added automatically if starts_at is not in future
perform_enqueued_jobs do perform_enqueued_jobs do
Dispute.create(domain_name: 'shop.test', starts_at: Time.zone.parse('2010-07-05')) Dispute.create(domain_name: 'shop.test', starts_at: Time.zone.today)
end end
domain.reload domain.reload