Add interactor for renewal

This commit is contained in:
Alex Sherman 2020-12-10 17:03:07 +05:00
parent c0fc7ebca9
commit 7dd3005bf3
3 changed files with 18 additions and 3 deletions

View file

@ -13,7 +13,9 @@ class Registrar
@expire_date = params[:expire_date].to_date @expire_date = params[:expire_date].to_date
@domains = domains_by_date(@expire_date) @domains = domains_by_date(@expire_date)
if domain_ids_for_bulk_renew.present? if domain_ids_for_bulk_renew.present?
flash[:notice] = t(:bulk_renew_enqueued) domains = Epp::Domain.where(id: domain_ids_for_bulk_renew).to_a
task = Domains::BulkRenew::Start.run(domains: domains)
flash[:notice] = t(:bulk_renew_completed)
end end
render file: 'registrar/bulk_change/new', locals: { active_tab: :bulk_renew } render file: 'registrar/bulk_change/new', locals: { active_tab: :bulk_renew }
end end
@ -37,7 +39,7 @@ class Registrar
end end
def domain_ids_for_bulk_renew def domain_ids_for_bulk_renew
params.dig('domain_ids').reject{ |id| id.blank? } params.dig('domain_ids')&.reject{ |id| id.blank? }
end end
end end
end end

View file

@ -0,0 +1,13 @@
module Domains
module BulkRenew
class Start < ActiveInteraction::Base
array :domains do
object class: Epp::Domain
end
def execute
end
end
end
end

View file

@ -662,4 +662,4 @@ en:
iban: IBAN iban: IBAN
sign_in: "Sign in" sign_in: "Sign in"
signed_in_successfully: "Signed in successfully" signed_in_successfully: "Signed in successfully"
bulk_renew_enqueued: "Bulk renew for domains was enqueued" bulk_renew_completed: "Bulk renew for domains completed"