DeliveryOrder

data class DeliveryOrder(val id: OrderId, val restaurantId: RestaurantId, val customerId: CustomerId, val status: OrderStatus, val items: List<OrderItem>, val deliveryInfo: DeliveryInfo) : Order

Represents a delivery order in the system.

Constructors

Link copied to clipboard
constructor(id: OrderId, restaurantId: RestaurantId, customerId: CustomerId, status: OrderStatus, items: List<OrderItem>, deliveryInfo: DeliveryInfo)

Types

Link copied to clipboard
sealed interface UpdateResult

Represents the result of an update operation on the delivery order.

Properties

Link copied to clipboard
open override val customerId: CustomerId

The unique identifier of the customer who placed the order.

Link copied to clipboard

The delivery information associated with the order.

Link copied to clipboard
open override val id: OrderId

The unique identifier of the order.

Link copied to clipboard
open override val items: List<OrderItem>

The list of items included in the order.

Link copied to clipboard
open override val restaurantId: RestaurantId

The unique identifier of the restaurant associated with the order.

Link copied to clipboard
open override val status: OrderStatus

The current status of the order.

Functions

Link copied to clipboard

Cancels the order if it is in a cancellable state.

Link copied to clipboard

Advances the status of the order to the next logical state.

Link copied to clipboard

Converts an Order domain model to an OrderDocument for persistence.

Link copied to clipboard
Link copied to clipboard
fun updateInfo(estimatedDeliveryTime: Long, deliveryAddress: String, bellName: String, customerPhone: String): DeliveryOrder.UpdateResult

Updates the delivery information of the order.

Link copied to clipboard

Updates the items in the order after validating them.