Skip to content

Commit

Permalink
Fix some interaction callings
Browse files Browse the repository at this point in the history
  • Loading branch information
yulgolem committed Apr 26, 2021
1 parent 289d06e commit b84d385
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/interactions/domains/delete/do_delete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def execute
WhoisRecord.where(domain_id: domain.id).destroy_all

domain.destroy
compose(Domains::Delete::NotifyRegistrar, inputs)
Domains::Delete::NotifyRegistrar.run(inputs.to_h)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/interactions/domains/update_confirm/process_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ def execute

case action
when RegistrantVerification::CONFIRMED
compose(ProcessUpdateConfirmed, inputs)
Domains::UpdateConfirm::ProcessUpdateConfirmed.run(inputs.to_h)
when RegistrantVerification::REJECTED
compose(ProcessUpdateRejected, inputs)
Domains::UpdateConfirm::ProcessUpdateRejected.run(inputs.to_h)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/interactions/whois/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def execute
Array(names).each do |name|
record = find_record(klass, name)
if record
Whois::UpdateRecord.run(record: record, type: type)
Whois::UpdateRecord.run(record: { klass: klass.to_s, id: record.id, type: type })
else
Whois::DeleteRecord.run(name: name, type: type)
end
Expand Down
12 changes: 7 additions & 5 deletions app/interactions/whois/update_record.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
module Whois
class UpdateRecord < ActiveInteraction::Base
interface :record
string :type

validates :type, inclusion: { in: %w[reserved blocked domain disputed zone] }
hash :record do
string :klass
integer :id
string :type
end

def execute
send "update_#{type}", record
data = record['klass'].constantize.find_by(id: record['id'])
send "update_#{record['type']}", data
end

def update_domain(domain)
Expand Down
9 changes: 6 additions & 3 deletions app/jobs/domain_update_confirm_job.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
class DomainUpdateConfirmJob < ApplicationJob
def perform(domain_id, action, initiator = nil)
domain = Epp::Domain.find(domain_id)
Domains::UpdateConfirm::ProcessAction.run(domain: domain,
action: action,
initiator: initiator)
attrs = {
domain: domain,
action: action,
initiator: initiator
}
Domains::UpdateConfirm::ProcessAction.run(attrs)
end
end
2 changes: 1 addition & 1 deletion test/jobs/dispute_status_update_job_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_registered_domain_whois_data_is_removed

# Dispute status is added automatically if starts_at is not in future
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
domain.reload

Expand Down

0 comments on commit b84d385

Please sign in to comment.