mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
Introduce request op to domain transfer #2746
This commit is contained in:
parent
6daf082129
commit
c4da9c86a6
5 changed files with 121 additions and 10 deletions
|
@ -179,7 +179,7 @@ class Epp::DomainsController < EppController
|
||||||
requires 'name'
|
requires 'name'
|
||||||
|
|
||||||
@prefix = nil
|
@prefix = nil
|
||||||
requires_attribute 'transfer', 'op', values: %(approve, query, reject)
|
requires_attribute 'transfer', 'op', values: %(approve, query, reject, request)
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_domain
|
def find_domain
|
||||||
|
|
|
@ -461,6 +461,8 @@ class Epp::Domain < Domain
|
||||||
def transfer(frame, action, current_user)
|
def transfer(frame, action, current_user)
|
||||||
case action
|
case action
|
||||||
when 'query'
|
when 'query'
|
||||||
|
return domain_transfers.last if domain_transfers.any?
|
||||||
|
when 'request'
|
||||||
return pending_transfer if pending_transfer
|
return pending_transfer if pending_transfer
|
||||||
return query_transfer(frame, current_user)
|
return query_transfer(frame, current_user)
|
||||||
when 'approve'
|
when 'approve'
|
||||||
|
@ -468,7 +470,7 @@ class Epp::Domain < Domain
|
||||||
when 'reject'
|
when 'reject'
|
||||||
return reject_transfer(frame, current_user) if pending_transfer
|
return reject_transfer(frame, current_user) if pending_transfer
|
||||||
end
|
end
|
||||||
add_epp_error('2303', nil, nil, I18n.t('pending_transfer_was_not_found'))
|
add_epp_error('2303', nil, nil, I18n.t('no_transfers_found'))
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO: Eager load problems here. Investigate how it's possible not to query contact again
|
# TODO: Eager load problems here. Investigate how it's possible not to query contact again
|
||||||
|
|
|
@ -866,3 +866,4 @@ en:
|
||||||
reserved_domains: 'Reserved domains'
|
reserved_domains: 'Reserved domains'
|
||||||
invalid_yaml: 'Invalid YAML'
|
invalid_yaml: 'Invalid YAML'
|
||||||
reserved_pw: 'Reserved pw'
|
reserved_pw: 'Reserved pw'
|
||||||
|
no_transfers_found: 'No transfers found'
|
||||||
|
|
|
@ -839,7 +839,7 @@ describe 'EPP Domain', epp: true do
|
||||||
xml = domain_transfer_xml({
|
xml = domain_transfer_xml({
|
||||||
name: { value: domain.name },
|
name: { value: domain.name },
|
||||||
authInfo: { pw: { value: pw } }
|
authInfo: { pw: { value: pw } }
|
||||||
}, 'query', {
|
}, 'request', {
|
||||||
_anonymus: [
|
_anonymus: [
|
||||||
legalDocument: {
|
legalDocument: {
|
||||||
value: 'dGVzdCBmYWlsCg==',
|
value: 'dGVzdCBmYWlsCg==',
|
||||||
|
@ -887,7 +887,7 @@ describe 'EPP Domain', epp: true do
|
||||||
xml = domain_transfer_xml({
|
xml = domain_transfer_xml({
|
||||||
name: { value: domain.name },
|
name: { value: domain.name },
|
||||||
authInfo: { pw: { value: pw } }
|
authInfo: { pw: { value: pw } }
|
||||||
}, 'query', {
|
}, 'request', {
|
||||||
_anonymus: [
|
_anonymus: [
|
||||||
legalDocument: {
|
legalDocument: {
|
||||||
value: 'dGVzdCBmYWlsCg==',
|
value: 'dGVzdCBmYWlsCg==',
|
||||||
|
@ -965,7 +965,7 @@ describe 'EPP Domain', epp: true do
|
||||||
xml = domain_transfer_xml({
|
xml = domain_transfer_xml({
|
||||||
name: { value: domain.name },
|
name: { value: domain.name },
|
||||||
authInfo: { pw: { value: pw } }
|
authInfo: { pw: { value: pw } }
|
||||||
}, 'query', {
|
}, 'request', {
|
||||||
_anonymus: [
|
_anonymus: [
|
||||||
legalDocument: {
|
legalDocument: {
|
||||||
value: 'dGVzdCBmYWlsCg==',
|
value: 'dGVzdCBmYWlsCg==',
|
||||||
|
@ -1401,7 +1401,7 @@ describe 'EPP Domain', epp: true do
|
||||||
xml = domain_transfer_xml({
|
xml = domain_transfer_xml({
|
||||||
name: { value: domain.name },
|
name: { value: domain.name },
|
||||||
authInfo: { pw: { value: 'test' } }
|
authInfo: { pw: { value: 'test' } }
|
||||||
}, 'query', {
|
}, 'request', {
|
||||||
_anonymus: [
|
_anonymus: [
|
||||||
legalDocument: {
|
legalDocument: {
|
||||||
value: 'dGVzdCBmYWlsCg==',
|
value: 'dGVzdCBmYWlsCg==',
|
||||||
|
@ -1415,12 +1415,12 @@ describe 'EPP Domain', epp: true do
|
||||||
response[:msg].should == 'Authorization error'
|
response[:msg].should == 'Authorization error'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'ignores transfer wha registrant registrar requests transfer' do
|
it 'ignores transfer when domain already belongs to registrar' do
|
||||||
pw = domain.auth_info
|
pw = domain.auth_info
|
||||||
xml = domain_transfer_xml({
|
xml = domain_transfer_xml({
|
||||||
name: { value: domain.name },
|
name: { value: domain.name },
|
||||||
authInfo: { pw: { value: pw } }
|
authInfo: { pw: { value: pw } }
|
||||||
}, 'query', {
|
}, 'request', {
|
||||||
_anonymus: [
|
_anonymus: [
|
||||||
legalDocument: {
|
legalDocument: {
|
||||||
value: 'dGVzdCBmYWlsCg==',
|
value: 'dGVzdCBmYWlsCg==',
|
||||||
|
@ -1446,7 +1446,7 @@ describe 'EPP Domain', epp: true do
|
||||||
xml = domain_transfer_xml({
|
xml = domain_transfer_xml({
|
||||||
name: { value: domain.name },
|
name: { value: domain.name },
|
||||||
authInfo: { pw: { value: pw } }
|
authInfo: { pw: { value: pw } }
|
||||||
}, 'query', {
|
}, 'request', {
|
||||||
_anonymus: [
|
_anonymus: [
|
||||||
legalDocument: {
|
legalDocument: {
|
||||||
value: 'dGVzdCBmYWlsCg==',
|
value: 'dGVzdCBmYWlsCg==',
|
||||||
|
@ -1482,6 +1482,114 @@ describe 'EPP Domain', epp: true do
|
||||||
response[:result_code].should == '2303'
|
response[:result_code].should == '2303'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should not return transfers when there are none' do
|
||||||
|
xml = domain_transfer_xml({
|
||||||
|
name: { value: domain.name },
|
||||||
|
authInfo: { pw: { value: domain.auth_info } }
|
||||||
|
}, 'query')
|
||||||
|
|
||||||
|
response = epp_plain_request(xml)
|
||||||
|
response[:results][0][:msg].should == 'No transfers found'
|
||||||
|
response[:results][0][:result_code].should == '2303'
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should allow querying domain transfer' do
|
||||||
|
Setting.transfer_wait_time = 1
|
||||||
|
pw = domain.auth_info
|
||||||
|
xml = domain_transfer_xml({
|
||||||
|
name: { value: domain.name },
|
||||||
|
authInfo: { pw: { value: pw } }
|
||||||
|
}, 'request', {
|
||||||
|
_anonymus: [
|
||||||
|
legalDocument: {
|
||||||
|
value: 'dGVzdCBmYWlsCg==',
|
||||||
|
attrs: { type: 'pdf' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
login_as :registrar2 do
|
||||||
|
response = epp_plain_request(xml)
|
||||||
|
response[:results][0][:msg].should == 'Command completed successfully'
|
||||||
|
response[:results][0][:result_code].should == '1000'
|
||||||
|
|
||||||
|
trn_data = response[:parsed].css('trnData')
|
||||||
|
|
||||||
|
dtl = domain.domain_transfers.last
|
||||||
|
|
||||||
|
trn_data.css('name').text.should == domain.name
|
||||||
|
trn_data.css('trStatus').text.should == 'pending'
|
||||||
|
trn_data.css('reID').text.should == 'REGDOMAIN2'
|
||||||
|
trn_data.css('reDate').text.should == dtl.transfer_requested_at.in_time_zone.utc.utc.iso8601
|
||||||
|
trn_data.css('acDate').text.should == dtl.wait_until.in_time_zone.utc.utc.iso8601
|
||||||
|
trn_data.css('acID').text.should == 'REGDOMAIN1'
|
||||||
|
trn_data.css('exDate').text.should == domain.valid_to.in_time_zone.utc.utc.iso8601
|
||||||
|
|
||||||
|
xml = domain_transfer_xml({
|
||||||
|
name: { value: domain.name },
|
||||||
|
authInfo: { pw: { value: pw } }
|
||||||
|
}, 'query')
|
||||||
|
|
||||||
|
response = epp_plain_request(xml)
|
||||||
|
response[:results][0][:msg].should == 'Command completed successfully'
|
||||||
|
response[:results][0][:result_code].should == '1000'
|
||||||
|
|
||||||
|
trn_data = response[:parsed].css('trnData')
|
||||||
|
|
||||||
|
dtl = domain.domain_transfers.last
|
||||||
|
trn_data.css('name').text.should == domain.name
|
||||||
|
trn_data.css('trStatus').text.should == 'pending'
|
||||||
|
trn_data.css('reID').text.should == 'REGDOMAIN2'
|
||||||
|
trn_data.css('reDate').text.should == dtl.transfer_requested_at.in_time_zone.utc.utc.iso8601
|
||||||
|
trn_data.css('acDate').text.should == dtl.wait_until.in_time_zone.utc.utc.iso8601
|
||||||
|
trn_data.css('acID').text.should == 'REGDOMAIN1'
|
||||||
|
trn_data.css('exDate').text.should == domain.valid_to.in_time_zone.utc.utc.iso8601
|
||||||
|
end
|
||||||
|
|
||||||
|
# approves pending transfer
|
||||||
|
xml = domain_transfer_xml({
|
||||||
|
name: { value: domain.name },
|
||||||
|
authInfo: { pw: { value: pw } }
|
||||||
|
}, 'approve', {
|
||||||
|
_anonymus: [
|
||||||
|
legalDocument: {
|
||||||
|
value: 'dGVzdCBmYWlsCg==',
|
||||||
|
attrs: { type: 'pdf' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
response = epp_plain_request(xml)
|
||||||
|
response[:results][0][:msg].should == 'Command completed successfully'
|
||||||
|
response[:results][0][:result_code].should == '1000'
|
||||||
|
|
||||||
|
# query should return last completed transfer
|
||||||
|
domain.reload
|
||||||
|
pw = domain.auth_info
|
||||||
|
xml = domain_transfer_xml({
|
||||||
|
name: { value: domain.name },
|
||||||
|
authInfo: { pw: { value: pw } }
|
||||||
|
}, 'query')
|
||||||
|
|
||||||
|
response = epp_plain_request(xml)
|
||||||
|
response[:results][0][:msg].should == 'Command completed successfully'
|
||||||
|
response[:results][0][:result_code].should == '1000'
|
||||||
|
|
||||||
|
trn_data = response[:parsed].css('trnData')
|
||||||
|
|
||||||
|
dtl = domain.domain_transfers.last
|
||||||
|
|
||||||
|
trn_data.css('name').text.should == domain.name
|
||||||
|
trn_data.css('trStatus').text.should == 'clientApproved'
|
||||||
|
trn_data.css('reID').text.should == 'REGDOMAIN2'
|
||||||
|
trn_data.css('reDate').text.should == dtl.transfer_requested_at.in_time_zone.utc.utc.iso8601
|
||||||
|
trn_data.css('acDate').text.should == dtl.transferred_at.in_time_zone.utc.utc.iso8601
|
||||||
|
trn_data.css('acID').text.should == 'REGDOMAIN1'
|
||||||
|
trn_data.css('exDate').text.should == domain.valid_to.in_time_zone.utc.utc.iso8601
|
||||||
|
|
||||||
|
Setting.transfer_wait_time = 0
|
||||||
|
end
|
||||||
|
|
||||||
### UPDATE ###
|
### UPDATE ###
|
||||||
it 'should update right away without update pending status' do
|
it 'should update right away without update pending status' do
|
||||||
existing_pw = domain.auth_info
|
existing_pw = domain.auth_info
|
||||||
|
|
|
@ -349,7 +349,7 @@ module Epp
|
||||||
epp_xml.check(xml_params)
|
epp_xml.check(xml_params)
|
||||||
end
|
end
|
||||||
|
|
||||||
def domain_transfer_xml(xml_params = {}, op = 'query', custom_params = {})
|
def domain_transfer_xml(xml_params = {}, op = 'request', custom_params = {})
|
||||||
defaults = {
|
defaults = {
|
||||||
name: { value: next_domain_name },
|
name: { value: next_domain_name },
|
||||||
authInfo: {
|
authInfo: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue