Order

Order

Documentation generated from order.entity.ts on Feb 19 2019 at 16:20

An Order is created whenever a Customer adds an item to the cart. It contains all the information required to fulfill an order: which ProductVariants in what quantities; the shipping address and price; any applicable promotions; payments etc.

An Order exists in a well-defined state according to the OrderState type. A state machine is used to govern the transition from one state to another.

Signature

class Order {
  constructor(input: DeepPartial<Order>)
  @Column() code: string;
  @Column('varchar') state: OrderState;
  @Column({ default: true })
    active: boolean;
  @Column({ nullable: true })
    orderPlacedAt?: Date;
  @ManyToOne(type => Customer)
    customer?: Customer;
  @OneToMany(type => OrderLine, line => line.order)
    lines: OrderLine[];
  @Column('simple-json') pendingAdjustments: Adjustment[];
  @Column('simple-json') shippingAddress: OrderAddress;
  @Column('simple-json') billingAddress: OrderAddress;
  @OneToMany(type => Payment, payment => payment.order)
    payments: Payment[];
  @Column('varchar')
    currencyCode: CurrencyCode;
  @Column() subTotalBeforeTax: number;
  @Column() subTotal: number;
  @Column({ type: idType(), nullable: true })
    shippingMethodId: ID | null;
  @ManyToOne(type => ShippingMethod)
    shippingMethod: ShippingMethod | null;
  @Column({ default: 0 })
    shipping: number;
  clearAdjustments(type: AdjustmentType) => ;
  getOrderItems() => OrderItem[];
}

Members

constructor

method
type:
(input: DeepPartial<Order>) => Order

code

property
type:
string

state

property
type:
OrderState

active

property
type:
boolean

orderPlacedAt

property
type:
Date

customer

property
type:
Customer

lines

property
type:
OrderLine[]

pendingAdjustments

property
type:
Adjustment[]

shippingAddress

property
type:
OrderAddress

billingAddress

property
type:
OrderAddress

payments

property
type:
Payment[]

currencyCode

property
type:
CurrencyCode

subTotalBeforeTax

property
type:
number

subTotal

property
type:
number

shippingMethodId

property
type:
ID | null

shippingMethod

property
type:
ShippingMethod | null

shipping

property
type:
number

clearAdjustments

method
type:
(type: AdjustmentType) =>

getOrderItems

method
type:
() => OrderItem[]
alpha