Owneat Technical Guide main Help

Class OrderLineItem

Namespace: Ordering.Domain.Aggregates.OrderAggregate
Assembly: Ordering.Domain.dll

Object that serve as a mapping table between order and product id's whom are stored in it.

[Table("OrderLineItems")] public class OrderLineItem : Entity, IAuditable

Inheritance

object ← Entity ← OrderLineItem

Implements

IAuditable

Inherited Members

Entity.Id, Entity.CreatedAt, Entity.UpdatedAt, Entity.DomainEvents, Entity.EmitDomainEvent\(IDomainEvent\), object.Equals\(object?\), object.Equals\(object?, object?\), object.GetHashCode\(\), object.GetType\(\), object.MemberwiseClone\(\), object.ReferenceEquals\(object?, object?\), object.ToString\(\)

Constructors

OrderLineItem\(\)

public OrderLineItem()

OrderLineItem\(Guid, string, CategoryProductData?, VatRate?, double, int\)

public OrderLineItem(Guid productId, string name, CategoryProductData? categoryProductData, VatRate? vatRate, double unitPrice, int quantity)

Parameters

productId Guid

name string

categoryProductData CategoryProductData?

vatRate VatRate?

unitPrice double

quantity int

Properties

CategoryProductData

Data of the category of the product from which the line item was formed. Null if the product base is a formula.

public CategoryProductData? CategoryProductData { get; init; }

Property Value

CategoryProductData?

ExternalPaymentId

Id of the product on stripe catalog.

[MaxLength(100)] public string? ExternalPaymentId { get; set; }

Property Value

string?

Instructions

The specific instructions for the product.

[MaxLength(200)] public string? Instructions { get; set; }

Property Value

string?

IsAcknowledged

Boolean that says if the line item has been acknowledged.

public bool IsAcknowledged { get; set; }

Property Value

bool

IsCanceled

Boolean that says if the line item is canceled.

public bool IsCanceled { get; set; }

Property Value

bool

IsPaid

Boolean that says if the lineItem is paid.

public bool IsPaid { get; set; }

Property Value

bool

IsRefunded

Boolean that says if the lineItem has been refunded by staff.

public bool IsRefunded { get; }

Property Value

bool

IsServed

Boolean that says if the line item has been served.

public bool IsServed { get; set; }

Property Value

bool

Name

Name of the line item.

[Required] [MaxLength(50)] public string Name { get; init; }

Property Value

string

OrderId

Guid of the order.

[Required] [ForeignKey("Order")] public Guid OrderId { get; init; }

Property Value

Guid

PayingCustomerId

Id of the customer who is paying for the line item.

public Guid? PayingCustomerId { get; set; }

Property Value

Guid?

Personalizations

The personalization for the product.

[MaxLength(500)] public List<OrderLinePersonalization> Personalizations { get; set; }

Property Value

List < OrderLinePersonalization \>

ProductId

Guid of the product.

[Required] public Guid ProductId { get; init; }

Property Value

Guid

Quantity

Quantity of the product to add on the order.

[Required] public int Quantity { get; set; }

Property Value

int

TotalPrice

Total price of the line item.

public double TotalPrice { get; }

Property Value

double

UnitPrice

Unit price of the line item.

[Required] public double UnitPrice { get; init; }

Property Value

double

VatRate

Enum of the VAT for the line item. Null if the product base is a formula.

public VatRate? VatRate { get; init; }

Property Value

VatRate?

Methods

Acknowledge\(\)

Method that set an order line item acknowledgement.

public void Acknowledge()

CanBeServedByCategory\(string\)

public bool CanBeServedByCategory(string categoryName)

Parameters

categoryName string

Returns

bool

CanBeServedByPeriod\(ServingPeriod\)

public bool CanBeServedByPeriod(ServingPeriod servingPeriod)

Parameters

servingPeriod ServingPeriod

Returns

bool

CanBeToggledByCustomerWithId\(Guid\)

Tell if a customer can toggle the line item paying customer id.

public bool CanBeToggledByCustomerWithId(Guid customerId)

Parameters

customerId Guid

Id of the customer who want to toggle the line item paying customer id.

Returns

bool

Cancel\(\)

Method that set an order line item to canceled state.

public void Cancel()

HasBeenCanceled\(\)

public bool HasBeenCanceled()

Returns

bool

HasBeenPaid\(\)

public bool HasBeenPaid()

Returns

bool

HasBeenServed\(\)

public bool HasBeenServed()

Returns

bool

HasBeenUnbilled\(\)

public bool HasBeenUnbilled()

Returns

bool

IsFinanciallyResolved\(\)

public bool IsFinanciallyResolved()

Returns

bool

IsPartOfCategory\(string\)

public bool IsPartOfCategory(string categoryName)

Parameters

categoryName string

Returns

bool

IsPartOfServingPeriod\(ServingPeriod\)

public bool IsPartOfServingPeriod(ServingPeriod servingPeriod)

Parameters

servingPeriod ServingPeriod

Returns

bool

IsUnassignedAndUnpaid\(\)

Tell if the line item is remaining.

public bool IsUnassignedAndUnpaid()

Returns

bool

IsWaitingForPayment\(\)

public bool IsWaitingForPayment()

Returns

bool

LinkToCustomer\(Guid\)

public void LinkToCustomer(Guid movingCustomerId)

Parameters

movingCustomerId Guid

NeedsPayment\(\)

public bool NeedsPayment()

Returns

bool

Pay\(\)

Method that set an order line item to paid state.

public void Pay()

RemovePayingCustomer\(\)

Remove the paying customer from item.

public void RemovePayingCustomer()

Serve\(\)

Method that set an order line item to served state.

public void Serve()

TogglePayingCustomerId\(Guid, Guid\)

Method that toggle the paying customer id of the line item.

public void TogglePayingCustomerId(Guid togglingCustomerId, Guid tableId)

Parameters

togglingCustomerId Guid

tableId Guid

UpdateQuantity\(int\)

Method that update the quantity of the line item.

public void UpdateQuantity(int quantity)

Parameters

quantity int

The new quantity of the line item.

WithExternalPaymentId\(string\)

public OrderLineItem WithExternalPaymentId(string externalPaymentId)

Parameters

externalPaymentId string

Returns

OrderLineItem

WithInstructions\(string?\)

public OrderLineItem WithInstructions(string? instructions)

Parameters

instructions string?

Returns

OrderLineItem

WithPayingCustomerId\(Guid\)

public OrderLineItem WithPayingCustomerId(Guid payingCustomerId)

Parameters

payingCustomerId Guid

Returns

OrderLineItem

WithPersonalizations\(List<OrderLinePersonalization\>\)

public OrderLineItem WithPersonalizations(List<OrderLinePersonalization> personalizations)

Parameters

personalizations List < OrderLinePersonalization \>

Returns

OrderLineItem

Last modified: 21 May 2024