refactor step 2
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { PaymentMethodEnum, PaymentGatewayEnum } from '../../modules/payments/interface/payment';
|
||||
|
||||
export interface PaymentMethodData {
|
||||
title: string;
|
||||
method: PaymentMethodEnum;
|
||||
description: string;
|
||||
enabled: boolean;
|
||||
@@ -12,15 +11,14 @@ export interface PaymentMethodData {
|
||||
|
||||
export const paymentMethodsData: PaymentMethodData[] = [
|
||||
{
|
||||
title: 'پرداخت در محل',
|
||||
method: PaymentMethodEnum.CardOnDelivery,
|
||||
description: 'پرداخت در محل تحویل',
|
||||
method: PaymentMethodEnum.Online,
|
||||
description: 'درگاه پرداخت زرینپال',
|
||||
enabled: true,
|
||||
order: 1,
|
||||
gateway: null,
|
||||
gateway: PaymentGatewayEnum.ZarinPal,
|
||||
merchantId: 'b6f55bd0-6eae-4045-aeb8-07d084fa8f73',
|
||||
},
|
||||
{
|
||||
title: 'نقدی',
|
||||
method: PaymentMethodEnum.Cash,
|
||||
description: 'پرداخت نقدی',
|
||||
enabled: true,
|
||||
@@ -28,20 +26,10 @@ export const paymentMethodsData: PaymentMethodData[] = [
|
||||
gateway: null,
|
||||
},
|
||||
{
|
||||
title: 'زرینپال',
|
||||
method: PaymentMethodEnum.Online,
|
||||
description: 'درگاه پرداخت زرینپال',
|
||||
enabled: true,
|
||||
order: 3,
|
||||
gateway: PaymentGatewayEnum.ZarinPal,
|
||||
merchantId: 'b6f55bd0-6eae-4045-aeb8-07d084fa8f73',
|
||||
},
|
||||
{
|
||||
title: 'کیف پول',
|
||||
method: PaymentMethodEnum.Wallet,
|
||||
description: 'پرداخت از کیف پول',
|
||||
enabled: true,
|
||||
order: 4,
|
||||
order: 3,
|
||||
gateway: null,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -30,8 +30,6 @@ export class FoodsSeeder {
|
||||
restaurant,
|
||||
category,
|
||||
isActive: foodData.isActive,
|
||||
stock: foodData.stock,
|
||||
stockDefault: foodData.stockDefault,
|
||||
sat: false,
|
||||
sun: false,
|
||||
mon: false,
|
||||
|
||||
@@ -17,7 +17,6 @@ export class PaymentMethodsSeeder {
|
||||
if (!existing) {
|
||||
const paymentMethod = em.create(PaymentMethod, {
|
||||
restaurant,
|
||||
title: methodData.title,
|
||||
method: methodData.method,
|
||||
description: methodData.description,
|
||||
enabled: methodData.enabled,
|
||||
@@ -29,12 +28,10 @@ export class PaymentMethodsSeeder {
|
||||
} else {
|
||||
// Update existing payment method if needed
|
||||
if (
|
||||
existing.title !== methodData.title ||
|
||||
existing.description !== methodData.description ||
|
||||
existing.enabled !== methodData.enabled ||
|
||||
existing.order !== methodData.order
|
||||
) {
|
||||
existing.title = methodData.title;
|
||||
existing.description = methodData.description;
|
||||
existing.enabled = methodData.enabled;
|
||||
existing.order = methodData.order;
|
||||
|
||||
Reference in New Issue
Block a user