Merge pull request #1363 from internetee/handle-epp-contact-transfer

Handle EPP contact:transfer
This commit is contained in:
Timo Võhmar 2019-10-17 09:55:12 +03:00 committed by GitHub
commit 8b3b8a38c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 0 deletions

View file

@ -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

View file

@ -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

View file

@ -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',

View file

@ -0,0 +1,23 @@
require 'test_helper'
class EppContactTransferBaseTest < EppTestCase
# https://github.com/internetee/registry/issues/676
def test_not_implemented
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
<command>
<transfer op="request">
<contact:transfer xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
<contact:id>any</contact:id>
</contact:transfer>
</transfer>
</command>
</epp>
XML
post epp_transfer_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
assert_epp_response :unimplemented
end
end

View file

@ -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',