Index: .gitignore
===================================================================
--- .gitignore	(revision 67c0445857a17669bb5e337fbbe7edc4ac80509f)
+++ .gitignore	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
@@ -35,3 +35,2 @@
 # Ignore application properties
 src/main/resources/application.properties
-
Index: src/main/java/mk/ukim/finki/easyfood/model/CartItems.java
===================================================================
--- src/main/java/mk/ukim/finki/easyfood/model/CartItems.java	(revision 67c0445857a17669bb5e337fbbe7edc4ac80509f)
+++ src/main/java/mk/ukim/finki/easyfood/model/CartItems.java	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
@@ -42,3 +42,7 @@
         this.quantity = quantity;
     }
+
+    public ShoppingCart getCart() {
+        return cart;
+    }
 }
Index: src/main/java/mk/ukim/finki/easyfood/model/Item.java
===================================================================
--- src/main/java/mk/ukim/finki/easyfood/model/Item.java	(revision 67c0445857a17669bb5e337fbbe7edc4ac80509f)
+++ src/main/java/mk/ukim/finki/easyfood/model/Item.java	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
@@ -88,3 +88,5 @@
         this.description = description;
     }
+
+
 }
Index: src/main/java/mk/ukim/finki/easyfood/model/OrderItems.java
===================================================================
--- src/main/java/mk/ukim/finki/easyfood/model/OrderItems.java	(revision 67c0445857a17669bb5e337fbbe7edc4ac80509f)
+++ src/main/java/mk/ukim/finki/easyfood/model/OrderItems.java	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
@@ -28,3 +28,36 @@
 
     // getters and setters
+
+
+    public Order getOrder() {
+        return order;
+    }
+
+    public void setOrder(Order order) {
+        this.order = order;
+    }
+
+    public Item getItem() {
+        return item;
+    }
+
+    public void setItem(Item item) {
+        this.item = item;
+    }
+
+    public Integer getQuantity() {
+        return quantity;
+    }
+
+    public void setQuantity(Integer quantity) {
+        this.quantity = quantity;
+    }
+
+    public BigDecimal getTotalPrice() {
+        return totalPrice;
+    }
+
+    public void setTotalPrice(BigDecimal totalPrice) {
+        this.totalPrice = totalPrice;
+    }
 }
Index: src/main/java/mk/ukim/finki/easyfood/repository/MenuItemRepository.java
===================================================================
--- src/main/java/mk/ukim/finki/easyfood/repository/MenuItemRepository.java	(revision 67c0445857a17669bb5e337fbbe7edc4ac80509f)
+++ src/main/java/mk/ukim/finki/easyfood/repository/MenuItemRepository.java	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
@@ -8,8 +8,12 @@
 
 import java.util.List;
+import java.util.Optional;
 
 @Repository
 public interface MenuItemRepository extends JpaRepository<MenuItem, Long> {
     List<MenuItem> findByMenu(Menu menu);
+
     List<MenuItem> findByItem(Item item);
+
+    Optional<MenuItem> findFirstByItem(Item item);
 }
Index: src/main/java/mk/ukim/finki/easyfood/repository/OrderItemsRepository.java
===================================================================
--- src/main/java/mk/ukim/finki/easyfood/repository/OrderItemsRepository.java	(revision 67c0445857a17669bb5e337fbbe7edc4ac80509f)
+++ src/main/java/mk/ukim/finki/easyfood/repository/OrderItemsRepository.java	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
@@ -5,5 +5,9 @@
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 @Repository
 public interface OrderItemsRepository extends JpaRepository<OrderItems, Long> {
+    List<OrderItems> findByOrderId(Long orderId);
+
 }
Index: src/main/java/mk/ukim/finki/easyfood/repository/OrderRepository.java
===================================================================
--- src/main/java/mk/ukim/finki/easyfood/repository/OrderRepository.java	(revision 67c0445857a17669bb5e337fbbe7edc4ac80509f)
+++ src/main/java/mk/ukim/finki/easyfood/repository/OrderRepository.java	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
@@ -13,3 +13,7 @@
 
     List<Order> findAllById(Long id);
+
+    List<Order> findByCustomerIdOrderByOrderDateDesc(Long customerId);
 }
+
+
Index: src/main/java/mk/ukim/finki/easyfood/repository/ShoppingCartRepository.java
===================================================================
--- src/main/java/mk/ukim/finki/easyfood/repository/ShoppingCartRepository.java	(revision 67c0445857a17669bb5e337fbbe7edc4ac80509f)
+++ src/main/java/mk/ukim/finki/easyfood/repository/ShoppingCartRepository.java	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
@@ -21,3 +21,5 @@
                 .findFirst();
     }
+
+
 }
Index: src/main/java/mk/ukim/finki/easyfood/service/AddressService.java
===================================================================
--- src/main/java/mk/ukim/finki/easyfood/service/AddressService.java	(revision 67c0445857a17669bb5e337fbbe7edc4ac80509f)
+++ src/main/java/mk/ukim/finki/easyfood/service/AddressService.java	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
@@ -6,4 +6,5 @@
 
 import java.util.List;
+import java.util.Optional;
 
 public interface AddressService {
@@ -20,3 +21,4 @@
 
     Address save(Address address);
+
 }
Index: src/main/java/mk/ukim/finki/easyfood/service/MenuItemService.java
===================================================================
--- src/main/java/mk/ukim/finki/easyfood/service/MenuItemService.java	(revision 67c0445857a17669bb5e337fbbe7edc4ac80509f)
+++ src/main/java/mk/ukim/finki/easyfood/service/MenuItemService.java	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
@@ -1,8 +1,11 @@
 package mk.ukim.finki.easyfood.service;
 
+import mk.ukim.finki.easyfood.model.Item;
 import mk.ukim.finki.easyfood.model.Menu;
 import mk.ukim.finki.easyfood.model.MenuItem;
+import mk.ukim.finki.easyfood.model.Restaurant;
 
 import java.util.List;
+import java.util.Optional;
 
 public interface MenuItemService {
@@ -16,4 +19,6 @@
 
     MenuItem findById(Long id);
+
+    public Optional<Restaurant> getRestaurantByItem(Item item);
 }
 
Index: src/main/java/mk/ukim/finki/easyfood/service/OrderService.java
===================================================================
--- src/main/java/mk/ukim/finki/easyfood/service/OrderService.java	(revision 67c0445857a17669bb5e337fbbe7edc4ac80509f)
+++ src/main/java/mk/ukim/finki/easyfood/service/OrderService.java	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
@@ -1,8 +1,11 @@
 package mk.ukim.finki.easyfood.service;
 
+import mk.ukim.finki.easyfood.model.CartItems;
 import mk.ukim.finki.easyfood.model.DeliveryMan;
 import mk.ukim.finki.easyfood.model.Order;
+import mk.ukim.finki.easyfood.model.OrderItems;
 
 import java.util.List;
+import java.util.Optional;
 
 public interface OrderService {
@@ -12,3 +15,21 @@
 
     List<Order> findAllByUserId(Long id);
+
+    Order save(Order order);
+
+    void saveOrderItem(OrderItems orderItem);
+
+    Optional<Order> findOrderById(Long orderId);
+
+    List<OrderItems> findOrderItemsByOrderId(Long orderId);
+
+    Order createOrderWithItems(Order order, List<CartItems> cartItems);
+
+    Optional<Order> findById(Long orderId);
+
+    List<OrderItems> getOrderItems(Long orderId);
+
+    List<Order> getOrdersByCustomerId(Long customerId);
+
+    void updateOrderStatus(Long orderId, String status);
 }
Index: src/main/java/mk/ukim/finki/easyfood/service/ShoppingCartService.java
===================================================================
--- src/main/java/mk/ukim/finki/easyfood/service/ShoppingCartService.java	(revision 67c0445857a17669bb5e337fbbe7edc4ac80509f)
+++ src/main/java/mk/ukim/finki/easyfood/service/ShoppingCartService.java	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
@@ -4,4 +4,5 @@
 import mk.ukim.finki.easyfood.model.Customer;
 import mk.ukim.finki.easyfood.model.Item;
+import mk.ukim.finki.easyfood.model.ShoppingCart;
 
 import java.math.BigDecimal;
@@ -23,4 +24,12 @@
 
     int getNumberOfItemsInCart(Long customerId);
+
+    public ShoppingCart getActiveShoppingCart(Long userId);
+
+    public void deleteShoppingCart(Long userId);
+
+    List<CartItems> getCartItems(Long customerId);
+
+    void clearCart(Long customerId);
 }
 
Index: src/main/java/mk/ukim/finki/easyfood/service/impl/MenuItemServiceImpl.java
===================================================================
--- src/main/java/mk/ukim/finki/easyfood/service/impl/MenuItemServiceImpl.java	(revision 67c0445857a17669bb5e337fbbe7edc4ac80509f)
+++ src/main/java/mk/ukim/finki/easyfood/service/impl/MenuItemServiceImpl.java	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
@@ -1,6 +1,8 @@
 package mk.ukim.finki.easyfood.service.impl;
 
+import mk.ukim.finki.easyfood.model.Item;
 import mk.ukim.finki.easyfood.model.Menu;
 import mk.ukim.finki.easyfood.model.MenuItem;
+import mk.ukim.finki.easyfood.model.Restaurant;
 import mk.ukim.finki.easyfood.model.exceptions.MenuNotFoundException;
 import mk.ukim.finki.easyfood.repository.MenuItemRepository;
@@ -9,4 +11,5 @@
 
 import java.util.List;
+import java.util.Optional;
 
 @Service
@@ -43,3 +46,12 @@
         return this.menuItemRepository.findById(id).orElseThrow(() -> new MenuNotFoundException(id));
     }
+
+    @Override
+    public Optional<Restaurant> getRestaurantByItem(Item item) {
+        Optional<MenuItem> menuItem = menuItemRepository.findFirstByItem(item);
+        if (menuItem.isPresent()) {
+            return Optional.ofNullable(menuItem.get().getMenu().getRestaurant());
+        }
+        return Optional.empty();
+    }
 }
Index: src/main/java/mk/ukim/finki/easyfood/service/impl/OrderServiceImpl.java
===================================================================
--- src/main/java/mk/ukim/finki/easyfood/service/impl/OrderServiceImpl.java	(revision 67c0445857a17669bb5e337fbbe7edc4ac80509f)
+++ src/main/java/mk/ukim/finki/easyfood/service/impl/OrderServiceImpl.java	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
@@ -1,12 +1,18 @@
 package mk.ukim.finki.easyfood.service.impl;
 
+import mk.ukim.finki.easyfood.model.CartItems;
 import mk.ukim.finki.easyfood.model.DeliveryMan;
 import mk.ukim.finki.easyfood.model.Order;
+import mk.ukim.finki.easyfood.model.OrderItems;
 import mk.ukim.finki.easyfood.repository.DeliveryManRepository;
+import mk.ukim.finki.easyfood.repository.OrderItemsRepository;
 import mk.ukim.finki.easyfood.repository.OrderRepository;
 import mk.ukim.finki.easyfood.service.OrderService;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.util.List;
+import java.util.Optional;
 
 @Service
@@ -14,8 +20,10 @@
     private final OrderRepository orderRepository;
     private final DeliveryManRepository deliveryManRepository;
+    private final OrderItemsRepository orderItemsRepository;
 
-    public OrderServiceImpl(OrderRepository orderRepository, DeliveryManRepository deliveryManRepository) {
+    public OrderServiceImpl(OrderRepository orderRepository, DeliveryManRepository deliveryManRepository, OrderItemsRepository orderItemsRepository) {
         this.orderRepository = orderRepository;
         this.deliveryManRepository = deliveryManRepository;
+        this.orderItemsRepository = orderItemsRepository;
     }
 
@@ -35,3 +43,68 @@
         return this.orderRepository.findAllById(id);
     }
+
+
+    public void saveOrderItem(OrderItems orderItem) {
+        orderItemsRepository.save(orderItem);
+    }
+
+    public Optional<Order> findOrderById(Long orderId) {
+        return orderRepository.findById(orderId);
+    }
+
+    public List<OrderItems> findOrderItemsByOrderId(Long orderId) {
+        return orderItemsRepository.findByOrderId(orderId);
+    }
+
+    @Override
+    @Transactional
+    public Order createOrderWithItems(Order order, List<CartItems> cartItems) {
+        Order savedOrder = orderRepository.save(order);
+
+        for (CartItems cartItem : cartItems) {
+            OrderItems orderItem = new OrderItems();
+            orderItem.setOrder(savedOrder);
+            orderItem.setItem(cartItem.getItem());
+            orderItem.setQuantity(cartItem.getQuantity());
+            orderItem.setTotalPrice(cartItem.getItem().getPrice()
+                    .multiply(BigDecimal.valueOf(cartItem.getQuantity())));
+
+            orderItemsRepository.save(orderItem);
+        }
+
+        return savedOrder;
+    }
+
+
+    @Override
+    public Order save(Order order) {
+        return orderRepository.save(order);
+    }
+
+    @Override
+    public Optional<Order> findById(Long orderId) {
+        return orderRepository.findById(orderId);
+    }
+
+    @Override
+    public List<OrderItems> getOrderItems(Long orderId) {
+        return orderItemsRepository.findByOrderId(orderId);
+    }
+
+    @Override
+    public List<Order> getOrdersByCustomerId(Long customerId) {
+        return orderRepository.findByCustomerIdOrderByOrderDateDesc(customerId);
+    }
+
+    @Override
+    @Transactional
+    public void updateOrderStatus(Long orderId, String status) {
+        Optional<Order> orderOpt = orderRepository.findById(orderId);
+        if (orderOpt.isPresent()) {
+            Order order = orderOpt.get();
+            order.setOrderStatus(status);
+            orderRepository.save(order);
+        }
+    }
+
 }
Index: src/main/java/mk/ukim/finki/easyfood/service/impl/ShoppingCartServiceImp.java
===================================================================
--- src/main/java/mk/ukim/finki/easyfood/service/impl/ShoppingCartServiceImp.java	(revision 67c0445857a17669bb5e337fbbe7edc4ac80509f)
+++ src/main/java/mk/ukim/finki/easyfood/service/impl/ShoppingCartServiceImp.java	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
@@ -153,3 +153,52 @@
                 .sum();
     }
+
+    @Override
+    public ShoppingCart getActiveShoppingCart(Long userId) {
+        // Find by customer ID instead of customer ID and active flag
+        Optional<Customer> customer = customerRepository.findById(userId);
+        if (customer.isPresent()) {
+            return shoppingCartRepository.findByCustomer(customer.get())
+                    .orElse(null);
+        }
+        return null;
+    }
+
+    @Override
+    @Transactional
+    public void clearCart(Long customerId) {
+        Optional<Customer> customerOpt = customerRepository.findById(customerId);
+        if (customerOpt.isPresent()) {
+            Customer customer = customerOpt.get();
+            Optional<ShoppingCart> cartOpt = shoppingCartRepository.findByCustomer(customer);
+
+            if (cartOpt.isPresent()) {
+                ShoppingCart cart = cartOpt.get();
+                // Delete all cart items first
+                if (cart.getCartItems() != null) {
+                    cartItemsRepository.deleteAll(cart.getCartItems());
+                    cart.getCartItems().clear();
+                    shoppingCartRepository.save(cart);
+                }
+            }
+        }
+    }
+
+    @Override
+    @Transactional
+    public void deleteShoppingCart(Long userId) {
+        ShoppingCart cart = getActiveShoppingCart(userId);
+        if (cart != null) {
+            // Delete all cart items first
+            if (cart.getCartItems() != null) {
+                cartItemsRepository.deleteAll(cart.getCartItems());
+            }
+            shoppingCartRepository.delete(cart);
+        }
+    }
+
+    @Override
+    public List<CartItems> getCartItems(Long customerId) {
+        return getItemsInCartByCustomerId(customerId);
+    }
 }
Index: src/main/java/mk/ukim/finki/easyfood/web/controller/OrderController.java
===================================================================
--- src/main/java/mk/ukim/finki/easyfood/web/controller/OrderController.java	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
+++ src/main/java/mk/ukim/finki/easyfood/web/controller/OrderController.java	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
@@ -0,0 +1,283 @@
+package mk.ukim.finki.easyfood.web.controller;
+
+import mk.ukim.finki.easyfood.model.*;
+import mk.ukim.finki.easyfood.service.*;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+@Controller
+@RequestMapping("/order")
+public class OrderController {
+
+    private final UserService userService;
+    private final AddressService addressService;
+    private final OrderService orderService;
+    private final ShoppingCartService cartService;
+    private final RestaurantService restaurantService;
+    private final MenuItemService menuItemService;
+
+    public OrderController(UserService userService, AddressService addressService,
+                           OrderService orderService, ShoppingCartService cartService,
+                           RestaurantService restaurantService, MenuItemService menuItemService) {
+        this.userService = userService;
+        this.addressService = addressService;
+        this.orderService = orderService;
+        this.cartService = cartService;
+        this.restaurantService = restaurantService;
+        this.menuItemService = menuItemService;
+    }
+
+    @GetMapping("/checkout")
+    public String showCheckout(Model model, RedirectAttributes redirectAttributes) {
+        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+
+        if (authentication != null && authentication.isAuthenticated()
+                && !authentication.getName().equals("anonymousUser")) {
+
+            String email = authentication.getName();
+            Optional<Customer> customerOptional = userService.findByEmail(email);
+
+            if (customerOptional.isPresent()) {
+                Customer customer = customerOptional.get();
+
+                List<CartItems> cartItems = cartService.getCartItems(customer.getId());
+
+                if (cartItems.isEmpty()) {
+                    redirectAttributes.addFlashAttribute("errorMessage", "Your cart is empty!");
+                    return "redirect:/cart";
+                }
+
+                // Calculate total amount
+                BigDecimal totalAmount = cartItems.stream()
+                        .map(item -> item.getItem().getPrice().multiply(BigDecimal.valueOf(item.getQuantity())))
+                        .reduce(BigDecimal.ZERO, BigDecimal::add);
+
+                // Get customer addresses
+                List<Address> addresses = customer.getAddresses();
+
+                // Get restaurant (assuming all cart items are from same restaurant)
+                Restaurant restaurant = null;
+                if (!cartItems.isEmpty()) {
+                    Optional<Restaurant> restaurantOpt = menuItemService.getRestaurantByItem(cartItems.get(0).getItem());
+                    restaurant = restaurantOpt.orElse(null);
+                }
+
+                Map<Long, BigDecimal> itemTotals = cartItems.stream()
+                        .collect(Collectors.toMap(
+                                item -> item.getItem().getId(),
+                                item -> item.getItem().getPrice().multiply(BigDecimal.valueOf(item.getQuantity()))
+                        ));
+                model.addAttribute("itemTotals", itemTotals);
+                model.addAttribute("customer", customer);
+                model.addAttribute("addresses", addresses);
+                model.addAttribute("cartItems", cartItems);
+                model.addAttribute("totalAmount", totalAmount);
+                model.addAttribute("restaurant", restaurant);
+
+                return "checkout";
+            }
+        }
+
+        return "redirect:/login";
+    }
+
+    @PostMapping("/place")
+    public String placeOrder(@RequestParam(required = false) Long addressId,
+                             @RequestParam(required = false) String newStreet,
+                             @RequestParam(required = false) String newCity,
+                             @RequestParam(required = false) String newPostalCode,
+                             @RequestParam(required = false) String paymentMethod,
+                             @RequestParam(required = false) String comment,
+                             RedirectAttributes redirectAttributes) {
+
+        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+
+        if (authentication != null && authentication.isAuthenticated()
+                && !authentication.getName().equals("anonymousUser")) {
+
+            String email = authentication.getName();
+            Optional<Customer> customerOptional = userService.findByEmail(email);
+
+            if (customerOptional.isPresent()) {
+                Customer customer = customerOptional.get();
+
+                try {
+                    // Get cart items
+                    List<CartItems> cartItems = cartService.getCartItems(customer.getId());
+
+                    if (cartItems.isEmpty()) {
+                        redirectAttributes.addFlashAttribute("errorMessage", "Your cart is empty!");
+                        return "redirect:/cart";
+                    }
+
+                    Address orderAddress;
+                    if (addressId != null) {
+                        Optional<Address> existingAddress = Optional.ofNullable(addressService.findById(addressId));
+                        if (existingAddress.isPresent() && customer.getAddresses().contains(existingAddress.get())) {
+                            orderAddress = existingAddress.get();
+                        } else {
+                            redirectAttributes.addFlashAttribute("errorMessage", "Invalid address selected!");
+                            return "redirect:/order/checkout";
+                        }
+                    } else {
+                        // Create new address
+                        if (newStreet == null || newCity == null || newPostalCode == null ||
+                                newStreet.trim().isEmpty() || newCity.trim().isEmpty() || newPostalCode.trim().isEmpty()) {
+                            redirectAttributes.addFlashAttribute("errorMessage", "Please provide complete address information!");
+                            return "redirect:/order/checkout";
+                        }
+
+                        Address newAddress = new Address();
+                        newAddress.setStreet(newStreet);
+                        newAddress.setCity(newCity);
+                        newAddress.setPostalCode(newPostalCode);
+
+                        // Save the address and add it to customer - assuming this returns the saved address
+                        orderAddress = addressService.addAddressToUser(customer, newAddress);
+                    }
+
+                    BigDecimal totalAmount = cartItems.stream()
+                            .map(item -> item.getItem().getPrice().multiply(BigDecimal.valueOf(item.getQuantity())))
+                            .reduce(BigDecimal.ZERO, BigDecimal::add);
+
+                    // Get restaurant from the first item
+                    Restaurant restaurant = null;
+                    if (!cartItems.isEmpty()) {
+                        Optional<Restaurant> restaurantOpt = menuItemService.getRestaurantByItem(cartItems.get(0).getItem());
+                        restaurant = restaurantOpt.orElse(null);
+                    }
+
+                    Order order = new Order();
+                    order.setCustomer(customer);
+                    order.setAddress(orderAddress);
+                    order.setRestaurant(restaurant);
+                    order.setOrderDate(LocalDateTime.now());
+                    order.setComment(comment);
+                    order.setOrderStatus("PENDING");
+                    order.setTotalAmount(totalAmount);
+
+                    Order savedOrder = orderService.createOrderWithItems(order, cartItems);
+
+                    boolean paymentSuccessful = processPayment(paymentMethod, totalAmount);
+
+                    if (paymentSuccessful) {
+                        cartService.clearCart(customer.getId());
+
+                        redirectAttributes.addFlashAttribute("successMessage",
+                                "Order placed successfully! Order ID: " + savedOrder.getId());
+                        return "redirect:/order/confirmation/" + savedOrder.getId();
+                    } else {
+                        savedOrder.setOrderStatus("PAYMENT_FAILED");
+                        orderService.save(savedOrder);
+
+                        redirectAttributes.addFlashAttribute("errorMessage",
+                                "Payment failed! Please try again.");
+                        return "redirect:/order/checkout";
+                    }
+
+                } catch (Exception e) {
+                    redirectAttributes.addFlashAttribute("errorMessage",
+                            "Failed to place order. Please try again.");
+                    return "redirect:/order/checkout";
+                }
+            }
+        }
+
+        return "redirect:/login";
+    }
+
+    @GetMapping("/confirmation/{orderId}")
+    public String showOrderConfirmation(@PathVariable Long orderId, Model model) {
+        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+
+        if (authentication != null && authentication.isAuthenticated()
+                && !authentication.getName().equals("anonymousUser")) {
+
+            String email = authentication.getName();
+            Optional<Customer> customerOptional = userService.findByEmail(email);
+
+            if (customerOptional.isPresent()) {
+                Customer customer = customerOptional.get();
+
+                Optional<Order> orderOptional = orderService.findById(orderId);
+
+                if (orderOptional.isPresent() &&
+                        orderOptional.get().getCustomer().getId().equals(customer.getId())) {
+
+                    Order order = orderOptional.get();
+                    List<OrderItems> orderItems = orderService.getOrderItems(orderId);
+
+                    model.addAttribute("order", order);
+                    model.addAttribute("orderItems", orderItems);
+
+                    return "order_confirmation";
+                }
+            }
+        }
+
+        return "redirect:/login";
+    }
+
+    @PostMapping("/address/add-during-checkout")
+    public String addAddressDuringCheckout(@RequestParam String street,
+                                           @RequestParam String city,
+                                           @RequestParam String postalCode,
+                                           RedirectAttributes redirectAttributes) {
+        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+
+        if (authentication != null && authentication.isAuthenticated()
+                && !authentication.getName().equals("anonymousUser")) {
+
+            String email = authentication.getName();
+            Optional<Customer> customerOptional = userService.findByEmail(email);
+
+            if (customerOptional.isPresent()) {
+                Customer customer = customerOptional.get();
+
+                try {
+                    Address address = new Address();
+                    address.setStreet(street);
+                    address.setCity(city);
+                    address.setPostalCode(postalCode);
+
+                    addressService.addAddressToUser(customer, address);
+
+                    redirectAttributes.addFlashAttribute("successMessage",
+                            "Address added successfully!");
+                } catch (Exception e) {
+                    redirectAttributes.addFlashAttribute("errorMessage",
+                            "Failed to add address. Please try again.");
+                }
+            }
+        }
+
+        return "redirect:/order/checkout";
+    }
+
+    // Simulate payment processing
+    private boolean processPayment(String paymentMethod, BigDecimal amount) {
+        // In a real application, this would integrate with a payment gateway
+        // For now, we'll simulate successful payment
+        try {
+            Thread.sleep(1000); // Simulate processing time
+
+            // Simulate payment success/failure (90% success rate)
+            return Math.random() > 0.1;
+
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            return false;
+        }
+    }
+}
Index: src/main/resources/templates/checkout.html
===================================================================
--- src/main/resources/templates/checkout.html	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
+++ src/main/resources/templates/checkout.html	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
@@ -0,0 +1,249 @@
+<!DOCTYPE html>
+<html lang="en" xmlns:th="http://www.thymeleaf.org">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Checkout - EasyFood</title>
+    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
+          crossorigin="anonymous">
+    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"
+            crossorigin="anonymous"></script>
+    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
+    <style>
+        .checkout-container {
+            background-color: #fff;
+            border-radius: 12px;
+            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
+            max-width: 1000px;
+            margin: 2rem auto;
+            padding: 2rem;
+        }
+
+        .form-section, .order-summary {
+            background-color: #f8f9fa;
+            border-radius: 12px;
+            padding: 1.5rem;
+            margin-bottom: 1.5rem;
+        }
+
+        .step-indicator {
+            display: none;
+        }
+
+        .address-card, .payment-option {
+            border: 2px solid #e9ecef;
+            border-radius: 10px;
+            padding: 1rem;
+            margin: 0.5rem 0;
+            transition: all 0.3s ease;
+            cursor: pointer;
+        }
+
+        .address-card.selected, .payment-option.selected {
+            border-color: #ffc107;
+            background: rgba(255, 193, 7, 0.1);
+        }
+
+        .order-item {
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+            padding: 0.75rem 0;
+            border-bottom: 1px solid #dee2e6;
+        }
+
+        .order-item:last-of-type {
+            border-bottom: none;
+        }
+
+        .total-row {
+            padding: 1rem 0;
+        }
+    </style>
+</head>
+<body class="bg-light">
+
+<nav class="navbar bg-body-tertiary shadow-sm">
+    <div class="container-fluid">
+        <a class="navbar-brand d-flex align-items-center" href="#">
+            <img src="/images/logo.JPG" alt="Logo" height="90" class="d-inline-block align-text-top">
+        </a>
+    </div>
+</nav>
+
+<div class="container-fluid mt-4">
+    <div class="checkout-container">
+        <div class="text-center mb-4">
+            <h1 class="fw-bold"><i class="fas fa-shopping-cart me-3"></i>Checkout</h1>
+            <p class="text-muted">Complete your order from <strong th:text="${restaurant.name}"></strong></p>
+        </div>
+
+        <div class="row">
+            <div class="col-md-8">
+                <form th:action="@{/order/place}" method="post" id="checkoutForm">
+
+                    <div class="form-section">
+                        <h4 class="mb-3"><i class="fas fa-map-marker-alt me-2"></i>Delivery Address</h4>
+
+                        <div th:if="${not #lists.isEmpty(addresses)}">
+                            <p class="text-muted">Choose from saved addresses:</p>
+                            <div th:each="address : ${addresses}">
+                                <div class="address-card" onclick="selectAddress(this, [[${address.id}]])">
+                                    <div class="form-check">
+                                        <input class="form-check-input" type="radio" name="addressId"
+                                               th:value="${address.id}" th:id="'address-' + ${address.id}">
+                                        <label class="form-check-label" th:for="'address-' + ${address.id}">
+                                            <strong th:text="${address.street}"></strong><br>
+                                            <small class="text-muted"
+                                                   th:text="${address.city} + ', ' + ${address.postalCode}"></small>
+                                        </label>
+                                    </div>
+                                </div>
+                            </div>
+                            <hr class="my-3">
+                        </div>
+
+                        <div class="address-card" onclick="toggleNewAddressForm(event)">
+                            <div class="form-check">
+                                <input class="form-check-input" type="radio" name="addressOption" value="new"
+                                       id="newAddress">
+                                <label class="form-check-label" for="newAddress">
+                                    <i class="fas fa-plus-circle me-2"></i><strong>Add New Address</strong>
+                                </label>
+                            </div>
+                        </div>
+
+                        <div class="new-address-form" id="newAddressForm" style="display: none;">
+                            <h6 class="mt-3"><i class="fas fa-home me-2"></i>New Address Details</h6>
+                            <div class="row">
+                                <div class="col-md-12 mb-3">
+                                    <label for="newStreet" class="form-label">Street Address</label>
+                                    <input type="text" class="form-control" id="newStreet" name="newStreet"
+                                           placeholder="Enter street address">
+                                </div>
+                                <div class="col-md-6 mb-3">
+                                    <label for="newCity" class="form-label">City</label>
+                                    <input type="text" class="form-control" id="newCity" name="newCity"
+                                           placeholder="Enter city">
+                                </div>
+                                <div class="col-md-6 mb-3">
+                                    <label for="newPostalCode" class="form-label">Postal Code</label>
+                                    <input type="text" class="form-control" id="newPostalCode" name="newPostalCode"
+                                           placeholder="Enter postal code">
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="form-section">
+                        <h4 class="mb-3"><i class="fas fa-credit-card me-2"></i>Payment Method</h4>
+                        <div class="payment-option" onclick="selectPayment(this, 'card')">
+                            <div class="form-check">
+                                <input class="form-check-input" type="radio" name="paymentMethod" value="card"
+                                       id="paymentCard">
+                                <label class="form-check-label" for="paymentCard">
+                                    <i class="fas fa-credit-card icon-payment text-primary"></i>
+                                    <strong>Credit/Debit Card</strong>
+                                </label>
+                            </div>
+                        </div>
+
+                        <div class="payment-option" onclick="selectPayment(this, 'cash')">
+                            <div class="form-check">
+                                <input class="form-check-input" type="radio" name="paymentMethod" value="cash"
+                                       id="paymentCash">
+                                <label class="form-check-label" for="paymentCash">
+                                    <i class="fas fa-money-bill-wave icon-payment text-success"></i>
+                                    <strong>Cash on Delivery</strong>
+                                </label>
+                            </div>
+                        </div>
+
+                        <div class="payment-option" onclick="selectPayment(this, 'paypal')">
+                            <div class="form-check">
+                                <input class="form-check-input" type="radio" name="paymentMethod" value="paypal"
+                                       id="paymentPaypal">
+                                <label class="form-check-label" for="paymentPaypal">
+                                    <i class="fab fa-paypal icon-payment text-info"></i>
+                                    <strong>PayPal</strong>
+                                </label>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="form-section">
+                        <h4 class="mb-3"><i class="fas fa-sticky-note me-2"></i>Order Notes</h4>
+                        <textarea class="form-control" name="comment" rows="3"
+                                  placeholder="Any special instructions for your order? (Optional)"></textarea>
+                    </div>
+                </form>
+            </div>
+
+            <div class="col-md-4">
+                <div class="order-summary sticky-top" style="top: 2rem;">
+                    <h4 class="mb-3"><i class="fas fa-receipt me-2"></i>Order Summary</h4>
+
+                    <div th:each="item : ${cartItems}" class="order-item">
+                        <div>
+                            <strong th:text="${item.item.name}"></strong>
+                            <small class="text-muted">x<span th:text="${item.quantity}"></span></small>
+                        </div>
+                        <span th:text="'$' + ${itemTotals[item.getItem().getId()]}"></span>
+                    </div>
+
+                    <div class="d-flex justify-content-between total-row">
+                        <strong>Total:</strong>
+                        <strong class="text-warning" th:text="'$' + ${totalAmount}"></strong>
+                    </div>
+
+                    <button type="submit" form="checkoutForm" class="btn btn-warning w-100 mt-3">
+                        <i class="fas fa-check-circle me-2"></i>Place Order
+                    </button>
+
+                    <div class="text-center mt-3">
+                        <a href="/cart" class="btn btn-outline-secondary">
+                            <i class="fas fa-arrow-left me-2"></i>Back to Cart
+                        </a>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <div th:if="${successMessage}" class="alert alert-success alert-dismissible fade show position-fixed"
+         style="top: 20px; right: 20px; z-index: 1050;">
+        <span th:text="${successMessage}"></span>
+        <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
+    </div>
+
+    <div th:if="${errorMessage}" class="alert alert-danger alert-dismissible fade show position-fixed"
+         style="top: 20px; right: 20px; z-index: 1050;">
+        <span th:text="${errorMessage}"></span>
+        <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
+    </div>
+
+    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
+    <script>
+        function selectAddress(element) {
+            document.querySelectorAll('.address-card').forEach(card => card.classList.remove('selected'));
+            element.classList.add('selected');
+            element.querySelector('input[type="radio"]').checked = true;
+            document.getElementById('newAddressForm').style.display = 'none';
+        }
+
+        function toggleNewAddressForm(event) {
+            document.querySelectorAll('.address-card').forEach(card => card.classList.remove('selected'));
+            event.currentTarget.classList.add('selected');
+            document.getElementById('newAddressForm').style.display = 'block';
+            document.querySelectorAll('input[name="addressId"]').forEach(radio => radio.checked = false);
+        }
+
+        function selectPayment(element) {
+            document.querySelectorAll('.payment-option').forEach(option => option.classList.remove('selected'));
+            element.classList.add('selected');
+            element.querySelector('input[type="radio"]').checked = true;
+        }
+    </script>
+
+</body>
+</html>
Index: src/main/resources/templates/order_confirmation.html
===================================================================
--- src/main/resources/templates/order_confirmation.html	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
+++ src/main/resources/templates/order_confirmation.html	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
@@ -0,0 +1,213 @@
+<!DOCTYPE html>
+<html lang="en" xmlns:th="http://www.thymeleaf.org">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Order Confirmation - EasyFood</title>
+    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
+          crossorigin="anonymous">
+    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"
+            crossorigin="anonymous"></script>
+    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
+    <style>
+        .confirmation-container {
+            background-color: #fff;
+            border-radius: 12px;
+            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
+            max-width: 800px;
+            margin: 2rem auto;
+            padding: 2rem;
+        }
+
+        .success-header {
+            text-align: center;
+            padding-bottom: 1rem;
+            border-bottom: 1px solid #dee2e6;
+            margin-bottom: 2rem;
+        }
+
+        .success-icon {
+            font-size: 4rem;
+            color: #28a745;
+            margin-bottom: 1rem;
+        }
+
+        .order-info-card, .delivery-timeline {
+            background-color: #f8f9fa;
+            border-radius: 12px;
+            padding: 1.5rem;
+            margin-bottom: 1.5rem;
+        }
+
+        .status-badge {
+            background-color: #ffc107;
+            color: #212529;
+            padding: 0.5rem 1rem;
+            border-radius: 50px;
+            font-weight: bold;
+            font-size: 0.9rem;
+        }
+
+        .order-item {
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+            padding: 0.75rem 0;
+            border-bottom: 1px solid #dee2e6;
+        }
+
+        .order-item:last-child {
+            border-bottom: none;
+        }
+
+        .timeline-step {
+            display: flex;
+            align-items: center;
+            margin: 0.5rem 0;
+        }
+
+        .timeline-icon {
+            width: 40px;
+            height: 40px;
+            border-radius: 50%;
+            background-color: #6c757d;
+            color: white;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            margin-right: 1rem;
+        }
+
+        .timeline-step.completed .timeline-icon {
+            background-color: #28a745;
+        }
+
+        .timeline-step.active .timeline-icon {
+            background-color: #0d6efd;
+        }
+
+        .action-buttons {
+            display: flex;
+            gap: 1rem;
+            justify-content: center;
+            margin-top: 2rem;
+        }
+
+    </style>
+</head>
+<body class="bg-light">
+
+<nav class="navbar bg-body-tertiary shadow-sm">
+    <div class="container-fluid">
+        <a class="navbar-brand d-flex align-items-center" href="#">
+            <img src="/images/logo.JPG" alt="Logo" height="90" class="d-inline-block align-text-top">
+        </a>
+    </div>
+</nav>
+
+<div class="container-fluid mt-4">
+    <div class="confirmation-container">
+        <div class="success-header">
+            <div class="success-icon">
+                <i class="fas fa-check-circle"></i>
+            </div>
+            <h1>Order Confirmed!</h1>
+            <p class="text-muted mb-0">Thank you for your order. We're preparing it now!</p>
+        </div>
+
+        <div class="order-details">
+            <div class="order-info-card">
+                <h4><i class="fas fa-receipt me-2"></i>Order Information</h4>
+                <div class="row">
+                    <div class="col-md-6">
+                        <p><strong>Order ID:</strong> #<span th:text="${order.id}"></span></p>
+                        <p><strong>Order Date:</strong>
+                            <span th:text="${#temporals.format(order.orderDate, 'MMM dd, yyyy HH:mm')}"></span>
+                        </p>
+                        <p><strong>Status:</strong>
+                            <span class="status-badge" th:text="${order.orderStatus}"></span>
+                        </p>
+                    </div>
+                    <div class="col-md-6">
+                        <p><strong>Total Amount:</strong>
+                            <span class="text-success fw-bold" th:text="${order.totalAmount}"></span>
+                        </p>
+                        <p><strong>Delivery Address:</strong></p>
+                        <small>
+                            <span th:text="${order.address.street}"></span><br>
+                            <span th:text="${order.address.city} + ', ' + ${order.address.postalCode}"></span>
+                        </small>
+                    </div>
+                </div>
+                <div th:if="${order.comment}" class="mt-3">
+                    <p><strong>Notes:</strong> <span th:text="${order.comment}"></span></p>
+                </div>
+            </div>
+
+            <div class="order-info-card">
+                <h4><i class="fas fa-utensils me-2"></i>Order Items</h4>
+                <div th:each="orderItem : ${orderItems}" class="order-item">
+                    <div>
+                        <strong th:text="${orderItem.item.name}"></strong>
+                        <small class="text-muted">x<span th:text="${orderItem.quantity}"></span></small>
+                    </div>
+                    <span th:text="${orderItem.totalPrice}"></span>
+                </div>
+            </div>
+
+            <div class="delivery-timeline">
+                <h4><i class="fas fa-truck me-2"></i>Delivery Status</h4>
+
+                <div class="timeline-step completed">
+                    <div class="timeline-icon"><i class="fas fa-check"></i></div>
+                    <div>
+                        <strong>Order Confirmed</strong>
+                        <small class="text-muted d-block">Your order has been received and confirmed</small>
+                    </div>
+                </div>
+
+                <div class="timeline-step active">
+                    <div class="timeline-icon"><i class="fas fa-utensils"></i></div>
+                    <div>
+                        <strong>Preparing</strong>
+                        <small class="text-muted d-block">Restaurant is preparing your order</small>
+                    </div>
+                </div>
+
+                <div class="timeline-step">
+                    <div class="timeline-icon"><i class="fas fa-motorcycle"></i></div>
+                    <div>
+                        <strong>Out for Delivery</strong>
+                        <small class="text-muted d-block">Your order is on the way</small>
+                    </div>
+                </div>
+
+                <div class="timeline-step">
+                    <div class="timeline-icon"><i class="fas fa-home"></i></div>
+                    <div>
+                        <strong>Delivered</strong>
+                        <small class="text-muted d-block">Order delivered successfully</small>
+                    </div>
+                </div>
+            </div>
+
+            <div class="action-buttons">
+                <a href="/profile" class="btn btn-warning btn-custom">
+                    <i class="fas fa-user me-2"></i>View Profile
+                </a>
+                <a href="/orders" class="btn btn-outline-warning btn-custom">
+                    <i class="fas fa-history me-2"></i>Order History
+                </a>
+            </div>
+        </div>
+    </div>
+</div>
+
+<div th:if="${successMessage}" class="alert alert-success alert-dismissible fade show position-fixed"
+     style="top: 20px; right: 20px; z-index: 1050;">
+    <span th:text="${successMessage}"></span>
+    <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
+</div>
+
+</body>
+</html>
Index: src/main/resources/templates/shopping_cart.html
===================================================================
--- src/main/resources/templates/shopping_cart.html	(revision 67c0445857a17669bb5e337fbbe7edc4ac80509f)
+++ src/main/resources/templates/shopping_cart.html	(revision cffbecf2df02ed2be14abcb5c74eaef739080c68)
@@ -68,6 +68,5 @@
                                  th:text="${#numbers.formatDecimal(total, 0, 'POINT', 2, 'COMMA')} + '$'">43.97$</span>
                 </h5>
-                <a href="checkout.html" class="btn btn-warning fw-semibold">Proceed to Checkout</a>
-            </div>
+                <a th:href="@{/order/checkout}" class="btn btn-warning fw-semibold">Proceed to Checkout</a></div>
         </div>
     </div>
