Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added deadline registration condition during domain registration from… #2643

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/interactions/actions/domain_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def validate_domain_integrity
return unless Domain.release_to_auction

dn = DNS::DomainName.new(domain.name)
if dn.at_auction?
if dn.at_auction? || dn.is_deadline_is_reached?
domain.add_epp_error('2306', nil, nil, 'Parameter value policy error: domain is at auction')
elsif dn.awaiting_payment?
domain.add_epp_error('2003', nil, nil, 'Required parameter missing; reserved>pw element' \
Expand Down
4 changes: 4 additions & 0 deletions app/models/dns/domain_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ def auctionable?
!not_auctionable?
end

def is_deadline_is_reached?
pending_auction && pending_auction.payment_received? && pending_auction&.registration_deadline && Time.zone.now > pending_auction.registration_deadline
end

def to_s
name
end
Expand Down
38 changes: 37 additions & 1 deletion test/integration/epp/domain/create/auction_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def test_registers_domain_with_correct_registration_code_after_another_auction_w

def test_registers_domain_with_correct_registration_code_when_payment_is_received
@auction.update!(status: Auction.statuses[:payment_received],
registration_code: 'auction001')
registration_code: 'auction001', registration_deadline: 1.day.from_now)

request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
Expand Down Expand Up @@ -247,4 +247,40 @@ def test_domain_cannot_be_registered_when_at_auction
assert_correct_against_schema response_xml
assert_epp_response :parameter_value_policy_error
end

def test_domain_cannot_be_registred_when_deadline_is_reached
@auction.update!(status: Auction.statuses[:payment_received],
registration_code: 'auction001', registration_deadline: 1.second.ago)

request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee', for_version: '1.0')}">
<command>
<create>
<domain:create xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-ee', for_version: '1.2')}">
<domain:name>auction.test</domain:name>
<domain:registrant>#{contacts(:john).code}</domain:registrant>
</domain:create>
</create>
<extension>
<eis:extdata xmlns:eis="#{Xsd::Schema.filename(for_prefix: 'eis', for_version: '1.0')}">
<eis:legalDocument type="pdf">#{'test' * 2000}</eis:legalDocument>
<eis:reserved>
<eis:pw>auction001</eis:pw>
</eis:reserved>
</eis:extdata>
</extension>
</command>
</epp>
XML

assert_no_difference 'Domain.count' do
post epp_create_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
end

response_xml = Nokogiri::XML(response.body)
assert_correct_against_schema response_xml
assert_epp_response :parameter_value_policy_error
end
end
2 changes: 1 addition & 1 deletion test/integration/repp/v1/stats/market_share_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_shows_market_share_distribution_data
end

def test_shows_market_share_growth_rate_data
prev_date = Time.zone.today.last_month.strftime('%m.%y')
prev_date = Date.new(2023, 11, 1).strftime('%m.%y')
get '/repp/v1/stats/market_share_growth_rate', headers: @auth_headers,
params: { q: { end_date: @today,
compare_to_end_date: prev_date } }
Expand Down
Loading