dev.atedeg.mdm.clientorders

Type members

Classlikes

final case class Client(code: ClientID, name: ClientName, vatNumber: VATNumber)

A physical or legal entity that places orders.

A physical or legal entity that places orders.

final case class ClientID(id: UUID)

An ID which uniquely identifies a client.

An ID which uniquely identifies a client.

final case class ClientName(name: String)

A human-readable name used to refer to a client.

A human-readable name used to refer to a client.

final case class CompleteOrderLine(quantity: Quantity, product: Product, price: PriceInEuroCents)

A product with its quantity, a price.

A product with its quantity, a price.

final case class CompletedOrder(id: OrderID, orderLines: NonEmptyList[CompleteOrderLine], client: Client, deliveryDate: LocalDateTime, deliveryLocation: Location, totalPrice: PriceInEuroCents)

An order that has been fulfilled by the operator and is ready to be shipped.

An order that has been fulfilled by the operator and is ready to be shipped.

final case class InProgressOrder(id: OrderID, orderLines: NonEmptyList[InProgressOrderLine], client: Client, deliveryDate: LocalDateTime, deliveryLocation: Location, totalPrice: PriceInEuroCents)

An order that is being fulfilled by an operator. Its structure resembles the priced order's with the difference that each line can specify whether it is fulfilled or not.

An order that is being fulfilled by an operator. Its structure resembles the priced order's with the difference that each line can specify whether it is fulfilled or not.

A product with its quantity and a price. It may be in two different states: complete if the product has already been palletized and is ready in the required quantity; incomplete if the product is not present in the required quantity.

A product with its quantity and a price. It may be in two different states: complete if the product has already been palletized and is ready in the required quantity; incomplete if the product is not present in the required quantity.

The events that have to be handled by the bounded context.

The events that have to be handled by the bounded context.

final case class IncomingOrder(id: OrderID, orderLines: NonEmptyList[IncomingOrderLine], client: Client, deliveryDate: LocalDateTime, deliveryLocation: Location)

A set of order lines with their respective quantity (e.g. 1000 ricotte of 0.5kg, 50 squacqueroni of 1 kg), it also contains data about the client, an expected delivery date and the delivery location.

A set of order lines with their respective quantity (e.g. 1000 ricotte of 0.5kg, 50 squacqueroni of 1 kg), it also contains data about the client, an expected delivery date and the delivery location.

final case class IncomingOrderLine(quantity: Quantity, product: Product)

A product with its ordered quantity.

A product with its ordered quantity.

final case class Latitude(value: DecimalInClosedRange[-90.0d, 90.0d])

A latitude specified in degrees.

A latitude specified in degrees.

final case class Location(latitude: Latitude, longitude: Longitude)

The location where an order has to be shipped to.

The location where an order has to be shipped to.

final case class Longitude(value: DecimalInClosedRange[-180.0d, 180.0d])

A longitude specified in degrees.

A longitude specified in degrees.

object Main extends IOApp
final case class MissingQuantity(n: NonNegativeNumber)

The missing quantity of a product necessary to fullfil an in-progress order line.

The missing quantity of a product necessary to fullfil an in-progress order line.

An error that may be produced by the order completion action.

An error that may be produced by the order completion action.

final case class OrderID(id: UUID)

The unique identifier of an order which allows one to track the order during its lifecycle.

The unique identifier of an order which allows one to track the order during its lifecycle.

The events that may be produced by the bounded context.

The events that may be produced by the bounded context.

An error that may be produced by the palletization action.

An error that may be produced by the palletization action.

A quantity (possibly 0) of a palletized product.

A quantity (possibly 0) of a palletized product.

final case class PriceInEuroCents(n: PositiveNumber)

A price expressed in cents, the smallest currency unit for euros.

A price expressed in cents, the smallest currency unit for euros.

final case class PricedOrder(id: OrderID, orderLines: NonEmptyList[PricedOrderLine], client: Client, deliveryDate: LocalDateTime, deliveryLocation: Location, totalPrice: PriceInEuroCents)

An order where each line has an associated price and, optionally, an applied discount. It also has the total price. Its structure resembles the incoming order's with the difference that each line has been priced.

An order where each line has an associated price and, optionally, an applied discount. It also has the total price. Its structure resembles the incoming order's with the difference that each line has been priced.

final case class PricedOrderLine(quantity: Quantity, product: Product, totalPrice: PriceInEuroCents)

A product with its quantity and a price.

A product with its quantity and a price.

final case class Quantity(n: PositiveNumber)

A quantity of something.

A quantity of something.

final case class TransportDocument(deliveryLocation: Location, shippingLocation: Location, client: Client, shippingDate: LocalDateTime, transportDocumentLines: NonEmptyList[TransportDocumentLine], totalWeight: WeightInKilograms)

A document that has to specify: a delivery location, a shipping location, the client's info, the shipping date, the total weight of the pallet, and a list of transport document lines.

A document that has to specify: a delivery location, a shipping location, the client's info, the shipping date, the total weight of the pallet, and a list of transport document lines.

final case class TransportDocumentLine(quantity: Quantity, product: Product)

A product with its respective shipped quantity.

A product with its respective shipped quantity.

final case class VATNumber(number: Refined[String, MatchesRegex[VATRegex]])

An alphanumeric code for value-added tax purposes.

An alphanumeric code for value-added tax purposes.

See also:
final case class WeightInKilograms(n: PositiveDecimal)

A weight expressed in kilograms.

A weight expressed in kilograms.

Value members

Concrete methods

def completeOrder[Result[_] : Monad](inProgressOrder: InProgressOrder): Result[CompletedOrder]

Completes an in-progress order.

Completes an in-progress order.

Creates a transport document from a complete order.

Creates a transport document from a complete order.

def palletizeProductForOrder[M[_] : Emits[ProductPalletized]](quantity: Quantity, product: Product)(inProgressOrder: InProgressOrder): M[InProgressOrder]

Palletizes a product in the specified quantity for a given order in progress. The result is an in-progress order where the corresponding line has been updated with the specified quantity.

Palletizes a product in the specified quantity for a given order in progress. The result is an in-progress order where the corresponding line has been updated with the specified quantity.

def priceOrder[M[_] : Emits[OrderProcessed]](incomingOrder: IncomingOrder, pricedOrderLines: NonEmptyList[PricedOrderLine]): M[PricedOrder]

Turns an incoming order into a priced order, given the priced order lines.

Turns an incoming order into a priced order, given the priced order lines.

Turns a priced order into an in-progress order that can then be fulfilled by operators.

Turns a priced order into an in-progress order that can then be fulfilled by operators.

Computes the total weight of a complete order.

Computes the total weight of a complete order.