Merge branch 'master' of github.com:domify/registry

This commit is contained in:
Priit Tark 2015-06-09 16:36:19 +03:00
commit 57c4f63daf
4 changed files with 857 additions and 725 deletions

View file

@ -34,7 +34,6 @@ class Epp::Domain < Domain
max: Setting.ns_max_count max: Setting.ns_max_count
} }
], ],
[:period, :out_of_range, { value: { obj: 'period', val: period } }],
[:dnskeys, :out_of_range, [:dnskeys, :out_of_range,
{ {
min: Setting.dnskeys_min_count, min: Setting.dnskeys_min_count,
@ -69,6 +68,7 @@ class Epp::Domain < Domain
[:base, :domain_status_prohibits_operation] [:base, :domain_status_prohibits_operation]
], ],
'2306' => [ # Parameter policy error '2306' => [ # Parameter policy error
[:period, :out_of_range, { value: { obj: 'period', val: period } }],
[:base, :ds_data_with_key_not_allowed], [:base, :ds_data_with_key_not_allowed],
[:base, :ds_data_not_allowed], [:base, :ds_data_not_allowed],
[:base, :key_data_not_allowed], [:base, :key_data_not_allowed],
@ -430,9 +430,11 @@ class Epp::Domain < Domain
# TODO: Check how much time before domain exp date can it be renewed # TODO: Check how much time before domain exp date can it be renewed
validate_exp_dates(cur_exp_date) validate_exp_dates(cur_exp_date)
if Setting.days_to_renew_domain_before_expire != 0
if (valid_to - Time.zone.now).to_i / 1.day >= Setting.days_to_renew_domain_before_expire if (valid_to - Time.zone.now).to_i / 1.day >= Setting.days_to_renew_domain_before_expire
add_epp_error('2105', nil, nil, I18n.t('object_is_not_eligible_for_renewal')) add_epp_error('2105', nil, nil, I18n.t('object_is_not_eligible_for_renewal'))
end end
end
return false if errors.any? return false if errors.any?

View file

@ -19,7 +19,7 @@ ActiveRecord::Schema.define(version: 20150609103333) do
create_table "account_activities", force: :cascade do |t| create_table "account_activities", force: :cascade do |t|
t.integer "account_id" t.integer "account_id"
t.integer "invoice_id" t.integer "invoice_id"
t.decimal "sum", precision: 10, scale: 2 t.decimal "sum", precision: 8, scale: 2
t.string "currency" t.string "currency"
t.integer "bank_transaction_id" t.integer "bank_transaction_id"
t.datetime "created_at" t.datetime "created_at"
@ -36,7 +36,7 @@ ActiveRecord::Schema.define(version: 20150609103333) do
create_table "accounts", force: :cascade do |t| create_table "accounts", force: :cascade do |t|
t.integer "registrar_id" t.integer "registrar_id"
t.string "account_type" t.string "account_type"
t.decimal "balance", precision: 10, scale: 2, default: 0.0, null: false t.decimal "balance", precision: 8, scale: 2, default: 0.0, null: false
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "currency" t.string "currency"
@ -98,7 +98,7 @@ ActiveRecord::Schema.define(version: 20150609103333) do
t.string "buyer_name" t.string "buyer_name"
t.string "document_no" t.string "document_no"
t.string "description" t.string "description"
t.decimal "sum", precision: 10, scale: 2 t.decimal "sum", precision: 8, scale: 2
t.string "reference_no" t.string "reference_no"
t.datetime "paid_at" t.datetime "paid_at"
t.datetime "created_at" t.datetime "created_at"
@ -114,7 +114,7 @@ ActiveRecord::Schema.define(version: 20150609103333) do
t.string "vk_rec_id" t.string "vk_rec_id"
t.string "vk_stamp" t.string "vk_stamp"
t.string "vk_t_no" t.string "vk_t_no"
t.decimal "vk_amount", precision: 10, scale: 2 t.decimal "vk_amount", precision: 8, scale: 2
t.string "vk_curr" t.string "vk_curr"
t.string "vk_rec_acc" t.string "vk_rec_acc"
t.string "vk_rec_name" t.string "vk_rec_name"
@ -331,7 +331,7 @@ ActiveRecord::Schema.define(version: 20150609103333) do
t.string "description", null: false t.string "description", null: false
t.string "unit" t.string "unit"
t.integer "amount" t.integer "amount"
t.decimal "price", precision: 10, scale: 2 t.decimal "price", precision: 8, scale: 2
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "creator_str" t.string "creator_str"
@ -349,7 +349,7 @@ ActiveRecord::Schema.define(version: 20150609103333) do
t.string "currency", null: false t.string "currency", null: false
t.string "description" t.string "description"
t.string "reference_no" t.string "reference_no"
t.decimal "vat_prc", precision: 10, scale: 2, null: false t.decimal "vat_prc", precision: 8, scale: 2, null: false
t.datetime "paid_at" t.datetime "paid_at"
t.integer "seller_id" t.integer "seller_id"
t.string "seller_name", null: false t.string "seller_name", null: false
@ -382,7 +382,7 @@ ActiveRecord::Schema.define(version: 20150609103333) do
t.string "updator_str" t.string "updator_str"
t.integer "number" t.integer "number"
t.datetime "cancelled_at" t.datetime "cancelled_at"
t.decimal "sum_cache", precision: 10, scale: 2 t.decimal "sum_cache", precision: 8, scale: 2
end end
add_index "invoices", ["buyer_id"], name: "index_invoices_on_buyer_id", using: :btree add_index "invoices", ["buyer_id"], name: "index_invoices_on_buyer_id", using: :btree
@ -983,7 +983,7 @@ ActiveRecord::Schema.define(version: 20150609103333) do
t.text "crt" t.text "crt"
t.string "type" t.string "type"
t.string "registrant_ident" t.string "registrant_ident"
t.string "encrypted_password", default: "" t.string "encrypted_password", default: "", null: false
t.datetime "remember_created_at" t.datetime "remember_created_at"
t.integer "failed_attempts", default: 0, null: false t.integer "failed_attempts", default: 0, null: false
t.datetime "locked_at" t.datetime "locked_at"

File diff suppressed because it is too large Load diff

View file

@ -326,7 +326,7 @@ describe 'EPP Domain', epp: true do
}) })
response = epp_plain_request(xml) response = epp_plain_request(xml)
response[:results][0][:result_code].should == '2004' response[:results][0][:result_code].should == '2306'
response[:results][0][:msg].should == 'Period must add up to 1, 2 or 3 years [period]' response[:results][0][:msg].should == 'Period must add up to 1, 2 or 3 years [period]'
response[:results][0][:value].should == '367' response[:results][0][:value].should == '367'
end end
@ -1994,7 +1994,7 @@ describe 'EPP Domain', epp: true do
response = epp_plain_request(xml) response = epp_plain_request(xml)
response[:results][0][:msg].should == 'Period must add up to 1, 2 or 3 years [period]' response[:results][0][:msg].should == 'Period must add up to 1, 2 or 3 years [period]'
response[:results][0][:result_code].should == '2004' response[:results][0][:result_code].should == '2306'
response[:results][0][:value].should == '4' response[:results][0][:value].should == '4'
end end
@ -2028,6 +2028,25 @@ describe 'EPP Domain', epp: true do
response[:results][0][:result_code].should == '1000' response[:results][0][:result_code].should == '1000'
end end
it 'does not renew a domain unless less than 90 days till expiration' do
Setting.days_to_renew_domain_before_expire = 0
domain.valid_to = Time.zone.now.to_date + 5.years
domain.save
exp_date = domain.valid_to.to_date
xml = @epp_xml.domain.renew(
name: { value: domain.name },
curExpDate: { value: exp_date.to_s },
period: { value: '1', attrs: { unit: 'y' } }
)
response = epp_plain_request(xml)
response[:results][0][:msg].should == 'Command completed successfully'
response[:results][0][:result_code].should == '1000'
Setting.days_to_renew_domain_before_expire = 90
end
it 'does not renew foreign domain' do it 'does not renew foreign domain' do
login_as :registrar2 do login_as :registrar2 do
exp_date = 1.year.since.to_date exp_date = 1.year.since.to_date