Skip to main content

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 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[]>;
forCancellation(ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => Promise<LocationWithQuantity[]>;
forRelease(ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => Promise<LocationWithQuantity[]>;
forSale(ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number) => Promise<LocationWithQuantity[]>;
}

connection

init

method
(injector: Injector) =>

getAvailableStock

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

forAllocation

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

forCancellation

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

forRelease

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

forSale

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