added deadline registration condition during domain registration from auction

This commit is contained in:
Oleg Hasjanov 2024-01-24 14:33:49 +02:00
parent bbe667b9d2
commit b5b59026b9
4 changed files with 43 additions and 3 deletions

View file

@ -43,7 +43,7 @@ module Actions
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' \

View file

@ -78,6 +78,10 @@ module DNS
!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

View file

@ -81,7 +81,7 @@ class EppDomainCreateAuctionTest < EppTestCase
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"?>
@ -247,4 +247,40 @@ class EppDomainCreateAuctionTest < EppTestCase
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

View file

@ -24,7 +24,7 @@ class ReppV1StatsMarketShareTest < ActionDispatch::IntegrationTest
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 } }