Add i18n, change error response code to 2304

This commit is contained in:
Alex Sherman 2021-02-15 19:46:16 +05:00
parent 340e1820f2
commit b9d57be6ab
4 changed files with 7 additions and 5 deletions

View file

@ -20,7 +20,7 @@ module Actions
end end
if contact.delete_prohibited? if contact.delete_prohibited?
contact.errors.add(:status, :delete_prohibited) contact.errors.add(:statuses, :delete_prohibited)
return return
end end

View file

@ -82,9 +82,11 @@ class Epp::Contact < Contact
'2302' => [ # Object exists '2302' => [ # Object exists
[:code, :epp_id_taken] [:code, :epp_id_taken]
], ],
'2304' => [ # Status prohibits operation
[:statuses, :delete_prohibited],
],
'2305' => [ # Association exists '2305' => [ # Association exists
[:domains, :exist], [:domains, :exist],
[:domains, :delete_prohibited],
] ]
} }
end end

View file

@ -25,10 +25,10 @@ en:
email_regex_check_error: Invalid format email_regex_check_error: Invalid format
domains: domains:
exist: 'Object association prohibits operation' exist: 'Object association prohibits operation'
status:
delete_prohibited: Contact delete prohibited by status delete_prohibited: Contact delete prohibited by status
statuses: statuses:
not_uniq: 'not uniq' not_uniq: 'not uniq'
delete_prohibited: Contact delete prohibited by status
country_code: country_code:
invalid: Country code is not valid, should be in ISO_3166-1 alpha 2 format (%{value}) invalid: Country code is not valid, should be in ISO_3166-1 alpha 2 format (%{value})
disclosed_attributes: disclosed_attributes:

View file

@ -51,7 +51,7 @@ class EppContactDeleteBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert Contact.exists?(id: contact.id) assert Contact.exists?(id: contact.id)
assert_epp_response :object_association_prohibits_operation assert_epp_response :object_status_prohibits_operation
end end
def test_delete_contact_with_client_delete_prohibited def test_delete_contact_with_client_delete_prohibited
@ -78,7 +78,7 @@ class EppContactDeleteBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
assert Contact.exists?(id: contact.id) assert Contact.exists?(id: contact.id)
assert_epp_response :object_association_prohibits_operation assert_epp_response :object_status_prohibits_operation
end end
def test_undeletable_cannot_be_deleted def test_undeletable_cannot_be_deleted