refactor cart service and DTOs to improve item handling and delivery method compatibility
This commit is contained in:
@@ -31,7 +31,7 @@ export class OrdersService {
|
||||
private readonly orderRepository: OrderRepository,
|
||||
private readonly eventEmitter2: EventEmitter2,
|
||||
// private readonly paymentGatewayService: PaymentGatewayService,
|
||||
) {}
|
||||
) { }
|
||||
|
||||
async checkout(userId: string, restaurantId: string) {
|
||||
const cart = await this.cartService.findOneOrFail(userId, restaurantId);
|
||||
@@ -251,8 +251,8 @@ export class OrdersService {
|
||||
restaurant,
|
||||
delivery,
|
||||
paymentMethod,
|
||||
userAddress: cart?.userAddress ?? null,
|
||||
carAddress: cart?.carAddress ?? null,
|
||||
userAddress: delivery.method === DeliveryMethodEnum.DeliveryCourier ? (cart?.userAddress ?? null) : null,
|
||||
carAddress: delivery.method === DeliveryMethodEnum.DeliveryCar ? (cart?.carAddress ?? null) : null,
|
||||
orderItemsData,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user