mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
62 lines
2.0 KiB
TypeScript
62 lines
2.0 KiB
TypeScript
import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryGeneratedColumn } from "typeorm";
|
|
|
|
|
|
type PaymentType = "booking"
|
|
type PaymentMethod = "telebirr" | "cbe-birr" | "ebirr"
|
|
type Currency = "ETB" | "USD"
|
|
type PaymentStatus = "action-required" | "processing" | "success" | "failed" | "canceled" | "refunded"
|
|
|
|
@Entity({ schema: 'freight', name: 'payments' })
|
|
export class PaymentEntity extends BaseEntity {
|
|
@PrimaryGeneratedColumn("uuid")
|
|
id!: string
|
|
|
|
@Column({ type: 'varchar', length: 255, name: "ref_id" })
|
|
refId!: string
|
|
|
|
@Column({ type: "enum", enum: ["booking"] })
|
|
type!: PaymentType;
|
|
|
|
@Column({ type: "enum", enum: ["telebirr", "cbe-birr", "ebirr"] })
|
|
method!: PaymentMethod
|
|
|
|
@Column({ type: "enum", enum: ["ETB", "USD"] })
|
|
currency!: Currency
|
|
|
|
@Column({ type: "numeric" })
|
|
amount!: number
|
|
|
|
@Column({ type: "jsonb", default: {}, name: "raw_initiation" })
|
|
rawInitiation?: Record<string, unknown>
|
|
|
|
@Column({ type: "jsonb", name: "client_action" })
|
|
clientAction?: Record<string, unknown>;
|
|
|
|
@Column({ type: "varchar", length: 255, unique: true, name: "merchant_order_id", })
|
|
merchantOrderId!: string
|
|
|
|
@Column({ type: "varchar", length: 255, unique: true, name: "transaction_id", })
|
|
transactionId?: string
|
|
|
|
@Column({ type: "enum", enum: ["action-required", "processing", "success", "failed", "canceled", "refunded"], default: "action-required" })
|
|
status!: PaymentStatus
|
|
|
|
@Column({ type: "date", nullable: true, name: "paid_at" })
|
|
paidAt?: Date
|
|
|
|
@Column({ type: "timestamp", nullable: true, name: "refunded_at" })
|
|
refundedAt?: Date
|
|
|
|
@Column({ type: "timestamp", nullable: true, name: "expires_at" })
|
|
expiresAt?: Date
|
|
|
|
@Column({ type: "varchar", length: 30, nullable: true, name: "failer_code" })
|
|
failerCode?: string
|
|
|
|
@Column({ type: "varchar", length: 255, nullable: true, name: "failer_message" })
|
|
failureMessage?: string
|
|
|
|
@CreateDateColumn({ name: "created_at" })
|
|
createdAt!: Date
|
|
|
|
} |