Commerce / Inventory Provider
Commerce Provider
The commerce provider is an optional part of the modal dressing room Host Adaptor. If implemented it provider pricing information for garments, as well as shopping cart integration. The interface that has to be implemented for this is the following:
/**
* Provides information for commerce related fields.
*/
export interface CommerceProvider {
/**
* Returns the currency for a given garment.
* @param id Unique ID of the garment
*/
getCurrencyForId(id: ReferenceData): Awaitable<string | undefined>;
/**
* Returns the price of a given garment.
* @param id Unique ID of the garment
*/
getPriceForId(id: ReferenceData): Awaitable<number | undefined>;
/**
* Returns the strike price of a given garment, if applicable
* @param id Unique ID of the garment
*/
getStrikePriceForId(id: ReferenceData): Awaitable<number | undefined>;
/**
* Returns if it is allowed to run add to cart operations in the MDRC.
* If it is not set it will default to true!
* @returns true if it is allowed to run add to cart operations in the MDRC
*/
allowAddToCart?(): Awaitable<boolean>;
/**
* Adds a list of items to the shopping cart
* @param items Array of CartItem objects containing the ID, size and quantity of the products
*/
addToCart?(items: Array<CartItem>): Awaitable<void>;
/**
* If this is implemented the function is called if the customer would like
* to purchase the items identified in the items parameter.
*
* No size selection happened yet.
*
* This callback could show a screen for the user to select garment sizes, etc.
*
* @param items Array of IDs of the garments the customer would like to purchase
*/
addToCartIntend?(items: Array<ReferenceData>): Awaitable<void>;
}
Inventory Provider
The inventory provider is an optional part of the modal dressing room Host Adaptor. If implemented it provides inventory information for garments like available sizes. It is also necessary for size recommendation and visualization features, because it provider sizing information for garments. The interface that has to be implemented for this is the following:
/**
* Provider for inventory related functionality. All functionality refers to your e-commerce solution.
*/
export interface InventoryProvider {
/**
* Returns the available sizes for a garment with the given ID.
* @param id Unique ID of the garment
*/
getSizes(id: ReferenceData): Awaitable<Array<ItemSize>>;
}