Improve epp domain renew

This commit is contained in:
Martin Lensment 2014-11-03 16:17:12 +02:00
parent fed8c94884
commit e65e6cfbd2
2 changed files with 11 additions and 3 deletions

View file

@ -31,7 +31,11 @@ module Epp::DomainsHelper
@domain = find_domain @domain = find_domain
handle_errors(@domain) and return unless @domain handle_errors(@domain) and return unless @domain
handle_errors(@domain) and return unless @domain.renew(@ph[:curExpDate], @ph[:period]) handle_errors(@domain) and return unless @domain.renew(
parsed_frame.css('curExpDate').text,
parsed_frame.css('period').text,
parsed_frame.css('period').first['unit']
)
render '/epp/domains/renew' render '/epp/domains/renew'
end end

View file

@ -268,7 +268,6 @@ class Epp::EppDomain < Domain
return false if errors.any? return false if errors.any?
p = self.class.convert_period_to_time(period, unit) p = self.class.convert_period_to_time(period, unit)
self.valid_to = valid_to + p self.valid_to = valid_to + p
self.period = period self.period = period
self.period_unit = unit self.period_unit = unit
@ -341,7 +340,12 @@ class Epp::EppDomain < Domain
### VALIDATIONS ### ### VALIDATIONS ###
def validate_exp_dates(cur_exp_date) def validate_exp_dates(cur_exp_date)
begin
return if cur_exp_date.to_date == valid_to return if cur_exp_date.to_date == valid_to
rescue
add_epp_error('2306', 'curExpDate', cur_exp_date, I18n.t('errors.messages.epp_exp_dates_do_not_match'))
return
end
add_epp_error('2306', 'curExpDate', cur_exp_date, I18n.t('errors.messages.epp_exp_dates_do_not_match')) add_epp_error('2306', 'curExpDate', cur_exp_date, I18n.t('errors.messages.epp_exp_dates_do_not_match'))
end end