Change EPP response code according to its specification

Fixes #718
This commit is contained in:
Artur Beljajev 2019-09-13 21:29:49 +03:00
parent 03c81c4c5d
commit 79d9c631f5
6 changed files with 25 additions and 17 deletions

View file

@ -450,7 +450,12 @@ class Epp::Domain < Domain
def update(frame, current_user, verify = true)
return super if frame.blank?
check_discarded
if discarded?
throw :epp_error, {
code: '2304',
msg: 'Object status prohibits operation',
}
end
at = {}.with_indifferent_access
at.deep_merge!(attrs_from(frame.css('chg'), current_user, 'chg'))
@ -525,7 +530,12 @@ class Epp::Domain < Domain
end
def epp_destroy(frame, user_id)
check_discarded
if discarded?
throw :epp_error, {
code: '2304',
msg: 'Object status prohibits operation',
}
end
if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame))
frame.css("legalDocument").first.content = doc.path if doc&.persisted?
@ -590,7 +600,12 @@ class Epp::Domain < Domain
### TRANSFER ###
def transfer(frame, action, current_user)
check_discarded
if discarded?
throw :epp_error, {
code: '2106',
msg: 'Object is not eligible for transfer',
}
end
@is_transfer = true
@ -814,15 +829,4 @@ class Epp::Domain < Domain
result
end
end
private
def check_discarded
if discarded?
throw :epp_error, {
code: '2105',
msg: I18n.t(:object_is_not_eligible_for_renewal),
}
end
end
end