DefaultStockLocationStrategy

DefaultStockLocationStrategy

The DefaultStockLocationStrategy is the default implementation of the StockLocationStrategy. It assumes only a single StockLocation and that all stock is allocated from that location.

Signature

class DefaultStockLocationStrategy implements StockLocationStrategy {
  protected protected connection: TransactionalConnection;
  init(injector: Injector) => ;
  getAvailableStock(ctx: RequestContext, productVariantId: ID, stockLevels: StockLevel[]) => AvailableStock;
  forAllocation(ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => LocationWithQuantity[] | Promise<LocationWithQuantity[]>;
  async forCancellation(ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => Promise<LocationWithQuantity[]>;
  async forRelease(ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => Promise<LocationWithQuantity[]>;
  async forSale(ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => Promise<LocationWithQuantity[]>;
}

Implements

Members

connection

property

init

method
type:
(injector: Injector) =>

getAvailableStock

method
type:
(ctx: RequestContext, productVariantId: ID, stockLevels: StockLevel[]) => AvailableStock

forAllocation

method
type:
(ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => LocationWithQuantity[] | Promise<LocationWithQuantity[]>

forCancellation

method
type:
(ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => Promise<LocationWithQuantity[]>

forRelease

method
type:
(ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => Promise<LocationWithQuantity[]>

forSale

method
type:
(ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => Promise<LocationWithQuantity[]>