add card to card payment method
This commit is contained in:
@@ -976,6 +976,16 @@
|
|||||||
"primary": false,
|
"primary": false,
|
||||||
"unique": false
|
"unique": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"keyName": "restaurants_slug_index",
|
||||||
|
"columnNames": [
|
||||||
|
"slug"
|
||||||
|
],
|
||||||
|
"composite": false,
|
||||||
|
"constraint": false,
|
||||||
|
"primary": false,
|
||||||
|
"unique": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"keyName": "restaurants_slug_is_active_index",
|
"keyName": "restaurants_slug_is_active_index",
|
||||||
"columnNames": [
|
"columnNames": [
|
||||||
@@ -987,16 +997,6 @@
|
|||||||
"primary": false,
|
"primary": false,
|
||||||
"unique": false
|
"unique": false
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"keyName": "restaurants_is_active_index",
|
|
||||||
"columnNames": [
|
|
||||||
"is_active"
|
|
||||||
],
|
|
||||||
"composite": false,
|
|
||||||
"constraint": false,
|
|
||||||
"primary": false,
|
|
||||||
"unique": false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"keyName": "restaurants_pkey",
|
"keyName": "restaurants_pkey",
|
||||||
"columnNames": [
|
"columnNames": [
|
||||||
@@ -1076,7 +1076,8 @@
|
|||||||
"enumItems": [
|
"enumItems": [
|
||||||
"Online",
|
"Online",
|
||||||
"Cash",
|
"Cash",
|
||||||
"Wallet"
|
"Wallet",
|
||||||
|
"Cart"
|
||||||
],
|
],
|
||||||
"mappedType": "enum"
|
"mappedType": "enum"
|
||||||
},
|
},
|
||||||
@@ -1102,6 +1103,16 @@
|
|||||||
"length": 255,
|
"length": 255,
|
||||||
"mappedType": "string"
|
"mappedType": "string"
|
||||||
},
|
},
|
||||||
|
"card_number": {
|
||||||
|
"name": "card_number",
|
||||||
|
"type": "varchar(255)",
|
||||||
|
"unsigned": false,
|
||||||
|
"autoincrement": false,
|
||||||
|
"primary": false,
|
||||||
|
"nullable": true,
|
||||||
|
"length": 255,
|
||||||
|
"mappedType": "string"
|
||||||
|
},
|
||||||
"enabled": {
|
"enabled": {
|
||||||
"name": "enabled",
|
"name": "enabled",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
@@ -1156,6 +1167,16 @@
|
|||||||
"primary": false,
|
"primary": false,
|
||||||
"unique": false
|
"unique": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"keyName": "payment_methods_restaurant_id_index",
|
||||||
|
"columnNames": [
|
||||||
|
"restaurant_id"
|
||||||
|
],
|
||||||
|
"composite": false,
|
||||||
|
"constraint": false,
|
||||||
|
"primary": false,
|
||||||
|
"unique": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"keyName": "payment_methods_restaurant_id_enabled_index",
|
"keyName": "payment_methods_restaurant_id_enabled_index",
|
||||||
"columnNames": [
|
"columnNames": [
|
||||||
@@ -2146,6 +2167,17 @@
|
|||||||
"primary": false,
|
"primary": false,
|
||||||
"unique": false
|
"unique": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"keyName": "categories_restaurant_id_id_index",
|
||||||
|
"columnNames": [
|
||||||
|
"restaurant_id",
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"composite": true,
|
||||||
|
"constraint": false,
|
||||||
|
"primary": false,
|
||||||
|
"unique": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"keyName": "categories_restaurant_id_is_active_index",
|
"keyName": "categories_restaurant_id_is_active_index",
|
||||||
"columnNames": [
|
"columnNames": [
|
||||||
@@ -2419,27 +2451,6 @@
|
|||||||
"primary": false,
|
"primary": false,
|
||||||
"unique": false
|
"unique": false
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"keyName": "foods_is_active_index",
|
|
||||||
"columnNames": [
|
|
||||||
"is_active"
|
|
||||||
],
|
|
||||||
"composite": false,
|
|
||||||
"constraint": false,
|
|
||||||
"primary": false,
|
|
||||||
"unique": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keyName": "foods_category_id_is_active_index",
|
|
||||||
"columnNames": [
|
|
||||||
"category_id",
|
|
||||||
"is_active"
|
|
||||||
],
|
|
||||||
"composite": true,
|
|
||||||
"constraint": false,
|
|
||||||
"primary": false,
|
|
||||||
"unique": false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"keyName": "foods_restaurant_id_is_active_index",
|
"keyName": "foods_restaurant_id_is_active_index",
|
||||||
"columnNames": [
|
"columnNames": [
|
||||||
@@ -2892,17 +2903,6 @@
|
|||||||
"primary": false,
|
"primary": false,
|
||||||
"unique": false
|
"unique": false
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"keyName": "admin_roles_admin_id_restaurant_id_unique",
|
|
||||||
"columnNames": [
|
|
||||||
"admin_id",
|
|
||||||
"restaurant_id"
|
|
||||||
],
|
|
||||||
"composite": true,
|
|
||||||
"constraint": true,
|
|
||||||
"primary": false,
|
|
||||||
"unique": true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"keyName": "admin_roles_pkey",
|
"keyName": "admin_roles_pkey",
|
||||||
"columnNames": [
|
"columnNames": [
|
||||||
@@ -3140,6 +3140,16 @@
|
|||||||
"primary": false,
|
"primary": false,
|
||||||
"unique": false
|
"unique": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"keyName": "schedules_rest_id_index",
|
||||||
|
"columnNames": [
|
||||||
|
"rest_id"
|
||||||
|
],
|
||||||
|
"composite": false,
|
||||||
|
"constraint": false,
|
||||||
|
"primary": false,
|
||||||
|
"unique": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"keyName": "schedules_pkey",
|
"keyName": "schedules_pkey",
|
||||||
"columnNames": [
|
"columnNames": [
|
||||||
@@ -3399,9 +3409,9 @@
|
|||||||
"unique": false
|
"unique": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keyName": "users_is_active_index",
|
"keyName": "users_phone_index",
|
||||||
"columnNames": [
|
"columnNames": [
|
||||||
"is_active"
|
"phone"
|
||||||
],
|
],
|
||||||
"composite": false,
|
"composite": false,
|
||||||
"constraint": false,
|
"constraint": false,
|
||||||
@@ -3556,26 +3566,6 @@
|
|||||||
"primary": false,
|
"primary": false,
|
||||||
"unique": false
|
"unique": false
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"keyName": "point_transactions_restaurant_id_index",
|
|
||||||
"columnNames": [
|
|
||||||
"restaurant_id"
|
|
||||||
],
|
|
||||||
"composite": false,
|
|
||||||
"constraint": false,
|
|
||||||
"primary": false,
|
|
||||||
"unique": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keyName": "point_transactions_user_id_index",
|
|
||||||
"columnNames": [
|
|
||||||
"user_id"
|
|
||||||
],
|
|
||||||
"composite": false,
|
|
||||||
"constraint": false,
|
|
||||||
"primary": false,
|
|
||||||
"unique": false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"keyName": "point_transactions_user_id_restaurant_id_index",
|
"keyName": "point_transactions_user_id_restaurant_id_index",
|
||||||
"columnNames": [
|
"columnNames": [
|
||||||
@@ -3771,6 +3761,16 @@
|
|||||||
"primary": false,
|
"primary": false,
|
||||||
"unique": false
|
"unique": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"keyName": "pagers_restaurant_id_index",
|
||||||
|
"columnNames": [
|
||||||
|
"restaurant_id"
|
||||||
|
],
|
||||||
|
"composite": false,
|
||||||
|
"constraint": false,
|
||||||
|
"primary": false,
|
||||||
|
"unique": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"keyName": "pagers_pkey",
|
"keyName": "pagers_pkey",
|
||||||
"columnNames": [
|
"columnNames": [
|
||||||
@@ -4108,16 +4108,6 @@
|
|||||||
"primary": false,
|
"primary": false,
|
||||||
"unique": false
|
"unique": false
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"keyName": "orders_status_index",
|
|
||||||
"columnNames": [
|
|
||||||
"status"
|
|
||||||
],
|
|
||||||
"composite": false,
|
|
||||||
"constraint": false,
|
|
||||||
"primary": false,
|
|
||||||
"unique": false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"keyName": "orders_restaurant_id_order_number_index",
|
"keyName": "orders_restaurant_id_order_number_index",
|
||||||
"columnNames": [
|
"columnNames": [
|
||||||
@@ -4129,17 +4119,6 @@
|
|||||||
"primary": false,
|
"primary": false,
|
||||||
"unique": false
|
"unique": false
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"keyName": "orders_user_id_status_index",
|
|
||||||
"columnNames": [
|
|
||||||
"user_id",
|
|
||||||
"status"
|
|
||||||
],
|
|
||||||
"composite": true,
|
|
||||||
"constraint": false,
|
|
||||||
"primary": false,
|
|
||||||
"unique": false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"keyName": "orders_restaurant_id_status_index",
|
"keyName": "orders_restaurant_id_status_index",
|
||||||
"columnNames": [
|
"columnNames": [
|
||||||
@@ -4152,15 +4131,14 @@
|
|||||||
"unique": false
|
"unique": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keyName": "orders_restaurant_id_order_number_unique",
|
"keyName": "orders_restaurant_id_index",
|
||||||
"columnNames": [
|
"columnNames": [
|
||||||
"restaurant_id",
|
"restaurant_id"
|
||||||
"order_number"
|
|
||||||
],
|
],
|
||||||
"composite": true,
|
"composite": false,
|
||||||
"constraint": true,
|
"constraint": false,
|
||||||
"primary": false,
|
"primary": false,
|
||||||
"unique": true
|
"unique": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keyName": "orders_pkey",
|
"keyName": "orders_pkey",
|
||||||
@@ -4556,7 +4534,8 @@
|
|||||||
"enumItems": [
|
"enumItems": [
|
||||||
"Online",
|
"Online",
|
||||||
"Cash",
|
"Cash",
|
||||||
"Wallet"
|
"Wallet",
|
||||||
|
"Cart"
|
||||||
],
|
],
|
||||||
"mappedType": "enum"
|
"mappedType": "enum"
|
||||||
},
|
},
|
||||||
@@ -4690,6 +4669,16 @@
|
|||||||
"primary": false,
|
"primary": false,
|
||||||
"unique": false
|
"unique": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"keyName": "payments_order_id_index",
|
||||||
|
"columnNames": [
|
||||||
|
"order_id"
|
||||||
|
],
|
||||||
|
"composite": false,
|
||||||
|
"constraint": false,
|
||||||
|
"primary": false,
|
||||||
|
"unique": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"keyName": "payments_pkey",
|
"keyName": "payments_pkey",
|
||||||
"columnNames": [
|
"columnNames": [
|
||||||
@@ -4849,16 +4838,6 @@
|
|||||||
"primary": false,
|
"primary": false,
|
||||||
"unique": false
|
"unique": false
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"keyName": "order_items_food_id_index",
|
|
||||||
"columnNames": [
|
|
||||||
"food_id"
|
|
||||||
],
|
|
||||||
"composite": false,
|
|
||||||
"constraint": false,
|
|
||||||
"primary": false,
|
|
||||||
"unique": false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"keyName": "order_items_order_id_index",
|
"keyName": "order_items_order_id_index",
|
||||||
"columnNames": [
|
"columnNames": [
|
||||||
@@ -5402,6 +5381,16 @@
|
|||||||
"primary": false,
|
"primary": false,
|
||||||
"unique": false
|
"unique": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"keyName": "user_addresses_user_id_index",
|
||||||
|
"columnNames": [
|
||||||
|
"user_id"
|
||||||
|
],
|
||||||
|
"composite": false,
|
||||||
|
"constraint": false,
|
||||||
|
"primary": false,
|
||||||
|
"unique": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"keyName": "user_addresses_pkey",
|
"keyName": "user_addresses_pkey",
|
||||||
"columnNames": [
|
"columnNames": [
|
||||||
@@ -5569,26 +5558,6 @@
|
|||||||
"primary": false,
|
"primary": false,
|
||||||
"unique": false
|
"unique": false
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"keyName": "wallet_transactions_restaurant_id_index",
|
|
||||||
"columnNames": [
|
|
||||||
"restaurant_id"
|
|
||||||
],
|
|
||||||
"composite": false,
|
|
||||||
"constraint": false,
|
|
||||||
"primary": false,
|
|
||||||
"unique": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"keyName": "wallet_transactions_user_id_index",
|
|
||||||
"columnNames": [
|
|
||||||
"user_id"
|
|
||||||
],
|
|
||||||
"composite": false,
|
|
||||||
"constraint": false,
|
|
||||||
"primary": false,
|
|
||||||
"unique": false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"keyName": "wallet_transactions_user_id_restaurant_id_index",
|
"keyName": "wallet_transactions_user_id_restaurant_id_index",
|
||||||
"columnNames": [
|
"columnNames": [
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import { Migration } from '@mikro-orm/migrations';
|
||||||
|
|
||||||
|
export class Migration20260607124425_add_card_number_to_payment_methods extends Migration {
|
||||||
|
|
||||||
|
override async up(): Promise<void> {
|
||||||
|
this.addSql(`alter table "payment_methods" add column "card_number" varchar(255) null;`);
|
||||||
|
}
|
||||||
|
|
||||||
|
override async down(): Promise<void> {
|
||||||
|
this.addSql(`alter table "payment_methods" drop column "card_number";`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,6 +18,11 @@ export class CreatePaymentMethodDto {
|
|||||||
@IsString()
|
@IsString()
|
||||||
description?: string;
|
description?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Card number for card-to-card payments', required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
cardNumber?: string;
|
||||||
|
|
||||||
@ApiProperty({ description: 'Is payment method enabled', required: false, default: true })
|
@ApiProperty({ description: 'Is payment method enabled', required: false, default: true })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ export class PaymentMethod extends BaseEntity {
|
|||||||
@Property({ nullable: true })
|
@Property({ nullable: true })
|
||||||
description?: string;
|
description?: string;
|
||||||
|
|
||||||
|
@Property({ nullable: true })
|
||||||
|
cardNumber?: string;
|
||||||
|
|
||||||
@Property({ default: true })
|
@Property({ default: true })
|
||||||
enabled: boolean = true;
|
enabled: boolean = true;
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ export enum PaymentMethodEnum {
|
|||||||
Online = 'Online',
|
Online = 'Online',
|
||||||
Cash = 'Cash',
|
Cash = 'Cash',
|
||||||
Wallet = 'Wallet',
|
Wallet = 'Wallet',
|
||||||
|
Cart = 'Cart',
|
||||||
}
|
}
|
||||||
export enum PaymentStatusEnum {
|
export enum PaymentStatusEnum {
|
||||||
Pending = 'pending',
|
Pending = 'pending',
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ export interface PaymentMethodData {
|
|||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
order: number;
|
order: number;
|
||||||
gateway: PaymentGatewayEnum | null;
|
gateway: PaymentGatewayEnum | null;
|
||||||
|
cardNumber?: string;
|
||||||
merchantId?: string;
|
merchantId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export class PaymentMethodsSeeder {
|
|||||||
enabled: methodData.enabled,
|
enabled: methodData.enabled,
|
||||||
order: methodData.order,
|
order: methodData.order,
|
||||||
gateway: methodData.gateway,
|
gateway: methodData.gateway,
|
||||||
|
cardNumber: methodData.cardNumber,
|
||||||
merchantId: methodData.merchantId,
|
merchantId: methodData.merchantId,
|
||||||
});
|
});
|
||||||
em.persist(paymentMethod);
|
em.persist(paymentMethod);
|
||||||
@@ -30,7 +31,8 @@ export class PaymentMethodsSeeder {
|
|||||||
if (
|
if (
|
||||||
existing.description !== methodData.description ||
|
existing.description !== methodData.description ||
|
||||||
existing.enabled !== methodData.enabled ||
|
existing.enabled !== methodData.enabled ||
|
||||||
existing.order !== methodData.order
|
existing.order !== methodData.order ||
|
||||||
|
existing.cardNumber !== methodData.cardNumber
|
||||||
) {
|
) {
|
||||||
existing.description = methodData.description;
|
existing.description = methodData.description;
|
||||||
existing.enabled = methodData.enabled;
|
existing.enabled = methodData.enabled;
|
||||||
@@ -38,6 +40,9 @@ export class PaymentMethodsSeeder {
|
|||||||
if (methodData.gateway !== undefined) {
|
if (methodData.gateway !== undefined) {
|
||||||
existing.gateway = methodData.gateway;
|
existing.gateway = methodData.gateway;
|
||||||
}
|
}
|
||||||
|
if (methodData.cardNumber !== undefined) {
|
||||||
|
existing.cardNumber = methodData.cardNumber;
|
||||||
|
}
|
||||||
if (methodData.merchantId !== undefined) {
|
if (methodData.merchantId !== undefined) {
|
||||||
existing.merchantId = methodData.merchantId;
|
existing.merchantId = methodData.merchantId;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user