receipt template

This commit is contained in:
Tria
2026-06-05 17:23:21 +03:00
parent 620607e50c
commit 6786bdd210
12 changed files with 381 additions and 112 deletions

View File

@@ -28,48 +28,50 @@ export class CreatePaymentTable1780639311366 implements MigrationInterface {
`);
await queryRunner.query(`
CREATE TABLE freight.payments (
id uuid NOT NULL DEFAULT uuid_generate_v4(),
CREATE TABLE freight.payments (
id uuid NOT NULL DEFAULT uuid_generate_v4(),
ref_id varchar(255) NOT NULL,
ref_id varchar(255) NOT NULL,
type freight.payments_type_enum NOT NULL,
type freight.payments_type_enum NOT NULL,
method freight.payments_method_enum NOT NULL,
method freight.payments_method_enum NOT NULL,
currency freight.payments_currency_enum NOT NULL,
currency freight.payments_currency_enum NOT NULL,
amount numeric NOT NULL,
amount numeric NOT NULL,
raw_initiation jsonb NOT NULL DEFAULT '{}'::jsonb,
raw_initiation jsonb NOT NULL DEFAULT '{}'::jsonb,
client_action json,
client_action json,
merchant_order_id varchar(255) NOT NULL,
merchant_order_id varchar(255) NOT NULL,
transaction_id varchar(255),
transaction_id varchar(255),
status freight.payments_status_enum NOT NULL DEFAULT 'action-required',
status freight.payments_status_enum NOT NULL DEFAULT 'action-required',
paid_at date,
paid_at date,
refunded_at date,
refunded_at date,
expires_at date,
expires_at date,
failer_code varchar(30),
failer_code varchar(30),
failer_message varchar(255),
failer_message varchar(255),
created_at TIMESTAMP NOT NULL DEFAULT now(),
reason varchar(255),
CONSTRAINT PK_payments PRIMARY KEY (id),
created_at TIMESTAMP NOT NULL DEFAULT now(),
CONSTRAINT UQ_payments_merchant_order_id UNIQUE (merchant_order_id),
CONSTRAINT PK_payments PRIMARY KEY (id),
CONSTRAINT UQ_payments_transaction_id UNIQUE (transaction_id)
);
`);
CONSTRAINT UQ_payments_merchant_order_id UNIQUE (merchant_order_id),
CONSTRAINT UQ_payments_transaction_id UNIQUE (transaction_id)
);
`);
}
public async down(queryRunner: QueryRunner): Promise<void> {

View File

@@ -1,31 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddReasonToPayment1780662035273 implements MigrationInterface {
name = "AddReasonToPayment1780662035273";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE freight.payments
ADD COLUMN reason varchar(255)
`);
await queryRunner.query(`
ALTER TABLE freight.payments
ADD CONSTRAINT UQ_payments_reason UNIQUE (reason)
`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE freight.payments
DROP CONSTRAINT UQ_payments_reason
`);
await queryRunner.query(`
ALTER TABLE freight.payments
DROP COLUMN reason
`);
}
}