The inventory domain model

Current version: 10.3
Note

The domain model consists of classes that make up the contracts with the external system. The contracts are defined as classes instead of interfaces to allow the model to be easily extended later if needed. This follows the best practice guidelines defined in the Framework Design Guidelines. 

Default implementation of the contracts is delivered as part of Connect. If an actual Connect provider with an external commerce system contains more functionality than provided by default, the implementation can be replaced. All instantiation of actual classes is handled through dependency injection.

Class: StockInformation

The StockInformation class is used as a strongly typed composite return value for the GetStockInformation service method.

Name

Type

Description

Product

InventoryProduct

Identifier for the product or product variant in the commerce system.

Status

StockStatus

Default possible values are: In-Stock, Out-Of-Stock, Pre-Orderable, Back-Orderable.

Count

Double

In case of products being bundled in quantities, there might be fractional numbers.

AvailabilityDate

DateTime

In case the product is out-of-stock or pre-orderable, an availability date can be present.

Class: OrderableInformation

The OrderableInformation class is used as a strongly typed composite return value for the GetPreOrdableInformation and GetBackOrderableInformation service methods.

Name

Type

Description

Product

InventoryProduct

Identifier for the product or product variant in the commerce system.

Status

StockStatus

Default possible values are: In-Stock, Out-Of-Stock, Pre-Orderable, Back-Orderable.

InStockDate

Datetime

An ETA date for when the product is back in stock.

ShippingDate

DateTime

An ETA date for when the product is shippable.

CartQuantityLimit

Double

A limit for the visitor to add to his or her cart.

OrderableStartDate

DateTime

A date and time for when the first orders can be placed for the given product.

OrderableEndDate

DateTime

A date and time for when the last orders can be placed for the given product.

RemainingQuantity

Double

In case of a preorderable product then there might be a remaining quantity to be placed as orders.

Class: IndexStockInformation

The IndexStockInformation class is used as a strongly typed composite value used in the StockStatusForIndexing pipeline when indexing products and including basic stock information.

The entity inherits from the base entity StockLocations. In the following table, the inherited properties are marked in Italics

Name

Type

Description

Product

InventoryProduct

Identifier for the product or product variant in the commerce system

InStockLocations

List<string>

A list of locations where the product is in stock .

OutOfStockLocations

List<string>

A list of locations where the product is out of stock .

OrderableLocations

List<string>

A list of locations where the product can be ordered from .

PreOrderable

Boolean

Indicates whether the product is preorderable.

Class: StockInformationUpdate

The StockInformationUpdate class is used as a strongly typed composite return value from the GetBackInStockInformation method to indicate the product and the locations where it will be back in stock, optionally along with the availability date and count.

Name

Type

Description

Product ID

String

Id of the product.

StockInformationUpdateLocation

List< StockInformationUpdateLocation >

A list of locations where the product will become available along with the count and availability date as optional values

Class: StockInformationUpdateLocation

The StockInformationUpdateLocation class is used as a strongly typed value nested only into the StockInformationUpdate class returned from the GetBackInStockInformation method to indicate the locations where the product will be back in stock, optionally along with the availability date and count.

Name

Type

Description

Location

String

Name of the location

AvailabilityDate

DateTime?

An optional date and time indicating when the product will be in stock. It can be used in comparison with the optional interest date that the visitor provided. If the interest date is before the availability date, then the notification signup becomes irrelevant and it can be acted upon.

Count

Double?

An optional count of products that are in stock at the location at the specified date and time.

Class: StockDetailsLevel

It is anticipated that there is a performance-related difference between obtaining a simple stock status and getting the actual stock count. In order to allow for flexibility, it is possible to specify the level of details that are requested.

The StockDetailsLevel class is used as a strongly typed request parameter for the GetStockInformation service method to indicate the level of stock details that are requested. Using a strongly typed parameter will ease the use of the API for solution developers. The following example illustrates the use of the class as an enum-like parameter:

RequestResponse
StockInformation stockInformation = GetStockInformation(
     new StockInformationRequest { shopName = “MyShop”;   
                                 products = new list<string> { “Aw123x” };
                                 detailsLevel = StockDetailsLevel.Status
                               }).Result;

The following table contains the list of default StockDetailsLevel options, followed by an example of how the list of options can be extended.

Name

Type

Description

Status

public const int Status = 1

Indicates that the minimum information is to be returned, which is stock status.

StatusAndAvailability

public const int StatusAndAvailability = 2

Indicates that the status and availability date information is to be returned. Availability date is relevant in case status is equal to.

Count

public const int Count = 3

All

public const int All = 4

The class is introduced as an extensible enum. In order to extend and customize the StockDetailsLevel options:

RequestResponse
public class MyECSStockDetailsLevel : StockDetailsLevel
{
    public const int MyCustomDetailLevel = 4;
      public MyECSStockDetailsLevel (int value : base(value)
      {   }
}

Class: StockStatus

The StockStatus class is used as a strongly typed value to indicate stock status. Using a strongly typed value eases the use of the API for solution developers. The following example illustrates the use of the class as an enum-like parameter:

RequestResponse
StockInformation stockInformation = GetStockInformation(
      new StockInformationRequest { shopName = “MyShop”;   
                                  products = new list<string> { “Aw123x” };
                                  detailsLevel = StockDetailsLevel.Status
                                 }).Result.StockInformation[0];
If (stockInformation.Status == StockStatus.PreOrderable) 
{
 // Do work
}

The following table contains the list of default StockStatus options, followed by an example of how the list of options can be extended.

Name

Type

Description

InStock

public const int InStock = 1

Indicates that the requested product is in stock.

OutOfStock

public const int OutOfStock = 2

Indicates that the requested product is out of stock.

PreOrderable

public const int PreOrderable = 3

Indicates that the requested product is not in stock yet, but is preorderable.

BackOrderable

public const int BackOrderable = 4

Indicates that the requested product is out of stock, but is back-orderable.

The class is introduced as an extensible enum. In order to extend and customize the StockDetailsLevel options:

RequestResponse
public class MyECSStockStatus : StockStatus
{
    public const int MyCustomStatus = 4;
      public MyECSStockStatus (int value : base(value)
      {   }
}

Class: InventoryProduct

The InventoryProduct class is used as a strongly typed value to identify a product. Using a strongly typed value eases the use of the API for solution developers.

Name

Type

Description

ProductId

String

Unique identifier for the product or product variant in the commerce system.

Class: IndexStockInformation

The IndexStockInformation class is used as a strongly typed composite value used in the GetProductStockLocations pipeline when retrieving locations for a particular product.

The IndexStockInformation class is also used as the base entity.

Name

Type

Description

InStockLocations

List<string>

A list of locations where the product is InStock.

OutOfStockLocations

List<string>

A list of locations where the product is out of stock.

OrderableLocations

List<string>

A list of locations where the product can be ordered from.

PreOrderable

Bool

Indicates whether the item is preorderable.

Class: StockLocation

The StockLocation class is used to indicate the stock location of a product.

Name

Type

Description

LocationId

String

The ID of the stock location.

Name

String

The name of the stock location.

Do you have some feedback for us?

If you have suggestions for improving this article,