mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 04:37:30 +02:00
Add PaperTrail history to PaymentOrders
This commit is contained in:
parent
ec5ff5dc8c
commit
fa1687baf0
5 changed files with 80 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
class PaymentOrder < ApplicationRecord
|
class PaymentOrder < ApplicationRecord
|
||||||
#include Versions
|
include Versions
|
||||||
include ActionView::Helpers::NumberHelper
|
include ActionView::Helpers::NumberHelper
|
||||||
|
|
||||||
PAYMENT_INTERMEDIARIES = ENV['payments_intermediaries'].to_s.strip.split(', ').freeze
|
PAYMENT_INTERMEDIARIES = ENV['payments_intermediaries'].to_s.strip.split(', ').freeze
|
||||||
|
|
4
app/models/version/payment_order_version.rb
Normal file
4
app/models/version/payment_order_version.rb
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
class PaymentOrderVersion < PaperTrail::Version
|
||||||
|
self.table_name = :log_payment_orders
|
||||||
|
self.sequence_name = :log_payment_orders_id_seq
|
||||||
|
end
|
|
@ -6,6 +6,8 @@ class CreatePaymentOrders < ActiveRecord::Migration[5.0]
|
||||||
t.belongs_to :invoice, foreign_key: true
|
t.belongs_to :invoice, foreign_key: true
|
||||||
t.jsonb :response, null: true
|
t.jsonb :response, null: true
|
||||||
t.string :notes, null: true
|
t.string :notes, null: true
|
||||||
|
t.string :creator_str
|
||||||
|
t.string :updator_str
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|
16
db/migrate/20200203143458_create_payment_order_versions.rb
Normal file
16
db/migrate/20200203143458_create_payment_order_versions.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
class CreatePaymentOrderVersions < ActiveRecord::Migration[5.0]
|
||||||
|
def change
|
||||||
|
create_table :log_payment_orders do |t|
|
||||||
|
t.string :item_type, null: false
|
||||||
|
t.integer :item_id, null: false
|
||||||
|
t.string :event, null: false
|
||||||
|
t.string :whodunnit
|
||||||
|
t.jsonb :object
|
||||||
|
t.jsonb :object_changes
|
||||||
|
t.datetime :created_at
|
||||||
|
t.string :session
|
||||||
|
t.jsonb :children
|
||||||
|
t.string :uuid
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1514,6 +1514,44 @@ CREATE SEQUENCE public.log_notifications_id_seq
|
||||||
ALTER SEQUENCE public.log_notifications_id_seq OWNED BY public.log_notifications.id;
|
ALTER SEQUENCE public.log_notifications_id_seq OWNED BY public.log_notifications.id;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: log_payment_orders; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE public.log_payment_orders (
|
||||||
|
id integer NOT NULL,
|
||||||
|
item_type character varying NOT NULL,
|
||||||
|
item_id integer NOT NULL,
|
||||||
|
event character varying NOT NULL,
|
||||||
|
whodunnit character varying,
|
||||||
|
object jsonb,
|
||||||
|
object_changes jsonb,
|
||||||
|
created_at timestamp without time zone,
|
||||||
|
session character varying,
|
||||||
|
children jsonb,
|
||||||
|
uuid character varying
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: log_payment_orders_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE SEQUENCE public.log_payment_orders_id_seq
|
||||||
|
START WITH 1
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MINVALUE
|
||||||
|
NO MAXVALUE
|
||||||
|
CACHE 1;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: log_payment_orders_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER SEQUENCE public.log_payment_orders_id_seq OWNED BY public.log_payment_orders.id;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: log_registrant_verifications; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
-- Name: log_registrant_verifications; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -1828,6 +1866,8 @@ CREATE TABLE public.payment_orders (
|
||||||
invoice_id integer,
|
invoice_id integer,
|
||||||
response jsonb,
|
response jsonb,
|
||||||
notes character varying,
|
notes character varying,
|
||||||
|
creator_str character varying,
|
||||||
|
updator_str character varying,
|
||||||
created_at timestamp without time zone NOT NULL,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone NOT NULL
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
@ -2533,6 +2573,13 @@ ALTER TABLE ONLY public.log_nameservers ALTER COLUMN id SET DEFAULT nextval('pub
|
||||||
ALTER TABLE ONLY public.log_notifications ALTER COLUMN id SET DEFAULT nextval('public.log_notifications_id_seq'::regclass);
|
ALTER TABLE ONLY public.log_notifications ALTER COLUMN id SET DEFAULT nextval('public.log_notifications_id_seq'::regclass);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.log_payment_orders ALTER COLUMN id SET DEFAULT nextval('public.log_payment_orders_id_seq'::regclass);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
|
@ -2945,6 +2992,14 @@ ALTER TABLE ONLY public.log_notifications
|
||||||
ADD CONSTRAINT log_notifications_pkey PRIMARY KEY (id);
|
ADD CONSTRAINT log_notifications_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: log_payment_orders_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.log_payment_orders
|
||||||
|
ADD CONSTRAINT log_payment_orders_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: log_registrant_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
-- Name: log_registrant_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -4404,6 +4459,7 @@ INSERT INTO "schema_migrations" (version) VALUES
|
||||||
('20191227110904'),
|
('20191227110904'),
|
||||||
('20200113091254'),
|
('20200113091254'),
|
||||||
('20200115102202'),
|
('20200115102202'),
|
||||||
('20200130092113');
|
('20200130092113'),
|
||||||
|
('20200203143458');
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue