transfer code change during registrant change

This commit is contained in:
olegphenomenon 2023-01-03 11:54:04 +02:00
parent e2c6c9ef97
commit 8916bcd0d6
4 changed files with 31 additions and 186 deletions

View file

@ -68,6 +68,7 @@ module Actions
I18n.t(:object_status_prohibits_operation)) I18n.t(:object_status_prohibits_operation))
else else
domain.registrant = new_registrant domain.registrant = new_registrant
domain.transfer_code = SecureRandom.hex
end end
end end

View file

@ -9,13 +9,6 @@ SET xmloption = content;
SET client_min_messages = warning; SET client_min_messages = warning;
SET row_security = off; SET row_security = off;
--
-- Name: public; Type: SCHEMA; Schema: -; Owner: -
--
-- *not* creating schema, since initdb creates it
-- --
-- Name: btree_gin; Type: EXTENSION; Schema: -; Owner: - -- Name: btree_gin; Type: EXTENSION; Schema: -; Owner: -
-- --
@ -977,14 +970,15 @@ CREATE TABLE public.domains (
pending_json jsonb, pending_json jsonb,
force_delete_date date, force_delete_date date,
statuses character varying[], statuses character varying[],
status_notes public.hstore, statuses_before_force_delete character varying[] DEFAULT '{}'::character varying[],
upid integer, upid integer,
up_date timestamp without time zone, up_date timestamp without time zone,
uuid uuid DEFAULT public.gen_random_uuid() NOT NULL, uuid uuid DEFAULT public.gen_random_uuid() NOT NULL,
locked_by_registrant_at timestamp without time zone, locked_by_registrant_at timestamp without time zone,
force_delete_start timestamp without time zone, force_delete_start timestamp without time zone,
force_delete_data public.hstore, force_delete_data public.hstore,
json_statuses_history jsonb json_statuses_history jsonb,
status_notes public.hstore
); );
@ -2309,74 +2303,6 @@ CREATE SEQUENCE public.payment_orders_id_seq
ALTER SEQUENCE public.payment_orders_id_seq OWNED BY public.payment_orders.id; ALTER SEQUENCE public.payment_orders_id_seq OWNED BY public.payment_orders.id;
--
-- Name: pghero_query_stats; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.pghero_query_stats (
id bigint NOT NULL,
database text,
"user" text,
query text,
query_hash bigint,
total_time double precision,
calls bigint,
captured_at timestamp without time zone
);
--
-- Name: pghero_query_stats_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.pghero_query_stats_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: pghero_query_stats_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.pghero_query_stats_id_seq OWNED BY public.pghero_query_stats.id;
--
-- Name: pghero_space_stats; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.pghero_space_stats (
id bigint NOT NULL,
database text,
schema text,
relation text,
size bigint,
captured_at timestamp without time zone
);
--
-- Name: pghero_space_stats_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.pghero_space_stats_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: pghero_space_stats_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.pghero_space_stats_id_seq OWNED BY public.pghero_space_stats.id;
-- --
-- Name: prices; Type: TABLE; Schema: public; Owner: - -- Name: prices; Type: TABLE; Schema: public; Owner: -
-- --
@ -2415,48 +2341,6 @@ CREATE SEQUENCE public.prices_id_seq
ALTER SEQUENCE public.prices_id_seq OWNED BY public.prices.id; ALTER SEQUENCE public.prices_id_seq OWNED BY public.prices.id;
--
-- Name: que_jobs; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.que_jobs (
priority smallint DEFAULT 100 NOT NULL,
run_at timestamp with time zone DEFAULT now() NOT NULL,
job_id bigint NOT NULL,
job_class text NOT NULL,
args json DEFAULT '[]'::json NOT NULL,
error_count integer DEFAULT 0 NOT NULL,
last_error text,
queue text DEFAULT ''::text NOT NULL
);
--
-- Name: TABLE que_jobs; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON TABLE public.que_jobs IS '3';
--
-- Name: que_jobs_job_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.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 public.que_jobs_job_id_seq OWNED BY public.que_jobs.job_id;
-- --
-- Name: registrant_verifications; Type: TABLE; Schema: public; Owner: - -- Name: registrant_verifications; Type: TABLE; Schema: public; Owner: -
-- --
@ -2532,7 +2416,8 @@ CREATE TABLE public.registrars (
settings jsonb DEFAULT '{}'::jsonb NOT NULL, settings jsonb DEFAULT '{}'::jsonb NOT NULL,
legaldoc_optout boolean DEFAULT false NOT NULL, legaldoc_optout boolean DEFAULT false NOT NULL,
legaldoc_optout_comment text, legaldoc_optout_comment text,
email_history character varying email_history character varying,
rate_limit integer
); );
@ -2737,7 +2622,8 @@ CREATE TABLE public.validation_events (
validation_eventable_type character varying, validation_eventable_type character varying,
validation_eventable_id bigint, validation_eventable_id bigint,
created_at timestamp(6) without time zone NOT NULL, created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL updated_at timestamp(6) without time zone NOT NULL,
event_type public.validation_type
); );
@ -3279,20 +3165,6 @@ ALTER TABLE ONLY public.notifications ALTER COLUMN id SET DEFAULT nextval('publi
ALTER TABLE ONLY public.payment_orders ALTER COLUMN id SET DEFAULT nextval('public.payment_orders_id_seq'::regclass); ALTER TABLE ONLY public.payment_orders ALTER COLUMN id SET DEFAULT nextval('public.payment_orders_id_seq'::regclass);
--
-- Name: pghero_query_stats id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.pghero_query_stats ALTER COLUMN id SET DEFAULT nextval('public.pghero_query_stats_id_seq'::regclass);
--
-- Name: pghero_space_stats id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.pghero_space_stats ALTER COLUMN id SET DEFAULT nextval('public.pghero_space_stats_id_seq'::regclass);
-- --
-- Name: prices id; Type: DEFAULT; Schema: public; Owner: - -- Name: prices id; Type: DEFAULT; Schema: public; Owner: -
-- --
@ -3300,13 +3172,6 @@ ALTER TABLE ONLY public.pghero_space_stats ALTER COLUMN id SET DEFAULT nextval('
ALTER TABLE ONLY public.prices ALTER COLUMN id SET DEFAULT nextval('public.prices_id_seq'::regclass); ALTER TABLE ONLY public.prices ALTER COLUMN id SET DEFAULT nextval('public.prices_id_seq'::regclass);
--
-- Name: que_jobs job_id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.que_jobs ALTER COLUMN job_id SET DEFAULT nextval('public.que_jobs_job_id_seq'::regclass);
-- --
-- Name: registrant_verifications id; Type: DEFAULT; Schema: public; Owner: - -- Name: registrant_verifications id; Type: DEFAULT; Schema: public; Owner: -
-- --
@ -3816,22 +3681,6 @@ ALTER TABLE ONLY public.payment_orders
ADD CONSTRAINT payment_orders_pkey PRIMARY KEY (id); ADD CONSTRAINT payment_orders_pkey PRIMARY KEY (id);
--
-- Name: pghero_query_stats pghero_query_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.pghero_query_stats
ADD CONSTRAINT pghero_query_stats_pkey PRIMARY KEY (id);
--
-- Name: pghero_space_stats pghero_space_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.pghero_space_stats
ADD CONSTRAINT pghero_space_stats_pkey PRIMARY KEY (id);
-- --
-- Name: prices prices_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- Name: prices prices_pkey; Type: CONSTRAINT; Schema: public; Owner: -
-- --
@ -3840,14 +3689,6 @@ ALTER TABLE ONLY public.prices
ADD CONSTRAINT prices_pkey PRIMARY KEY (id); ADD CONSTRAINT prices_pkey PRIMARY KEY (id);
--
-- Name: que_jobs que_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.que_jobs
ADD CONSTRAINT que_jobs_pkey PRIMARY KEY (queue, priority, run_at, job_id);
-- --
-- Name: registrant_verifications registrant_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- Name: registrant_verifications registrant_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
-- --
@ -4455,6 +4296,13 @@ CREATE INDEX index_log_domains_on_object ON public.log_domains USING gin (object
CREATE INDEX index_log_domains_on_object_changes ON public.log_domains USING gin (object_changes); CREATE INDEX index_log_domains_on_object_changes ON public.log_domains USING gin (object_changes);
--
-- Name: index_log_domains_on_object_json; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_log_domains_on_object_json ON public.log_domains USING gin (object_json);
-- --
-- Name: index_log_domains_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- Name: index_log_domains_on_whodunnit; Type: INDEX; Schema: public; Owner: -
-- --
@ -4623,20 +4471,6 @@ CREATE INDEX index_notifications_on_registrar_id ON public.notifications USING b
CREATE INDEX index_payment_orders_on_invoice_id ON public.payment_orders USING btree (invoice_id); CREATE INDEX index_payment_orders_on_invoice_id ON public.payment_orders USING btree (invoice_id);
--
-- Name: index_pghero_query_stats_on_database_and_captured_at; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_pghero_query_stats_on_database_and_captured_at ON public.pghero_query_stats USING btree (database, captured_at);
--
-- Name: index_pghero_space_stats_on_database_and_captured_at; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_pghero_space_stats_on_database_and_captured_at ON public.pghero_space_stats USING btree (database, captured_at);
-- --
-- Name: index_prices_on_zone_id; Type: INDEX; Schema: public; Owner: - -- Name: index_prices_on_zone_id; Type: INDEX; Schema: public; Owner: -
-- --
@ -4693,6 +4527,13 @@ CREATE INDEX index_users_on_registrar_id ON public.users USING btree (registrar_
CREATE INDEX index_validation_events_on_event_data ON public.validation_events USING gin (event_data); CREATE INDEX index_validation_events_on_event_data ON public.validation_events USING gin (event_data);
--
-- Name: index_validation_events_on_event_type; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_validation_events_on_event_type ON public.validation_events USING btree (event_type);
-- --
-- Name: index_validation_events_on_validation_eventable; Type: INDEX; Schema: public; Owner: - -- Name: index_validation_events_on_validation_eventable; Type: INDEX; Schema: public; Owner: -
-- --
@ -5438,11 +5279,9 @@ INSERT INTO "schema_migrations" (version) VALUES
('20210708131814'), ('20210708131814'),
('20210729131100'), ('20210729131100'),
('20210729134625'), ('20210729134625'),
('20211028122103'), ('20210827185249'),
('20211028125245'), ('20211029073644'),
('20211029082225'),
('20211124071418'), ('20211124071418'),
('20211124084308'),
('20211125181033'), ('20211125181033'),
('20211125184334'), ('20211125184334'),
('20211126085139'), ('20211126085139'),
@ -5451,6 +5290,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20220113201642'), ('20220113201642'),
('20220113220809'), ('20220113220809'),
('20220124105717'), ('20220124105717'),
('20220216113112'),
('20220228093211'), ('20220228093211'),
('20220316140727'), ('20220316140727'),
('20220406085500'), ('20220406085500'),
@ -5464,7 +5304,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20220715145808'), ('20220715145808'),
('20220818075833'), ('20220818075833'),
('20221011061840'), ('20221011061840'),
('20221206075912'), ('20221031114812'),
('20221206090120'), ('20221206090120'),
('20221206091556'), ('20221206091556'),
('20221207102831'), ('20221207102831'),

View file

@ -514,7 +514,6 @@ class EppDomainUpdateBaseTest < EppTestCase
assert_correct_against_schema response_xml assert_correct_against_schema response_xml
assert_epp_response :completed_successfully assert_epp_response :completed_successfully
refute_includes @domain.statuses, DomainStatus::PENDING_UPDATE refute_includes @domain.statuses, DomainStatus::PENDING_UPDATE
end end
def test_skips_verification_when_provided_registrant_is_the_same_as_current_one def test_skips_verification_when_provided_registrant_is_the_same_as_current_one
@ -559,6 +558,8 @@ class EppDomainUpdateBaseTest < EppTestCase
dispute.update!(starts_at: Time.zone.now, expires_at: Time.zone.now + 5.days, closed: nil) dispute.update!(starts_at: Time.zone.now, expires_at: Time.zone.now + 5.days, closed: nil)
new_registrant = contacts(:william) new_registrant = contacts(:william)
old_transfer_code = @domain.transfer_code
assert @domain.disputed? assert @domain.disputed?
request_xml = <<-XML request_xml = <<-XML
@ -596,6 +597,7 @@ class EppDomainUpdateBaseTest < EppTestCase
assert_not @domain.registrant_verification_asked? assert_not @domain.registrant_verification_asked?
assert_not @domain.disputed? assert_not @domain.disputed?
assert_no_emails assert_no_emails
refute_equal @domain.transfer_code, old_transfer_code
end end
def test_dispute_password_mandatory_when_registrant_changed def test_dispute_password_mandatory_when_registrant_changed

View file

@ -62,6 +62,7 @@ class ReppV1DomainsUpdateTest < ActionDispatch::IntegrationTest
@auth_headers['Content-Type'] = 'application/json' @auth_headers['Content-Type'] = 'application/json'
new_registrant = contacts(:william) new_registrant = contacts(:william)
refute @domain.registrant == new_registrant refute @domain.registrant == new_registrant
old_transfer_code = @domain.transfer_code
payload = { payload = {
domain: { domain: {
@ -80,6 +81,7 @@ class ReppV1DomainsUpdateTest < ActionDispatch::IntegrationTest
assert_equal 1000, json[:code] assert_equal 1000, json[:code]
assert_equal 'Command completed successfully', json[:message] assert_equal 'Command completed successfully', json[:message]
refute_equal old_transfer_code, @domain.transfer_code
assert @domain.registrant.code == new_registrant.code assert @domain.registrant.code == new_registrant.code
refute @domain.statuses.include? DomainStatus::PENDING_UPDATE refute @domain.statuses.include? DomainStatus::PENDING_UPDATE
end end