diff --git a/app/controllers/epp/contacts_controller.rb b/app/controllers/epp/contacts_controller.rb index 32b2050ca..b6a26a626 100644 --- a/app/controllers/epp/contacts_controller.rb +++ b/app/controllers/epp/contacts_controller.rb @@ -76,6 +76,12 @@ module Epp handle_errors end + def transfer + authorize! :transfer, Epp::Contact + epp_errors << { code: '2101', msg: t(:'errors.messages.unimplemented_command') } + handle_errors + end + private def find_password diff --git a/app/models/ability.rb b/app/models/ability.rb index 706d85180..3eab0569a 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -64,6 +64,7 @@ class Ability can(:update, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || c.auth_info == pw } can(:delete, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || c.auth_info == pw } can(:renew, Epp::Contact) + can(:transfer, Epp::Contact) can(:view_password, Epp::Contact) { |c, pw| c.registrar_id == @user.registrar_id || c.auth_info == pw } end diff --git a/app/models/epp/response/result/code.rb b/app/models/epp/response/result/code.rb index 403f67435..2a65f6747 100644 --- a/app/models/epp/response/result/code.rb +++ b/app/models/epp/response/result/code.rb @@ -16,6 +16,7 @@ module Epp required_parameter_missing: 2003, parameter_value_range_error: 2004, parameter_value_syntax_error: 2005, + unimplemented: 2101, billing_failure: 2104, object_is_not_eligible_for_renewal: 2105, object_is_not_eligible_for_transfer: 2106, @@ -43,6 +44,7 @@ module Epp 2003 => 'Required parameter missing', 2004 => 'Parameter value range error', 2005 => 'Parameter value syntax error', + 2101 => 'Unimplemented command', 2104 => 'Billing failure', 2105 => 'Object is not eligible for renewal', 2106 => 'Object is not eligible for transfer', diff --git a/test/integration/epp/contact/transfer/base_test.rb b/test/integration/epp/contact/transfer/base_test.rb new file mode 100644 index 000000000..e76fce5e4 --- /dev/null +++ b/test/integration/epp/contact/transfer/base_test.rb @@ -0,0 +1,23 @@ +require 'test_helper' + +class EppContactTransferBaseTest < EppTestCase + # https://github.com/internetee/registry/issues/676 + def test_not_implemented + request_xml = <<-XML + + + + + + any + + + + + XML + + post epp_transfer_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + + assert_epp_response :unimplemented + end +end diff --git a/test/models/epp/response/result/code_test.rb b/test/models/epp/response/result/code_test.rb index 556ff17ef..3c75303f1 100644 --- a/test/models/epp/response/result/code_test.rb +++ b/test/models/epp/response/result/code_test.rb @@ -38,6 +38,7 @@ class EppResponseResultCodeTest < ActiveSupport::TestCase parameter_value_range_error: 2004, parameter_value_syntax_error: 2005, billing_failure: 2104, + unimplemented: 2101, object_is_not_eligible_for_renewal: 2105, object_is_not_eligible_for_transfer: 2106, authorization_error: 2201, @@ -66,6 +67,7 @@ class EppResponseResultCodeTest < ActiveSupport::TestCase 2003 => 'Required parameter missing', 2004 => 'Parameter value range error', 2005 => 'Parameter value syntax error', + 2101 => 'Unimplemented command', 2104 => 'Billing failure', 2105 => 'Object is not eligible for renewal', 2106 => 'Object is not eligible for transfer',