2022-05-24 15:35:03 -07:00
|
|
|
namespace Core.Entities.OrderAggregate
|
|
|
|
{
|
|
|
|
public class Order : BaseEntity
|
|
|
|
{
|
|
|
|
public Order()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-05-30 13:25:27 -07:00
|
|
|
public Order(IReadOnlyList<OrderItem> orderItems, string buyerEmail, Address shipToAddress, DeliveryMethod deliveryMethod, decimal subtotal, string paymentIntentId)
|
2022-05-24 15:35:03 -07:00
|
|
|
{
|
|
|
|
BuyerEmail = buyerEmail;
|
|
|
|
ShipToAddress = shipToAddress;
|
|
|
|
DeliveryMethod = deliveryMethod;
|
|
|
|
OrderItems = orderItems;
|
|
|
|
Subtotal = subtotal;
|
2022-05-30 13:25:27 -07:00
|
|
|
PaymentIntentId = paymentIntentId;
|
2022-05-24 15:35:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public string BuyerEmail { get; set; }
|
|
|
|
public DateTimeOffset OrderDate { get; set; } = DateTimeOffset.Now;
|
|
|
|
public Address ShipToAddress { get; set; }
|
|
|
|
public DeliveryMethod DeliveryMethod { get; set; }
|
|
|
|
public IReadOnlyList<OrderItem> OrderItems { get; set; }
|
|
|
|
public decimal Subtotal { get; set; }
|
|
|
|
public OrderStatus Status { get; set; } = OrderStatus.Pending;
|
|
|
|
public string PaymentIntentId { get; set; }
|
|
|
|
|
|
|
|
public decimal GetTotal(){
|
|
|
|
return Subtotal + DeliveryMethod.Price;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|