mirror of
https://github.com/internetee/registry.git
synced 2025-08-01 23:42:04 +02:00
Create domain renew action
This commit is contained in:
parent
454433cf10
commit
dcb55a1af9
2 changed files with 36 additions and 2 deletions
33
app/models/actions/domain_renew.rb
Normal file
33
app/models/actions/domain_renew.rb
Normal file
|
@ -0,0 +1,33 @@
|
|||
module Actions
|
||||
class DomainRenew
|
||||
attr_reader :domain
|
||||
attr_reader :params
|
||||
attr_reader :user
|
||||
|
||||
def initialize(domain, params, user)
|
||||
@domain = domain
|
||||
@params = params
|
||||
@user = user
|
||||
end
|
||||
|
||||
def call
|
||||
renew
|
||||
end
|
||||
|
||||
def renew
|
||||
period = params[:period]
|
||||
unit = params[:period_unit]
|
||||
|
||||
task = Domains::BulkRenew::SingleDomainRenew.run(domain: domain,
|
||||
period: params[:period],
|
||||
unit: params[:period_unit],
|
||||
registrar: user)
|
||||
|
||||
return true if task
|
||||
|
||||
puts task.errors
|
||||
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue