This commit is contained in:
2025-12-01 10:47:26 +03:30
parent d82c850fab
commit 1bc3ba8cdc
3 changed files with 6 additions and 4 deletions
@@ -12,8 +12,8 @@ export class RestaurantPaymentMethodRepository extends EntityRepository<Restaura
if (!restaurantPaymentMethod) { if (!restaurantPaymentMethod) {
throw new NotFoundException('Restaurant payment method not found'); throw new NotFoundException('Restaurant payment method not found');
} }
await restaurantPaymentMethod.restaurant.load(); // await restaurantPaymentMethod.restaurant.load();
await restaurantPaymentMethod.paymentMethod.load(); // await restaurantPaymentMethod.paymentMethod.load();
return restaurantPaymentMethod; return restaurantPaymentMethod;
} }
} }
@@ -17,7 +17,7 @@ export class PaymentGatewayService {
/** /**
* Generate payment gateway redirect URL for online payment methods * Generate payment gateway redirect URL for online payment methods
*/ */
generateRedirectUrl(order: Order, restaurantPaymentMethod: RestaurantPaymentMethod): Promise<PaymentGatewayRedirect> { generateRedirectUrl(order: Order, restaurantPaymentMethod: RestaurantPaymentMethod): PaymentGatewayRedirect {
const paymentMethod = restaurantPaymentMethod.paymentMethod; const paymentMethod = restaurantPaymentMethod.paymentMethod;
if (!paymentMethod.isOnline) { if (!paymentMethod.isOnline) {
@@ -56,7 +56,7 @@ export class PaymentGatewayService {
callbackUrl: string; callbackUrl: string;
description: string; description: string;
}, },
) { ): string {
// Convert amount to smallest currency unit (e.g., Toman to Rials for Iranian gateways) // Convert amount to smallest currency unit (e.g., Toman to Rials for Iranian gateways)
const amountInSmallestUnit = Math.round(params.amount * 10); // Assuming Toman to Rials conversion const amountInSmallestUnit = Math.round(params.amount * 10); // Assuming Toman to Rials conversion
+2
View File
@@ -102,6 +102,8 @@ export class DatabaseSeeder extends Seeder {
description: 'درگاه پرداخت زرین‌پال', description: 'درگاه پرداخت زرین‌پال',
isActive: true, isActive: true,
order: 1, order: 1,
isOnline: true,
callbackUrl: 'https://www.zarinpal.com/pg/StartPay',
}); });
em.persist(paymentMethod); em.persist(paymentMethod);
} }