OrderFactory

Factory object for creating different types of orders.

This factory provides methods to create Delivery, Takeaway, and DineIn orders. It validates the order items and the provided information before creating the order.

Functions

Link copied to clipboard
fun createDelivery(id: OrderId, restaurantId: RestaurantId, customerId: CustomerId, items: List<OrderItem>, info: DeliveryInfo): OrderCreationResult

Creates a Delivery order with the specified parameters.

Link copied to clipboard
fun createDineIn(id: OrderId, restaurantId: RestaurantId, customerId: CustomerId, items: List<OrderItem>, info: TableInfo): OrderCreationResult

Creates a DineIn order with the specified parameters.

Link copied to clipboard
fun createTakeaway(id: OrderId, restaurantId: RestaurantId, customerId: CustomerId, items: List<OrderItem>, info: TakeawayInfo): OrderCreationResult

Creates a Takeaway order with the specified parameters.