Sources to Sales Channels Mapping - magento/inventory GitHub Wiki
Table of Contents
Description
Merchant should have an ability to map existing physical sources to some particular sales channels. The most appropriate sales channel example in Magento is Website. But that's not the only option, for example, for B2B merchants Customer Group could be considered a sales channel, or Country/State etc. Thus we need to provide an ability on the level of API to implement this kind of mapping.
MSI/admin-ui/reserved-stock.jpeg
Omni channel
Diagram of relationship
MSI/admin-ui/sales_channel_diagram.png
Interfaces Draft
/**
* Aggregated Stock
* Stock would be used on Front-End to show final Stock Quantity
**/
interface Stock
{
public function getStockId();
public function getStockName();
}
/**
* Aggregation of physical sources and creation of virtual stock
* based on this aggregation
**/
interface SourceStockLink
{
public function getStockId();
public function getSourceId();
}
/**
* Representation of Sales Channel a.k.a Website or CustomerGroup
**/
interface SalesChannel
{
public function getEntityId(); // Surrogate key
public function getSalesChannelId(); // represents concrete Sales Channel Id, for example, website_id - 1
public function getType(); // "WEBSITE" | "COUNTRY" | "CUSTOMER_GROUP"
}
/**
* Interface to assign specific stock to particular sales channel
**/
interface StockSalesChannelLink
{
public function getStockId();
public function getSalesChannelEntityId(); // there should not be more than ONE sales channel with particular ID value
}
Single Stock Example
interface Stock
{
public function getStockId(); // 1
public function getStockName(); // "Single Stock"
}
interface SourceStockLink
{
public function getStockId(); // 1
public function getSourceId(); // 1
}
interface SalesChannel
{
public function getEntityId(); // 1
public function getSalesChannelId(); // website_id - 1
public function getType(); // "WEBSITE"
}
interface StockSalesChannelLink
{
public function getStockId(); // 1
public function getSalesChannelEntityId(); // 1
}