add payment text
Some checks failed
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled
CI/CD / Deploy binary to server (push) Has been cancelled

This commit is contained in:
2026-09-30 16:26:38 +05:00
parent 7e403dab13
commit ebedeba009
19 changed files with 1387 additions and 23 deletions

View File

@@ -601,6 +601,11 @@ CREATE TABLE IF NOT EXISTS visa_master_order_payments (
gateway_status character varying(32) NOT NULL DEFAULT 'pending',
gateway_reference character varying(255),
gateway_response jsonb,
-- orderNumber sent to GBÜS register.do and shown on its hosted payment
-- page ("Номер заказа"): ddMMyyHHmmss in Ashgabat time, e.g.
-- 290926133808 for 29.09.2026 13:38:08. GBÜS rejects a repeated
-- orderNumber per merchant, hence the unique index below.
order_number character varying(32),
created_by bigint,
created_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
updated_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
@@ -615,6 +620,8 @@ CREATE TABLE IF NOT EXISTS visa_master_order_payments (
CREATE INDEX IF NOT EXISTS visa_master_order_payments_order_id_idx ON visa_master_order_payments (order_id);
CREATE INDEX IF NOT EXISTS visa_master_order_payments_user_id_idx ON visa_master_order_payments (user_id);
CREATE UNIQUE INDEX IF NOT EXISTS visa_master_order_payments_order_number_idx
ON visa_master_order_payments (order_number);
-- Every individual step taken while processing a payout (validated, rate
-- fetched, gateway request sent, gateway response received, order marked

View File

@@ -1,2 +0,0 @@
DROP INDEX IF EXISTS visa_master_order_payments_order_number_idx;
ALTER TABLE visa_master_order_payments DROP COLUMN IF EXISTS order_number;

View File

@@ -1,13 +0,0 @@
-- order_number is the orderNumber sent to GBÜS register.do and shown on its
-- hosted payment page ("Номер заказа"): ddMMyyHHmmss in Ashgabat time, e.g.
-- 290926133808 for 29.09.2026 13:38:08. GBÜS rejects a repeated orderNumber
-- per merchant, hence the unique index. Rows made before this column keep
-- the vmo-<order>-<payment> number they were actually registered with.
ALTER TABLE visa_master_order_payments ADD COLUMN IF NOT EXISTS order_number character varying(32);
UPDATE visa_master_order_payments
SET order_number = 'vmo-' || order_id || '-' || id
WHERE order_number IS NULL;
CREATE UNIQUE INDEX IF NOT EXISTS visa_master_order_payments_order_number_idx
ON visa_master_order_payments (order_number);

View File

@@ -0,0 +1 @@
DROP TABLE IF EXISTS payment_texts;

View File

@@ -0,0 +1,23 @@
-- Admin-editable texts shown to clients around a visa/master/sber payout
-- (e.g. the warning before paying). Clients look a text up by its fixed
-- code, so codes are seeded here and never created/deleted from the admin
-- UI - only name/text/is_active are editable. text is {"tm","ru","en"}.
CREATE TABLE IF NOT EXISTS payment_texts (
id bigserial PRIMARY KEY,
code character varying(64) NOT NULL,
name character varying(255) NOT NULL,
text jsonb NOT NULL DEFAULT '{"tm":"","ru":"","en":""}'::jsonb,
is_active boolean NOT NULL DEFAULT true,
updated_by bigint,
updated_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
CONSTRAINT payment_texts_code_key UNIQUE (code),
CONSTRAINT payment_texts_updated_by_fkey
FOREIGN KEY (updated_by) REFERENCES users(id) ON DELETE SET NULL
);
INSERT INTO payment_texts (code, name, text) VALUES
('payment_warning_text', 'Visa/Master töleg duýduryş',
'{"tm":"Dogry töleg aýyny saýlamagyňyzy haýyş edýäris","ru":"","en":""}'::jsonb),
('sber_payment_warning', 'Sber töleg duýduryş',
'{"tm":"Sber töleg duýduryş","ru":"","en":""}'::jsonb)
ON CONFLICT (code) DO NOTHING;