delivery
This commit is contained in:
@@ -45,7 +45,7 @@ export class CartService {
|
||||
restaurantId,
|
||||
restaurantName: restaurant.name,
|
||||
items: [],
|
||||
deliveryFee: 0,
|
||||
shipmentFee: 0,
|
||||
subTotal: 0,
|
||||
itemsDiscount: 0,
|
||||
couponDiscount: 0,
|
||||
@@ -449,7 +449,7 @@ export class CartService {
|
||||
}
|
||||
|
||||
cart.paymentMethodId = setPaymentMethodDto.paymentMethodId;
|
||||
// cart.deliveryFee = Number(restaurantPaymentMethod.price) || 0;
|
||||
// cart.shipmentFee = Number(restaurantPaymentMethod.price) || 0;
|
||||
|
||||
// Recalculate cart totals to include delivery fee
|
||||
await this.recalculateCartTotals(cart);
|
||||
@@ -505,22 +505,22 @@ export class CartService {
|
||||
|
||||
cart.tax = tax;
|
||||
|
||||
// Get delivery fee if payment method is set
|
||||
let deliveryFee = 0;
|
||||
// Get shipment fee if payment method is set
|
||||
let shipmentFee = 0;
|
||||
// if (cart.paymentMethodId) {
|
||||
// const restaurantPaymentMethod = await this.em.findOne(RestaurantPaymentMethod, {
|
||||
// restaurant: { id: cart.restaurantId },
|
||||
// paymentMethod: { id: cart.paymentMethodId },
|
||||
// });
|
||||
// if (restaurantPaymentMethod) {
|
||||
// deliveryFee = Number(restaurantPaymentMethod.price) || 0;
|
||||
// deliveryFee = 1;
|
||||
// shipmentFee = Number(restaurantPaymentMethod.price) || 0;
|
||||
// shipmentFee = 1;
|
||||
// }
|
||||
// }
|
||||
cart.deliveryFee = deliveryFee;
|
||||
cart.shipmentFee = shipmentFee;
|
||||
|
||||
// Calculate total: total = subtotal – totalDiscount + tax + deliveryFee
|
||||
cart.total = subTotal - cart.totalDiscount + tax + deliveryFee;
|
||||
// Calculate total: total = subtotal – totalDiscount + tax + shipmentFee
|
||||
cart.total = subTotal - cart.totalDiscount + tax + shipmentFee;
|
||||
cart.totalItems = totalItems;
|
||||
cart.updatedAt = new Date().toISOString();
|
||||
}
|
||||
@@ -542,7 +542,7 @@ export class CartService {
|
||||
typeof cart.couponDiscount === 'number' &&
|
||||
typeof cart.totalDiscount === 'number' &&
|
||||
typeof cart.tax === 'number' &&
|
||||
typeof cart.deliveryFee === 'number' &&
|
||||
typeof cart.shipmentFee === 'number' &&
|
||||
typeof cart.total === 'number' &&
|
||||
typeof cart.totalItems === 'number' &&
|
||||
typeof cart.createdAt === 'string' &&
|
||||
|
||||
Reference in New Issue
Block a user