Spaces:
Sleeping
Sleeping
modify payment
Browse files
backend/src/entities/payment.entity.ts
CHANGED
@@ -7,8 +7,6 @@ import {
|
|
7 |
Relation,
|
8 |
} from 'typeorm';
|
9 |
import { OrderEntity } from './order.entity.js';
|
10 |
-
import { PaymentMethod } from '../common/enums/PaymentMethod.enum.js';
|
11 |
-
import { VnpCardType } from '../common/enums/VnpCardType.enum.js';
|
12 |
|
13 |
@Entity('payments')
|
14 |
export class PaymentEntity extends BaseEntity {
|
@@ -18,36 +16,33 @@ export class PaymentEntity extends BaseEntity {
|
|
18 |
@OneToOne(() => OrderEntity, (a) => a.payment)
|
19 |
order: Relation<OrderEntity>;
|
20 |
|
21 |
-
@Column({
|
22 |
-
payment_method:
|
23 |
|
24 |
@Column()
|
25 |
vnp_amount: number
|
26 |
|
27 |
-
@Column()
|
28 |
vnp_bank_code: string
|
29 |
|
30 |
-
@Column()
|
31 |
vnp_bank_tran_no:string
|
32 |
|
33 |
-
@Column({
|
34 |
-
vnp_card_type:
|
35 |
|
36 |
-
@Column()
|
37 |
-
vnp_order_info: string
|
38 |
|
39 |
-
@Column()
|
40 |
vnp_paydate: string
|
41 |
|
42 |
-
@Column()
|
43 |
vnp_response_code: number
|
44 |
|
45 |
-
@Column()
|
46 |
vnp_transaction_no: string
|
47 |
|
48 |
-
@Column()
|
49 |
vnp_transaction_status: number
|
50 |
-
|
51 |
-
@Column()
|
52 |
-
vnp_securehash: string
|
53 |
}
|
|
|
7 |
Relation,
|
8 |
} from 'typeorm';
|
9 |
import { OrderEntity } from './order.entity.js';
|
|
|
|
|
10 |
|
11 |
@Entity('payments')
|
12 |
export class PaymentEntity extends BaseEntity {
|
|
|
16 |
@OneToOne(() => OrderEntity, (a) => a.payment)
|
17 |
order: Relation<OrderEntity>;
|
18 |
|
19 |
+
@Column({ default: 0 })
|
20 |
+
payment_method: number;
|
21 |
|
22 |
@Column()
|
23 |
vnp_amount: number
|
24 |
|
25 |
+
@Column({ nullable: true })
|
26 |
vnp_bank_code: string
|
27 |
|
28 |
+
@Column({ nullable: true })
|
29 |
vnp_bank_tran_no:string
|
30 |
|
31 |
+
@Column({ default: 0})
|
32 |
+
vnp_card_type: number
|
33 |
|
34 |
+
@Column({ nullable: true })
|
35 |
+
vnp_order_info: string //Nội dung giao dịch
|
36 |
|
37 |
+
@Column({ nullable: true })
|
38 |
vnp_paydate: string
|
39 |
|
40 |
+
@Column({ nullable: true })
|
41 |
vnp_response_code: number
|
42 |
|
43 |
+
@Column({ nullable: true })
|
44 |
vnp_transaction_no: string
|
45 |
|
46 |
+
@Column({ nullable: true })
|
47 |
vnp_transaction_status: number
|
|
|
|
|
|
|
48 |
}
|
backend/src/migrations/{1730648552709-modify_payment.ts → 1730650476355-modify_payment.ts}
RENAMED
@@ -1,36 +1,40 @@
|
|
1 |
import { MigrationInterface, QueryRunner } from "typeorm";
|
2 |
|
3 |
-
export class
|
4 |
-
name = '
|
5 |
|
6 |
public async up(queryRunner: QueryRunner): Promise<void> {
|
7 |
-
await queryRunner.query(`ALTER
|
8 |
-
await queryRunner.query(`
|
9 |
-
await queryRunner.query(`
|
10 |
-
await queryRunner.query(`ALTER TABLE "payments"
|
11 |
-
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "
|
12 |
-
await queryRunner.query(`
|
13 |
-
await queryRunner.query(`ALTER
|
14 |
-
await queryRunner.query(`
|
15 |
-
await queryRunner.query(`ALTER TABLE "payments"
|
16 |
-
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "
|
17 |
-
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "
|
18 |
-
await queryRunner.query(`
|
|
|
|
|
19 |
}
|
20 |
|
21 |
public async down(queryRunner: QueryRunner): Promise<void> {
|
22 |
-
await queryRunner.query(`
|
23 |
-
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "
|
24 |
-
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "
|
25 |
-
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "
|
26 |
-
await queryRunner.query(`
|
27 |
-
await queryRunner.query(`ALTER
|
28 |
-
await queryRunner.query(`CREATE TYPE "public"."
|
29 |
-
await queryRunner.query(`ALTER TABLE "payments"
|
30 |
-
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "
|
31 |
-
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "
|
32 |
-
await queryRunner.query(`
|
33 |
-
await queryRunner.query(`
|
|
|
|
|
34 |
}
|
35 |
|
36 |
}
|
|
|
1 |
import { MigrationInterface, QueryRunner } from "typeorm";
|
2 |
|
3 |
+
export class ModifyPayment1730650476355 implements MigrationInterface {
|
4 |
+
name = 'ModifyPayment1730650476355'
|
5 |
|
6 |
public async up(queryRunner: QueryRunner): Promise<void> {
|
7 |
+
await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_securehash"`);
|
8 |
+
await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "payment_method"`);
|
9 |
+
await queryRunner.query(`DROP TYPE "public"."payments_payment_method_enum"`);
|
10 |
+
await queryRunner.query(`ALTER TABLE "payments" ADD "payment_method" integer NOT NULL DEFAULT '0'`);
|
11 |
+
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_bank_code" DROP NOT NULL`);
|
12 |
+
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_bank_tran_no" DROP NOT NULL`);
|
13 |
+
await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_card_type"`);
|
14 |
+
await queryRunner.query(`DROP TYPE "public"."payments_vnp_card_type_enum"`);
|
15 |
+
await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_card_type" integer NOT NULL DEFAULT '0'`);
|
16 |
+
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_order_info" DROP NOT NULL`);
|
17 |
+
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_paydate" DROP NOT NULL`);
|
18 |
+
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_response_code" DROP NOT NULL`);
|
19 |
+
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_transaction_no" DROP NOT NULL`);
|
20 |
+
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_transaction_status" DROP NOT NULL`);
|
21 |
}
|
22 |
|
23 |
public async down(queryRunner: QueryRunner): Promise<void> {
|
24 |
+
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_transaction_status" SET NOT NULL`);
|
25 |
+
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_transaction_no" SET NOT NULL`);
|
26 |
+
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_response_code" SET NOT NULL`);
|
27 |
+
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_paydate" SET NOT NULL`);
|
28 |
+
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_order_info" SET NOT NULL`);
|
29 |
+
await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_card_type"`);
|
30 |
+
await queryRunner.query(`CREATE TYPE "public"."payments_vnp_card_type_enum" AS ENUM('0', '1', '2')`);
|
31 |
+
await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_card_type" "public"."payments_vnp_card_type_enum" NOT NULL DEFAULT '0'`);
|
32 |
+
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_bank_tran_no" SET NOT NULL`);
|
33 |
+
await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_bank_code" SET NOT NULL`);
|
34 |
+
await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "payment_method"`);
|
35 |
+
await queryRunner.query(`CREATE TYPE "public"."payments_payment_method_enum" AS ENUM('0', '1', '2')`);
|
36 |
+
await queryRunner.query(`ALTER TABLE "payments" ADD "payment_method" "public"."payments_payment_method_enum" NOT NULL DEFAULT '0'`);
|
37 |
+
await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_securehash" character varying NOT NULL`);
|
38 |
}
|
39 |
|
40 |
}
|