mirror of
https://github.com/internetee/registry.git
synced 2025-07-27 04:58:29 +02:00
Merge branch 'master' of github.com:domify/registry into domains-nested-refactor
This commit is contained in:
commit
2c35617745
15 changed files with 226 additions and 92 deletions
|
@ -81,3 +81,7 @@ Style/CommentIndentation:
|
|||
# It did not alayws suggested good format
|
||||
Style/AlignParameters:
|
||||
Enabled: false
|
||||
|
||||
# No need fancy style of numbers such as 1_000_000
|
||||
Style/NumericLiterals:
|
||||
Enabled: false
|
||||
|
|
|
@ -9,7 +9,7 @@ group :red_green_refactor, halt_on_fail: true do
|
|||
# watch(%r{^(config|lib)/.*})
|
||||
# end
|
||||
|
||||
guard :rspec, cmd: 'spring rspec', notification: false do
|
||||
guard :rspec, cmd: 'spring rspec --fail-fast', notification: false do
|
||||
watch(%r{^spec/.+_spec\.rb$})
|
||||
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
||||
watch('spec/spec_helper.rb') { "spec" }
|
||||
|
|
|
@ -90,7 +90,7 @@ class Epp::ContactsController < EppController
|
|||
@prefix = 'create > create >'
|
||||
requires(
|
||||
'postalInfo > name', 'postalInfo > addr > city',
|
||||
'postalInfo > addr > cc', 'ident', 'voice', 'email'
|
||||
'postalInfo > addr > cc', 'voice', 'email'
|
||||
)
|
||||
ident = params[:parsed_frame].css('ident')
|
||||
if ident.present? && ident.text != 'birthday' && ident.attr('cc').blank?
|
||||
|
@ -99,8 +99,9 @@ class Epp::ContactsController < EppController
|
|||
msg: I18n.t('errors.messages.required_attribute_missing', key: 'ident country code missing')
|
||||
}
|
||||
end
|
||||
contact_org_disabled
|
||||
@prefix = nil
|
||||
requires 'extension > extdata > legalDocument'
|
||||
requires 'extension > extdata > ident'
|
||||
end
|
||||
|
||||
def validate_update
|
||||
|
@ -111,15 +112,23 @@ class Epp::ContactsController < EppController
|
|||
msg: I18n.t('errors.messages.required_parameter_missing', key: 'add, rem or chg')
|
||||
}
|
||||
end
|
||||
contact_org_disabled
|
||||
requires 'id', 'authInfo > pw'
|
||||
@prefix = nil
|
||||
requires 'extension > extdata > legalDocument'
|
||||
end
|
||||
|
||||
def validate_delete
|
||||
@prefix = 'delete > delete >'
|
||||
requires 'id', 'authInfo > pw'
|
||||
@prefix = nil
|
||||
requires 'extension > extdata > legalDocument'
|
||||
end
|
||||
|
||||
def contact_org_disabled
|
||||
return true if ENV['contact_org_enabled'] == 'true'
|
||||
return true if params[:parsed_frame].css('postalInfo org').text.blank?
|
||||
epp_errors << {
|
||||
code: '2306',
|
||||
msg: "#{I18n.t(:contact_org_error)}: postalInfo > org [org]"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,51 +4,70 @@ class ContactStatus < ActiveRecord::Base
|
|||
|
||||
belongs_to :contact
|
||||
|
||||
# Requests to delete the object MUST be rejected.
|
||||
CLIENT_DELETE_PROHIBITED = 'clientDeleteProhibited'
|
||||
SERVER_DELETE_PROHIBITED = 'serverDeleteProhibited'
|
||||
CLIENT_HOLD = 'clientHold'
|
||||
SERVER_HOLD = 'serverHold'
|
||||
CLIENT_RENEW_PROHIBITED = 'clientRenewProhibited'
|
||||
SERVER_RENEW_PROHIBITED = 'serverRenewProhibited'
|
||||
|
||||
# Requests to transfer the object MUST be rejected.
|
||||
CLIENT_TRANSFER_PROHIBITED = 'clientTransferProhibited'
|
||||
SERVER_TRANSFER_PROHIBITED = 'serverTransferProhibited'
|
||||
|
||||
# The contact object has at least one active association with
|
||||
# another object, such as a domain object. Servers SHOULD provide
|
||||
# services to determine existing object associations.
|
||||
# "linked" status MAY be combined with any status.
|
||||
LINKED = 'linked'
|
||||
|
||||
# This is the normal status value for an object that has no pending
|
||||
# operations or prohibitions. This value is set and removed by the
|
||||
# server as other status values are added or removed.
|
||||
# "ok" status MAY only be combined with "linked" status.
|
||||
OK = 'ok'
|
||||
|
||||
# Requests to update the object (other than to remove this status) MUST be rejected.
|
||||
CLIENT_UPDATE_PROHIBITED = 'clientUpdateProhibited'
|
||||
SERVER_UPDATE_PROHIBITED = 'serverUpdateProhibited'
|
||||
INACTIVE = 'inactive'
|
||||
OK = 'ok'
|
||||
PENDING_CREATE = 'pendingCreate'
|
||||
PENDING_DELETE = 'pendingDelete'
|
||||
PENDING_RENEW = 'pendingRenew'
|
||||
PENDING_TRANSFER = 'pendingTransfer'
|
||||
PENDING_UPDATE = 'pendingUpdate'
|
||||
|
||||
SERVER_MANUAL_INZONE = 'serverManualInzone'
|
||||
SERVER_REGISTRANT_CHANGE_PROHIBITED = 'serverRegistrantChangeProhibited'
|
||||
SERVER_ADMIN_CHANGE_PROHIBITED = 'serverAdminChangeProhibited'
|
||||
SERVER_TECH_CHANGE_PROHIBITED = 'serverTechChangeProhibited'
|
||||
FORCE_DELETE = 'forceDelete'
|
||||
DELETE_CANDIDATE = 'deleteCandidate'
|
||||
EXPIRED = 'expired'
|
||||
# A transform command has been processed for the object, but the
|
||||
# action has not been completed by the server. Server operators can
|
||||
# delay action completion for a variety of reasons, such as to allow
|
||||
# for human review or third-party action. A transform command that
|
||||
# is processed, but whose requested action is pending, is noted with
|
||||
# response code 1001.
|
||||
# When the requested action has been completed, the pendingCreate,
|
||||
# pendingDelete, pendingTransfer, or pendingUpdate status value MUST be
|
||||
# removed. All clients involved in the transaction MUST be notified
|
||||
# using a service message that the action has been completed and that
|
||||
# the status of the object has changed.
|
||||
# The pendingCreate, pendingDelete, pendingTransfer, and pendingUpdate
|
||||
# status values MUST NOT be combined with each other.
|
||||
PENDING_CREATE = 'pendingCreate'
|
||||
# "pendingTransfer" status MUST NOT be combined with either
|
||||
# "clientTransferProhibited" or "serverTransferProhibited" status.
|
||||
PENDING_TRANSFER = 'pendingTransfer'
|
||||
# "pendingUpdate" status MUST NOT be combined with either
|
||||
# "clientUpdateProhibited" or "serverUpdateProhibited" status.
|
||||
PENDING_UPDATE = 'pendingUpdate'
|
||||
# "pendingDelete" MUST NOT be combined with either
|
||||
# "clientDeleteProhibited" or "serverDeleteProhibited" status.
|
||||
PENDING_DELETE = 'pendingDelete'
|
||||
|
||||
STATUSES = [
|
||||
CLIENT_DELETE_PROHIBITED, SERVER_DELETE_PROHIBITED, CLIENT_HOLD, SERVER_HOLD,
|
||||
CLIENT_RENEW_PROHIBITED, SERVER_RENEW_PROHIBITED, CLIENT_TRANSFER_PROHIBITED,
|
||||
CLIENT_DELETE_PROHIBITED, SERVER_DELETE_PROHIBITED,
|
||||
CLIENT_TRANSFER_PROHIBITED,
|
||||
SERVER_TRANSFER_PROHIBITED, CLIENT_UPDATE_PROHIBITED, SERVER_UPDATE_PROHIBITED,
|
||||
INACTIVE, OK, PENDING_CREATE, PENDING_DELETE, PENDING_RENEW, PENDING_TRANSFER,
|
||||
PENDING_UPDATE, SERVER_MANUAL_INZONE, SERVER_REGISTRANT_CHANGE_PROHIBITED,
|
||||
SERVER_ADMIN_CHANGE_PROHIBITED, SERVER_TECH_CHANGE_PROHIBITED, FORCE_DELETE,
|
||||
DELETE_CANDIDATE, EXPIRED
|
||||
OK, PENDING_CREATE, PENDING_DELETE, PENDING_TRANSFER,
|
||||
PENDING_UPDATE, LINKED
|
||||
]
|
||||
|
||||
CLIENT_STATUSES = [
|
||||
CLIENT_DELETE_PROHIBITED, CLIENT_HOLD, CLIENT_RENEW_PROHIBITED, CLIENT_TRANSFER_PROHIBITED,
|
||||
CLIENT_DELETE_PROHIBITED, CLIENT_TRANSFER_PROHIBITED,
|
||||
CLIENT_UPDATE_PROHIBITED
|
||||
]
|
||||
|
||||
SERVER_STATUSES = [
|
||||
SERVER_DELETE_PROHIBITED, SERVER_HOLD, SERVER_RENEW_PROHIBITED, SERVER_TRANSFER_PROHIBITED,
|
||||
SERVER_UPDATE_PROHIBITED, SERVER_MANUAL_INZONE, SERVER_REGISTRANT_CHANGE_PROHIBITED,
|
||||
SERVER_ADMIN_CHANGE_PROHIBITED, SERVER_TECH_CHANGE_PROHIBITED
|
||||
SERVER_DELETE_PROHIBITED, SERVER_TRANSFER_PROHIBITED,
|
||||
SERVER_UPDATE_PROHIBITED
|
||||
]
|
||||
|
||||
def epp_code_map
|
||||
|
|
|
@ -4,22 +4,64 @@ class DomainStatus < ActiveRecord::Base
|
|||
|
||||
belongs_to :domain
|
||||
|
||||
# Requests to delete the object MUST be rejected.
|
||||
CLIENT_DELETE_PROHIBITED = 'clientDeleteProhibited'
|
||||
SERVER_DELETE_PROHIBITED = 'serverDeleteProhibited'
|
||||
|
||||
# DNS delegation information MUST NOT be published for the object.
|
||||
CLIENT_HOLD = 'clientHold'
|
||||
SERVER_HOLD = 'serverHold'
|
||||
|
||||
# Requests to renew the object MUST be rejected.
|
||||
CLIENT_RENEW_PROHIBITED = 'clientRenewProhibited'
|
||||
SERVER_RENEW_PROHIBITED = 'serverRenewProhibited'
|
||||
|
||||
# Requests to transfer the object MUST be rejected.
|
||||
CLIENT_TRANSFER_PROHIBITED = 'clientTransferProhibited'
|
||||
SERVER_TRANSFER_PROHIBITED = 'serverTransferProhibited'
|
||||
|
||||
# Requests to update the object (other than to remove this status) MUST be rejected.
|
||||
CLIENT_UPDATE_PROHIBITED = 'clientUpdateProhibited'
|
||||
SERVER_UPDATE_PROHIBITED = 'serverUpdateProhibited'
|
||||
|
||||
# Delegation information has not been associated with the object.
|
||||
# This is the default status when a domain object is first created
|
||||
# and there are no associated host objects for the DNS delegation.
|
||||
# This status can also be set by the server when all host-object
|
||||
# associations are removed.
|
||||
INACTIVE = 'inactive'
|
||||
|
||||
# This is the normal status value for an object that has no pending
|
||||
# operations or prohibitions. This value is set and removed by the
|
||||
# server as other status values are added or removed.
|
||||
# "ok" status MUST NOT be combined with any other status.
|
||||
OK = 'ok'
|
||||
|
||||
# A transform command has been processed for the object, but the
|
||||
# action has not been completed by the server. Server operators can
|
||||
# delay action completion for a variety of reasons, such as to allow
|
||||
# for human review or third-party action. A transform command that
|
||||
# is processed, but whose requested action is pending, is noted with
|
||||
# response code 1001.
|
||||
# When the requested action has been completed, the pendingCreate,
|
||||
# pendingDelete, pendingRenew, pendingTransfer, or pendingUpdate status
|
||||
# value MUST be removed. All clients involved in the transaction MUST
|
||||
# be notified using a service message that the action has been
|
||||
# completed and that the status of the object has changed.
|
||||
# The pendingCreate, pendingDelete, pendingRenew, pendingTransfer, and
|
||||
# pendingUpdate status values MUST NOT be combined with each other.
|
||||
PENDING_CREATE = 'pendingCreate'
|
||||
# "pendingDelete" status MUST NOT be combined with either
|
||||
# "clientDeleteProhibited" or "serverDeleteProhibited" status.
|
||||
PENDING_DELETE = 'pendingDelete'
|
||||
# "pendingRenew" status MUST NOT be combined with either
|
||||
# "clientRenewProhibited" or "serverRenewProhibited" status.
|
||||
PENDING_RENEW = 'pendingRenew'
|
||||
# "pendingTransfer" status MUST NOT be combined with either
|
||||
# "clientTransferProhibited" or "serverTransferProhibited" status.
|
||||
PENDING_TRANSFER = 'pendingTransfer'
|
||||
# "pendingUpdate" status MUST NOT be combined with either
|
||||
# "clientUpdateProhibited" or "serverUpdateProhibited" status.
|
||||
PENDING_UPDATE = 'pendingUpdate'
|
||||
|
||||
SERVER_MANUAL_INZONE = 'serverManualInzone'
|
||||
|
|
|
@ -18,13 +18,6 @@ class Epp::Contact < Contact
|
|||
at[:fax] = f.css('fax').text if f.css('fax').present?
|
||||
at[:phone] = f.css('voice').text if f.css('voice').present?
|
||||
at[:auth_info] = f.css('authInfo pw').text if f.css('authInfo pw').present?
|
||||
|
||||
if f.css('ident').present? && f.css('ident').attr('type').present?
|
||||
at[:ident] = f.css('ident').text
|
||||
at[:ident_type] = f.css('ident').attr('type').try(:text)
|
||||
at[:ident_country_code] = f.css('ident').attr('cc').try(:text)
|
||||
end
|
||||
|
||||
at[:address_attributes] = {}.with_indifferent_access
|
||||
sat = at[:address_attributes]
|
||||
sat[:city] = f.css('postalInfo addr city').text if f.css('postalInfo addr city').present?
|
||||
|
@ -38,7 +31,7 @@ class Epp::Contact < Contact
|
|||
if legal_frame.present?
|
||||
at[:legal_documents_attributes] = legal_document_attrs(legal_frame)
|
||||
end
|
||||
|
||||
at.merge!(ident_attrs(f.css('ident').first))
|
||||
at
|
||||
end
|
||||
# rubocop: enable Metrics/MethodLength
|
||||
|
@ -63,10 +56,27 @@ class Epp::Contact < Contact
|
|||
)
|
||||
end
|
||||
|
||||
def ident_attrs(ident_frame)
|
||||
return {} if ident_frame.blank?
|
||||
return {} if ident_frame.try('text').blank?
|
||||
return {} if ident_frame.attr('type').blank?
|
||||
return {} if ident_frame.attr('cc').blank?
|
||||
|
||||
{
|
||||
ident: ident_frame.text,
|
||||
ident_type: ident_frame.attr('type'),
|
||||
ident_country_code: ident_frame.attr('cc')
|
||||
}
|
||||
end
|
||||
|
||||
def legal_document_attrs(legal_frame)
|
||||
return [] if legal_frame.blank?
|
||||
return [] if legal_frame.try('text').blank?
|
||||
return [] if legal_frame.attr('type').blank?
|
||||
|
||||
[{
|
||||
body: legal_frame.text,
|
||||
document_type: legal_frame['type']
|
||||
document_type: legal_frame.attr('type')
|
||||
}]
|
||||
end
|
||||
end
|
||||
|
@ -93,6 +103,7 @@ class Epp::Contact < Contact
|
|||
return super if frame.blank?
|
||||
at = {}.with_indifferent_access
|
||||
at.deep_merge!(self.class.attrs_from(frame.css('chg')))
|
||||
at.merge!(self.class.ident_attrs(frame.css('ident').first))
|
||||
legal_frame = frame.css('legalDocument').first
|
||||
at[:legal_documents_attributes] = self.class.legal_document_attrs(legal_frame)
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
.panel-body
|
||||
- unless @contact.address.nil?
|
||||
%dl.dl-horizontal
|
||||
- if @contact.bic?
|
||||
- if @contact.org_name.present?
|
||||
%dt= t(:org_name)
|
||||
%dd= @contact.org_name
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ xml.epp_head do
|
|||
end
|
||||
|
||||
xml.resData do
|
||||
xml.tag!('contact:chkData', 'xmlns:contact' => 'urn:ietf:params:xml:ns:contact-1.0') do
|
||||
xml.tag!('contact:infData', 'xmlns:contact' => 'urn:ietf:params:xml:ns:contact-1.0') do
|
||||
xml.tag!('contact:id', @contact.code)
|
||||
xml << render('/epp/contacts/postal_info')
|
||||
xml.tag!('contact:voice', @contact.phone) #if @disclosure.try(:phone) || @owner
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
app_name: .EE Registry
|
||||
zonefile_export_dir: 'export/zonefiles'
|
||||
|
||||
# Contact epp will not accept org value by default
|
||||
# and returns 2306 "Parameter value policy error"
|
||||
contact_org_enabled: 'false'
|
||||
|
||||
# You can use `rake secret` to generate a secure secret key.
|
||||
# Your secret key is used for verifying the integrity of signed cookies.
|
||||
# If you change this key, all old signed cookies will become invalid!
|
||||
|
|
|
@ -490,3 +490,4 @@ en:
|
|||
sign_this_request: 'Sign this request'
|
||||
revoke_this_certificate: 'Revoke this certificate'
|
||||
crt_revoked: 'CRT (revoked)'
|
||||
contact_org_error: 'Parameter value policy error. Org should be blank'
|
||||
|
|
|
@ -16,7 +16,7 @@ Contact Mapping protocol short version:
|
|||
<contact:id> 0-1 Contact id, optional, generated automatically if missing
|
||||
<contact:postalInfo> 1 Postal information container
|
||||
<contact:name> 1 Full name of the contact
|
||||
<contact:org> 0-1 Name of organization
|
||||
<contact:org> 0 Org is not supported and should be blank or missing
|
||||
<contact:addr> 1 Address container
|
||||
<contact:street> 0-n Street name
|
||||
<contact:city> 1 City name
|
||||
|
@ -25,14 +25,14 @@ Contact Mapping protocol short version:
|
|||
<contact:cc> 1 Country code, 2 letters uppercase, in ISO_3166-1 alpha 2
|
||||
<contact:voice> 1 Phone number in format \+ddd.d+
|
||||
<contact:email> 1 E-mail
|
||||
<contact:ident> 1 Contact identificator
|
||||
<extension> 1
|
||||
<eis:extdata> 1 Attribute: xmlns:eis="urn:ee:eis:xml:epp:eis-1.0"
|
||||
<eis:ident> 1 Contact identificator
|
||||
Attribute: type="bic/priv/birthday"
|
||||
"bic" # Business registry code
|
||||
"priv" # National idendtification number
|
||||
"birthday" # Birthday date in format in DD-MM-YYYY
|
||||
<extension> 1
|
||||
<eis:extdata> 1 Attribute: xmlns:eis="urn:ee:eis:xml:epp:eis-1.0"
|
||||
<eis:legalDocument> 1 Base64 encoded document
|
||||
<eis:legalDocument> 0-1 Base64 encoded document
|
||||
Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z"
|
||||
|
||||
[EXAMPLE REQUEST AND RESPONSE](/doc/epp-examples.md#epp-contact-with-valid-user-create-command-successfully-creates-a-contact)
|
||||
|
@ -47,7 +47,7 @@ Contact Mapping protocol short version:
|
|||
<contact:chg> 1 Change container
|
||||
<contact:postalInfo> 1 Postal information container
|
||||
<contact:name> 0-1 Full name of the contact
|
||||
<contact:org> 0-1 Name of organization
|
||||
<contact:org> 0 Org is not supported and should be blank or missing
|
||||
<contact:addr> 0-1 Address container
|
||||
<contact:street> 0-n Street name
|
||||
<contact:city> 0-1 City name
|
||||
|
@ -56,15 +56,15 @@ Contact Mapping protocol short version:
|
|||
<contact:cc> 0-1 Country code, 2 letters uppercase, in ISO_3166-1 alpha 2
|
||||
<contact:voice> 0-1 Phone number in format \+ddd.d+
|
||||
<contact:email> 0-1 E-mail
|
||||
<contact:ident> 0-1 Contact identificator
|
||||
Attribute: type="bic/priv/birthday"
|
||||
"bic" # Business registry code
|
||||
"priv" # National idendtification number
|
||||
"birthday" # Birthday date in format in DD-MM-YYYY
|
||||
<contact:authInfo> 0-1 Required if registrar is not the owner of the contact.
|
||||
<contact:pw> 1 Contact password. Attribute: roid="String"
|
||||
<extension> 0-1
|
||||
<eis:extdata> 0-1 Attribute: xmlns:eis="urn:ee:eis:xml:epp:eis-1.0"
|
||||
<eis:ident> 0-1 Contact identificator
|
||||
Attribute: type="bic/priv/birthday"
|
||||
"bic" # Business registry code
|
||||
"priv" # National idendtification number
|
||||
"birthday" # Birthday date in format in DD-MM-YYYY
|
||||
<eis:legalDocument> 0-1 Base64 encoded document.
|
||||
Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z"
|
||||
|
||||
|
@ -80,9 +80,9 @@ Contact Mapping protocol short version:
|
|||
<contact:id> 1 Contact id
|
||||
<contact:authInfo> 0-1 Required if registrar is not the owner of the contact.
|
||||
<contact:pw> 1 Contact password. Attribute: roid="String"
|
||||
<extension> 1
|
||||
<eis:extdata> 1 Attribute: xmlns:eis="urn:ee:eis:xml:epp:eis-1.0"
|
||||
<eis:legalDocument> 1 Base64 encoded document.
|
||||
<extension> 0-1
|
||||
<eis:extdata> 0-1 Attribute: xmlns:eis="urn:ee:eis:xml:epp:eis-1.0"
|
||||
<eis:legalDocument> 0-1 Base64 encoded document.
|
||||
Attribute: type="pdf/bdoc/ddoc/zip/rar/gz/tar/7z"
|
||||
<clTRID> 0-1 Client transaction id
|
||||
|
||||
|
|
|
@ -15,17 +15,23 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
@contact = Fabricate(:contact, registrar: @registrar1)
|
||||
|
||||
@legal_document = {
|
||||
@extension = {
|
||||
legalDocument: {
|
||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||
attrs: { type: 'pdf' }
|
||||
},
|
||||
ident: {
|
||||
value: '37605030299',
|
||||
attrs: { type: 'priv', cc: 'EE' }
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
context 'with valid user' do
|
||||
context 'create command' do
|
||||
def create_request(overwrites = {})
|
||||
def create_request(overwrites = {}, extension = {})
|
||||
extension = @extension if extension.blank?
|
||||
|
||||
defaults = {
|
||||
postalInfo: {
|
||||
name: { value: 'John Doe' },
|
||||
|
@ -36,10 +42,9 @@ describe 'EPP Contact', epp: true do
|
|||
}
|
||||
},
|
||||
voice: { value: '+372.1234567' },
|
||||
email: { value: 'test@example.example' },
|
||||
ident: { value: '37605030299', attrs: { type: 'priv', cc: 'EE' } }
|
||||
email: { value: 'test@example.example' }
|
||||
}
|
||||
create_xml = @epp_xml.create(defaults.deep_merge(overwrites), @legal_document)
|
||||
create_xml = @epp_xml.create(defaults.deep_merge(overwrites), extension)
|
||||
epp_plain_request(create_xml, :xml)
|
||||
end
|
||||
|
||||
|
@ -52,13 +57,11 @@ describe 'EPP Contact', epp: true do
|
|||
response[:results][2][:msg].should ==
|
||||
'Required parameter missing: create > create > postalInfo > addr > cc [cc]'
|
||||
response[:results][3][:msg].should ==
|
||||
'Required parameter missing: create > create > ident [ident]'
|
||||
response[:results][4][:msg].should ==
|
||||
'Required parameter missing: create > create > voice [voice]'
|
||||
response[:results][5][:msg].should ==
|
||||
response[:results][4][:msg].should ==
|
||||
'Required parameter missing: create > create > email [email]'
|
||||
response[:results][6][:msg].should ==
|
||||
'Required parameter missing: extension > extdata > legalDocument [legal_document]'
|
||||
response[:results][5][:msg].should ==
|
||||
'Required parameter missing: extension > extdata > ident [ident]'
|
||||
|
||||
response[:results][0][:result_code].should == '2003'
|
||||
response[:results][1][:result_code].should == '2003'
|
||||
|
@ -66,9 +69,8 @@ describe 'EPP Contact', epp: true do
|
|||
response[:results][3][:result_code].should == '2003'
|
||||
response[:results][4][:result_code].should == '2003'
|
||||
response[:results][5][:result_code].should == '2003'
|
||||
response[:results][6][:result_code].should == '2003'
|
||||
|
||||
response[:results].count.should == 7
|
||||
response[:results].count.should == 6
|
||||
end
|
||||
|
||||
it 'successfully creates a contact' do
|
||||
|
@ -94,9 +96,17 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'successfully saves ident type' do
|
||||
response = create_request(
|
||||
{ ident: { value: '1990-22-12', attrs: { type: 'birthday' } } }
|
||||
)
|
||||
extension = {
|
||||
legalDocument: {
|
||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||
attrs: { type: 'pdf' }
|
||||
},
|
||||
ident: {
|
||||
value: '1990-22-12',
|
||||
attrs: { type: 'birthday', cc: 'US' }
|
||||
}
|
||||
}
|
||||
response = create_request({}, extension)
|
||||
|
||||
response[:msg].should == 'Command completed successfully'
|
||||
response[:result_code].should == '1000'
|
||||
|
@ -128,15 +138,21 @@ describe 'EPP Contact', epp: true do
|
|||
end
|
||||
|
||||
it 'successfully saves custom code' do
|
||||
response = create_request(
|
||||
{ id: { value: '12345' } }
|
||||
)
|
||||
|
||||
response = create_request({ id: { value: '12345' } })
|
||||
response[:msg].should == 'Command completed successfully'
|
||||
response[:result_code].should == '1000'
|
||||
|
||||
Contact.last.code.should == 'registrar1:12345'
|
||||
end
|
||||
|
||||
it 'should return parameter value policy errror' do
|
||||
response = create_request({ postalInfo: { org: { value: 'should not save' } } })
|
||||
response[:msg].should ==
|
||||
'Parameter value policy error. Org should be blank: postalInfo > org [org]'
|
||||
response[:result_code].should == '2306'
|
||||
|
||||
Contact.last.org_name.should == nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'update command' do
|
||||
|
@ -150,7 +166,9 @@ describe 'EPP Contact', epp: true do
|
|||
)
|
||||
end
|
||||
|
||||
def update_request(overwrites = {})
|
||||
def update_request(overwrites = {}, extension = {})
|
||||
extension = @extension if extension.blank?
|
||||
|
||||
defaults = {
|
||||
id: { value: 'asd123123er' },
|
||||
authInfo: { pw: { value: 'password' } },
|
||||
|
@ -168,7 +186,7 @@ describe 'EPP Contact', epp: true do
|
|||
}
|
||||
}
|
||||
}
|
||||
update_xml = @epp_xml.update(defaults.deep_merge(overwrites), @legal_document)
|
||||
update_xml = @epp_xml.update(defaults.deep_merge(overwrites), extension)
|
||||
epp_plain_request(update_xml, :xml)
|
||||
end
|
||||
|
||||
|
@ -184,10 +202,7 @@ describe 'EPP Contact', epp: true do
|
|||
response[:results][2][:msg].should ==
|
||||
'Required parameter missing: update > update > authInfo > pw [pw]'
|
||||
response[:results][2][:result_code].should == '2003'
|
||||
response[:results][3][:msg].should ==
|
||||
'Required parameter missing: extension > extdata > legalDocument [legal_document]'
|
||||
response[:results][3][:result_code].should == '2003'
|
||||
response[:results].count.should == 4
|
||||
response[:results].count.should == 3
|
||||
end
|
||||
|
||||
it 'returns error if obj doesnt exist' do
|
||||
|
@ -242,6 +257,38 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
@contact.reload.code.should == 'sh8013'
|
||||
end
|
||||
|
||||
it 'should update ident' do
|
||||
extension = {
|
||||
legalDocument: {
|
||||
value: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0Zp==',
|
||||
attrs: { type: 'pdf' }
|
||||
},
|
||||
ident: {
|
||||
value: '1990-22-12',
|
||||
attrs: { type: 'birthday', cc: 'US' }
|
||||
}
|
||||
}
|
||||
response = update_request({ id: { value: 'sh8013' } }, extension)
|
||||
response[:msg].should == 'Command completed successfully'
|
||||
response[:result_code].should == '1000'
|
||||
|
||||
Contact.find_by(code: 'sh8013').ident_type.should == 'birthday'
|
||||
end
|
||||
|
||||
it 'should return parameter value policy errror for org update' do
|
||||
response = update_request({
|
||||
id: { value: 'sh8013' },
|
||||
chg: {
|
||||
postalInfo: { org: { value: 'should not save' } }
|
||||
}
|
||||
})
|
||||
response[:msg].should ==
|
||||
'Parameter value policy error. Org should be blank: postalInfo > org [org]'
|
||||
response[:result_code].should == '2306'
|
||||
|
||||
Contact.find_by(code: 'sh8013').org_name.should == nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'delete command' do
|
||||
|
@ -254,7 +301,7 @@ describe 'EPP Contact', epp: true do
|
|||
id: { value: @contact.code },
|
||||
authInfo: { pw: { value: @contact.auth_info } }
|
||||
}
|
||||
delete_xml = @epp_xml.delete(defaults.deep_merge(overwrites), @legal_document)
|
||||
delete_xml = @epp_xml.delete(defaults.deep_merge(overwrites), @extension)
|
||||
epp_plain_request(delete_xml, :xml)
|
||||
end
|
||||
|
||||
|
@ -267,10 +314,7 @@ describe 'EPP Contact', epp: true do
|
|||
response[:results][1][:msg].should ==
|
||||
'Required parameter missing: delete > delete > authInfo > pw [pw]'
|
||||
response[:results][1][:result_code].should == '2003'
|
||||
response[:results][2][:msg].should ==
|
||||
'Required parameter missing: extension > extdata > legalDocument [legal_document]'
|
||||
response[:results][2][:result_code].should == '2003'
|
||||
response[:results].count.should == 3
|
||||
response[:results].count.should == 2
|
||||
end
|
||||
|
||||
it 'returns error if obj doesnt exist' do
|
||||
|
@ -381,7 +425,7 @@ describe 'EPP Contact', epp: true do
|
|||
response[:msg].should == 'Command completed successfully'
|
||||
response[:result_code].should == '1000'
|
||||
|
||||
contact = response[:parsed].css('resData chkData')
|
||||
contact = response[:parsed].css('resData infData')
|
||||
contact.css('name').first.text.should == 'Johnny Awesome'
|
||||
end
|
||||
|
||||
|
|
|
@ -697,7 +697,7 @@ describe 'EPP Domain', epp: true do
|
|||
end
|
||||
|
||||
context 'with valid domain' do
|
||||
before(:each) { Fabricate(:domain, name: next_domain_name, registrar: @registrar1, dnskeys: []) }
|
||||
before(:each) { Fabricate(:domain, registrar: @registrar1, dnskeys: []) }
|
||||
let(:domain) { Domain.last }
|
||||
|
||||
### TRANSFER ###
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Fabricator(:domain) do
|
||||
name { "fabricate_name#{rand(1_000_000)}.ee" }
|
||||
name { sequence(:name) { |i| "fabricate_name#{i}.ee" } }
|
||||
valid_to Date.new(2014, 8, 7)
|
||||
period 1
|
||||
period_unit 'y'
|
||||
|
|
|
@ -112,7 +112,7 @@ module Epp
|
|||
end
|
||||
|
||||
def next_domain_name
|
||||
"example#{rand(100000000)}.ee"
|
||||
"example#{rand(100_000_000_000_000_000)}.ee"
|
||||
end
|
||||
|
||||
### REQUEST TEMPLATES ###
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue