REPP: Add renew exp_date sanity check

This commit is contained in:
Karl Erik Õunapuu 2021-03-23 13:14:31 +02:00
parent 016c5e802c
commit 546330b178
No known key found for this signature in database
GPG key ID: C9DD647298A34764
7 changed files with 15 additions and 13 deletions

View file

@ -72,11 +72,11 @@ module Epp
def renew
authorize! :renew, @domain
return handle_errors(@domain) if invalid_expiry_date?
registrar_id = current_user.registrar.id
renew_params = ::Deserializers::Xml::Domain.new(params[:parsed_frame],
registrar_id).call
action = Actions::DomainRenew.new(@domain, renew_params, current_user.registrar)
if action.call
render_epp_response '/epp/domains/renew'
@ -228,11 +228,6 @@ 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