mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 18:56:05 +02:00
Update whois record with auction registration_deadline if any
This commit is contained in:
parent
c6fd78b4cd
commit
5c419ae8be
4 changed files with 29 additions and 7 deletions
|
@ -30,6 +30,8 @@ module Api
|
|||
raise "Invalid status #{params[:status]}"
|
||||
end
|
||||
|
||||
auction.mark_deadline(params[:registration_deadline]) if params[:registration_deadline]
|
||||
|
||||
if auction.payment_not_received? || auction.domain_not_registered?
|
||||
update_whois_from_auction(Auction.pending(auction.domain))
|
||||
else
|
||||
|
|
|
@ -23,10 +23,19 @@ class Auction < ApplicationRecord
|
|||
save!
|
||||
end
|
||||
|
||||
def whois_deadline
|
||||
registration_deadline.to_s
|
||||
end
|
||||
|
||||
def mark_as_no_bids
|
||||
no_bids!
|
||||
end
|
||||
|
||||
def mark_deadline(registration_deadline)
|
||||
self.registration_deadline = registration_deadline
|
||||
save!
|
||||
end
|
||||
|
||||
def mark_as_payment_received
|
||||
self.status = self.class.statuses[:payment_received]
|
||||
generate_registration_code
|
||||
|
|
|
@ -16,7 +16,8 @@ module Whois
|
|||
elsif auction.awaiting_payment? || auction.payment_received?
|
||||
update!(json: { name: auction.domain,
|
||||
status: ['PendingRegistration'],
|
||||
disclaimer: self.class.disclaimer })
|
||||
disclaimer: self.class.disclaimer,
|
||||
registration_deadline: auction.whois_deadline })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,24 +40,34 @@ class Whois::RecordTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def test_updates_whois_record_from_auction_when_awaiting_payment
|
||||
@auction.update!(domain: 'domain.test', status: Auction.statuses[:awaiting_payment])
|
||||
@auction.update!(domain: 'domain.test',
|
||||
status: Auction.statuses[:awaiting_payment],
|
||||
registration_deadline: registration_deadline)
|
||||
@whois_record.update!(name: 'domain.test')
|
||||
@whois_record.update_from_auction(@auction)
|
||||
@whois_record.reload
|
||||
|
||||
assert_equal ({ 'name' => 'domain.test',
|
||||
'status' => ['PendingRegistration'],
|
||||
'disclaimer' => 'disclaimer' }), @whois_record.json
|
||||
'disclaimer' => 'disclaimer',
|
||||
'registration_deadline' => registration_deadline.to_s }), @whois_record.json
|
||||
end
|
||||
|
||||
def test_updates_whois_record_from_auction_when_payment_received
|
||||
@auction.update!(domain: 'domain.test', status: Auction.statuses[:payment_received])
|
||||
@auction.update!(domain: 'domain.test',
|
||||
status: Auction.statuses[:payment_received],
|
||||
registration_deadline: registration_deadline)
|
||||
@whois_record.update!(name: 'domain.test')
|
||||
@whois_record.update_from_auction(@auction)
|
||||
@whois_record.reload
|
||||
|
||||
assert_equal ({ 'name' => 'domain.test',
|
||||
'status' => ['PendingRegistration'],
|
||||
'disclaimer' => 'disclaimer' }), @whois_record.json
|
||||
'disclaimer' => 'disclaimer',
|
||||
'registration_deadline' => registration_deadline.to_s }), @whois_record.json
|
||||
end
|
||||
|
||||
def registration_deadline
|
||||
Time.zone.now + 10.days
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue