payment method

This commit is contained in:
2025-11-23 11:31:33 +03:30
parent 8a42b258ac
commit 969ff6a163
6 changed files with 31 additions and 49 deletions
+11 -10
View File
@@ -318,7 +318,7 @@ export class CartService {
}
cart.paymentMethodId = setPaymentMethodDto.paymentMethodId;
cart.paymentMethodFee = Number(restaurantPaymentMethod.price) || 0;
// cart.paymentMethodFee = Number(restaurantPaymentMethod.price) || 0;
// Recalculate cart totals to include payment method fee
await this.recalculateCartTotals(cart);
@@ -374,15 +374,16 @@ export class CartService {
// Get payment method fee if payment method is set
let paymentMethodFee = 0;
if (cart.paymentMethodId) {
const restaurantPaymentMethod = await this.em.findOne(RestaurantPaymentMethod, {
restaurant: { id: cart.restaurantId },
paymentMethod: { id: cart.paymentMethodId },
});
if (restaurantPaymentMethod) {
paymentMethodFee = Number(restaurantPaymentMethod.price) || 0;
}
}
// if (cart.paymentMethodId) {
// const restaurantPaymentMethod = await this.em.findOne(RestaurantPaymentMethod, {
// restaurant: { id: cart.restaurantId },
// paymentMethod: { id: cart.paymentMethodId },
// });
// if (restaurantPaymentMethod) {
// paymentMethodFee = Number(restaurantPaymentMethod.price) || 0;
// paymentMethodFee = 1;
// }
// }
cart.paymentMethodFee = paymentMethodFee;
// Final price includes items, discounts, VAT, and payment method fee