Skip to content

Order

using CoreConnect.Commerce.Orders;
namespace CoreConnect.Erp;
public enum OrderState
{
New, // The order has been created but not yet processed.
Paid, // The order has been paid for.
Cancelled, // The order has been cancelled.
Returned, // The order has been returned.
}
public enum PartialState
{
No,
Yes,
Partial,
}
public enum OrderShipmentState
{
Created,
Prepared,
Shipped,
Delivered, // Or returned for returns
}
public class OrderShipment
{
public required string Id { get; set; }
public OrderShipmentState State { get; set; }
public string? TNTRef { get; set; }
public string? TNTCompany { get; set; }
public string? TNTUrl { get; set; }
public List<string>? Items { get; set; }
}
public class OrderLineItem
{
public string? Id { get; set; }
public string? ArticleID { get; set; }
public string? ArticleSKU { get; set; }
public string? ArticleRef { get; set; }
public string? Image { get; set; }
public string? Title { get; set; }
public Dictionary<string, object> ExtraData { get; set; } = new();
public decimal Amount { get; set; } // 0 = Delete fo
public decimal Price { get; set; }
}
// Order updates TO erp
public record ErpOrder : Order
{
}
// An order update FROM ERP
public class ErpOrderUpdate
{
public string? Id { get; set; }
public string? Reference { get; set; }
public OrderState? NewState { get; set; }
public PartialState? ShipmentState { get; set; }
public PartialState? ReturnedState { get; set; }
public List<OrderShipment>? Shipment { get; set; }
public List<OrderShipment>? Returns { get; set; }
public List<OrderLineItem>? LineItemUpdates { get; set; }
}