mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 18:26:06 +02:00
Increase precision of pricelist #2741
This commit is contained in:
parent
527f65ebfb
commit
fa77056f81
3 changed files with 29 additions and 47 deletions
|
@ -0,0 +1,5 @@
|
|||
class IncreasePrecisionOfPricelist < ActiveRecord::Migration
|
||||
def change
|
||||
change_column :pricelists, :price_cents, :decimal, precision: 10, scale: 2
|
||||
end
|
||||
end
|
|
@ -74,7 +74,7 @@ CREATE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
|
|||
SELECT concat(d.name_puny, '. IN NS ', ns.hostname, '.')
|
||||
FROM domains d
|
||||
JOIN nameservers ns ON ns.domain_id = d.id
|
||||
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter OR d.name = i_origin
|
||||
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
|
||||
ORDER BY d.name
|
||||
),
|
||||
chr(10)
|
||||
|
@ -2366,7 +2366,7 @@ CREATE TABLE pricelists (
|
|||
id integer NOT NULL,
|
||||
"desc" character varying,
|
||||
category character varying,
|
||||
price_cents numeric(8,2) DEFAULT 0.0 NOT NULL,
|
||||
price_cents numeric(10,2) DEFAULT 0.0 NOT NULL,
|
||||
price_currency character varying DEFAULT 'EUR'::character varying NOT NULL,
|
||||
valid_from timestamp without time zone,
|
||||
valid_to timestamp without time zone,
|
||||
|
@ -2404,8 +2404,8 @@ ALTER SEQUENCE pricelists_id_seq OWNED BY pricelists.id;
|
|||
|
||||
CREATE TABLE que_jobs (
|
||||
priority smallint DEFAULT 100 NOT NULL,
|
||||
run_at timestamp with time zone DEFAULT now() NOT NULL,
|
||||
job_id bigint NOT NULL,
|
||||
run_at timestamp without time zone DEFAULT '2015-06-30 14:16:50.905537'::timestamp without time zone NOT NULL,
|
||||
job_id bigint DEFAULT 0 NOT NULL,
|
||||
job_class text NOT NULL,
|
||||
args json DEFAULT '[]'::json NOT NULL,
|
||||
error_count integer DEFAULT 0 NOT NULL,
|
||||
|
@ -2414,32 +2414,6 @@ CREATE TABLE que_jobs (
|
|||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: TABLE que_jobs; Type: COMMENT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
COMMENT ON TABLE que_jobs IS '3';
|
||||
|
||||
|
||||
--
|
||||
-- Name: que_jobs_job_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE que_jobs_job_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: que_jobs_job_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE que_jobs_job_id_seq OWNED BY que_jobs.job_id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: registrant_verifications; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
@ -3195,13 +3169,6 @@ ALTER TABLE ONLY people ALTER COLUMN id SET DEFAULT nextval('people_id_seq'::reg
|
|||
ALTER TABLE ONLY pricelists ALTER COLUMN id SET DEFAULT nextval('pricelists_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: job_id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY que_jobs ALTER COLUMN job_id SET DEFAULT nextval('que_jobs_job_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -3721,14 +3688,6 @@ ALTER TABLE ONLY pricelists
|
|||
ADD CONSTRAINT pricelists_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: que_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY que_jobs
|
||||
ADD CONSTRAINT que_jobs_pkey PRIMARY KEY (queue, priority, run_at, job_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: registrant_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
@ -4851,3 +4810,5 @@ INSERT INTO schema_migrations (version) VALUES ('20150612123111');
|
|||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20150701074344');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20150703084632');
|
||||
|
||||
|
|
|
@ -19,11 +19,24 @@ describe 'EPP Domain', epp: true do
|
|||
Fabricate(:contact, code: 'FIXED:JURIDICAL_1234', ident_type: 'bic')
|
||||
Fabricate(:reserved_domain)
|
||||
Fabricate(:blocked_domain)
|
||||
Fabricate(:pricelist)
|
||||
Fabricate(:pricelist, valid_to: nil)
|
||||
|
||||
@uniq_no = proc { @i ||= 0; @i += 1 }
|
||||
end
|
||||
|
||||
it 'should return error if balance low' do
|
||||
f = Fabricate(:pricelist, valid_to: Time.zone.now + 1.day, price: 100000)
|
||||
|
||||
dn = next_domain_name
|
||||
response = epp_plain_request(domain_create_xml({
|
||||
name: { value: dn }
|
||||
}))
|
||||
|
||||
response[:msg].should == "Billing failure - credit balance low"
|
||||
response[:result_code].should == '2104'
|
||||
f.delete
|
||||
end
|
||||
|
||||
it 'returns error if contact does not exists' do
|
||||
response = epp_plain_request(domain_create_xml({
|
||||
registrant: { value: 'FIXED:CITIZEN_1234' },
|
||||
|
@ -332,9 +345,12 @@ describe 'EPP Domain', epp: true do
|
|||
response = epp_plain_request(xml)
|
||||
response[:msg].should == 'Command completed successfully'
|
||||
response[:result_code].should == '1000'
|
||||
Domain.first.valid_to.should be_within(60).of(1.year.since)
|
||||
Domain.last.valid_to.should be_within(60).of(1.year.since)
|
||||
@registrar1.balance.should be < old_balance
|
||||
@registrar1.cash_account.account_activities.count.should == old_activities + 1
|
||||
a = @registrar1.cash_account.account_activities.last
|
||||
a.description.should == "Create #{Domain.last.name}"
|
||||
a.sum.should == -BigDecimal.new('10.0')
|
||||
end
|
||||
|
||||
it 'does not create a domain with invalid period' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue