mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 20:55:44 +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
|
||||
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
|
||||
renew_params = ::Deserializers::Xml::Domain.new(params[:parsed_frame],
|
||||
|
@ -228,6 +228,11 @@ module Epp
|
|||
statuses == [::DomainStatus::CLIENT_HOLD]
|
||||
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)
|
||||
@domain_pricelist = @domain.pricelist(operation, period.try(:to_i), unit)
|
||||
if @domain_pricelist.try(:price) # checking if price list is not found
|
||||
|
|
|
@ -9,6 +9,7 @@ module Domains
|
|||
|
||||
def execute
|
||||
in_transaction_with_retries do
|
||||
check_balance
|
||||
success = domain.renew(domain.valid_to, period, unit)
|
||||
if success
|
||||
check_balance
|
||||
|
|
|
@ -15,6 +15,11 @@ module Actions
|
|||
end
|
||||
|
||||
def renew
|
||||
if !domain.renewable? || domain.invalid?
|
||||
domain.add_renew_epp_errors
|
||||
return
|
||||
end
|
||||
|
||||
task = Domains::BulkRenew::SingleDomainRenew.run(domain: domain,
|
||||
period: params[:period],
|
||||
unit: params[:period_unit],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue