mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 13:15:40 +02:00
Fix domain renew porting to actions
This commit is contained in:
parent
9a7827107f
commit
988af6c91c
3 changed files with 12 additions and 1 deletions
|
@ -72,7 +72,7 @@ module Epp
|
||||||
|
|
||||||
def renew
|
def renew
|
||||||
authorize! :renew, @domain
|
authorize! :renew, @domain
|
||||||
@domain.validate_exp_dates(params[:parsed_frame].css('curExpDate').text)
|
return handle_errors(@domain) if invalid_expiry_date?
|
||||||
|
|
||||||
registrar_id = current_user.registrar.id
|
registrar_id = current_user.registrar.id
|
||||||
renew_params = ::Deserializers::Xml::Domain.new(params[:parsed_frame],
|
renew_params = ::Deserializers::Xml::Domain.new(params[:parsed_frame],
|
||||||
|
@ -228,6 +228,11 @@ module Epp
|
||||||
statuses == [::DomainStatus::CLIENT_HOLD]
|
statuses == [::DomainStatus::CLIENT_HOLD]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def invalid_expiry_date?
|
||||||
|
@domain.validate_exp_dates(params[:parsed_frame].css('curExpDate').text)
|
||||||
|
@domain.errors[:epp_errors].any?
|
||||||
|
end
|
||||||
|
|
||||||
def balance_ok?(operation, period = nil, unit = nil)
|
def balance_ok?(operation, period = nil, unit = nil)
|
||||||
@domain_pricelist = @domain.pricelist(operation, period.try(:to_i), unit)
|
@domain_pricelist = @domain.pricelist(operation, period.try(:to_i), unit)
|
||||||
if @domain_pricelist.try(:price) # checking if price list is not found
|
if @domain_pricelist.try(:price) # checking if price list is not found
|
||||||
|
|
|
@ -9,6 +9,7 @@ module Domains
|
||||||
|
|
||||||
def execute
|
def execute
|
||||||
in_transaction_with_retries do
|
in_transaction_with_retries do
|
||||||
|
check_balance
|
||||||
success = domain.renew(domain.valid_to, period, unit)
|
success = domain.renew(domain.valid_to, period, unit)
|
||||||
if success
|
if success
|
||||||
check_balance
|
check_balance
|
||||||
|
|
|
@ -15,6 +15,11 @@ module Actions
|
||||||
end
|
end
|
||||||
|
|
||||||
def renew
|
def renew
|
||||||
|
if !domain.renewable? || domain.invalid?
|
||||||
|
domain.add_renew_epp_errors
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
task = Domains::BulkRenew::SingleDomainRenew.run(domain: domain,
|
task = Domains::BulkRenew::SingleDomainRenew.run(domain: domain,
|
||||||
period: params[:period],
|
period: params[:period],
|
||||||
unit: params[:period_unit],
|
unit: params[:period_unit],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue