StockInfoParameterExtension reference
This article provides reference material about StockInfoParameterExtension
class. All stock info parameter extensions
have to be inherited from the StockInfoParameterExtension
which, in turn, inherits from the core
Sana Commerce Cloud Extension
class.
This extension should be used to extend GetStockInfo
ERP request with additional filter parameters.
Note
ERP changes are required to support new parameter.
Note
Multiple StockInfoParameterExtension
extensions can be created in case request should be extended with multiple filter parameters.
Properties
ParameterName
The parameter name.
public override string ParameterName => "AddressId";
Methods
Note
All code examples may contain nonexistent methods or properties. They are used as declarations only and should be created if they fit the designed extension or deleted if they do not.
GetParameterValue
Gets the parameter value. The null
value should be returned in case parameter should not be added to request.
public override ErpFieldValue? GetParameterValue(in StockInfoParameterContext context)
{
var addressId = Api.CurrentUserData.Get<UserData>()?.SelectedAddressId;
if (string.IsNullOrEmpty(addressId))
return null;
return ErpFieldValue.FromString(addressId);
}
sealed class UserData
{
public string? SelectedAddressId { get; set; }
}