IDiscountService
Defines the Vendr Discount service
public interface IDiscountService : ICachedEntityService<DiscountReadOnly>, IService
Inheritance
- interface ICachedEntityService<TEntityType>
- interface IService
Namespace
Methods
DeleteDiscount (1 of 2)
Deletes a Discount
public void DeleteDiscount(Guid id)
Parameters
Parameter | Description |
---|---|
id |
The ID of the Discount to delete |
DeleteDiscount (2 of 2)
Deletes a Discount
public void DeleteDiscount(Discount entity)
Parameters
Parameter | Description |
---|---|
entity |
The Discount to delete |
DiscountCodeExists
Check to see if a Discount Code already exists in the given Store
public bool DiscountCodeExists(Guid storeId, string code)
Parameters
Parameter | Description |
---|---|
storeId |
The ID of the Store the DiscountReadOnly entity belongs to |
code |
The Discount Code to check |
Returns
Returns true
if the Discount Code exists, otherwise returns false
.
DiscountExists
Check to see if a DiscountReadOnly
exists in the given Store
with the given Alias
public bool DiscountExists(Guid storeId, string alias)
Parameters
Parameter | Description |
---|---|
storeId |
The ID of the Store the DiscountReadOnly entity belongs to |
alias |
The Alias of the DiscountReadOnly entity to check |
Returns
Returns true
if the DiscountReadOnly
exists, otherwise returns false
.
GetActiveDiscounts
Get a list of currently active DiscountReadOnly
entities from the given Store
public IEnumerable<DiscountReadOnly> GetActiveDiscounts(Guid storeId)
Parameters
Parameter | Description |
---|---|
storeId |
The ID of the Store the DiscountReadOnly entities belong to |
Returns
A list of DiscountReadOnly
entities
Remarks
A discount is active if it's Active status is true
and it's StartDate and ExpiryDate are either null
, or the current UTC Date Time is between these two dates
GetDiscount (1 of 2)
Get a DiscountReadOnly
entity by ID
public DiscountReadOnly GetDiscount(Guid id)
Parameters
Parameter | Description |
---|---|
id |
The ID of the DiscountReadOnly entity to fetch |
Returns
A DiscountReadOnly
entity
GetDiscount (2 of 2)
Get a DiscountReadOnly
entity by Store
and Alias
public DiscountReadOnly GetDiscount(Guid storeId, string alias)
Parameters
Parameter | Description |
---|---|
storeId |
The ID of the Store the DiscountReadOnly entity belongs to |
alias |
The Alias of the DiscountReadOnly entity to fetch |
Returns
A DiscountReadOnly
entity
GetDiscountByCode
Get a DiscountReadOnly
entity by Store
and Discount Code
public DiscountReadOnly GetDiscountByCode(Guid storeId, string code)
Parameters
Parameter | Description |
---|---|
storeId |
The ID of the Store the DiscountReadOnly entity belongs to |
code |
A Discount Code associated with the DiscountReadOnly entity to fetch |
Returns
A DiscountReadOnly
entity
GetDiscountRewardProviderDefinitions
Get a list of DiscountRewardProviderDefinition
entities for all IDiscountRewardProvider
instances
public IEnumerable<DiscountRewardProviderDefinition> GetDiscountRewardProviderDefinitions()
Returns
A list of DiscountRewardProviderDefinition
entities
GetDiscountRewardProviderScaffold
Get a DiscountRewardProviderScaffold
by IDiscountRewardProvider
Alias
public DiscountRewardProviderScaffold GetDiscountRewardProviderScaffold(string alias)
Parameters
Parameter | Description |
---|---|
alias |
The Alias of the IDiscountRewardProvider to create a DiscountRewardProviderScaffold for |
Returns
A DiscountRewardProviderScaffold
GetDiscountRuleProviderDefinitions
Get a list of DiscountRuleProviderDefinition
entities for all IDiscountRuleProvider
instances
public IEnumerable<DiscountRuleProviderDefinition> GetDiscountRuleProviderDefinitions()
Returns
A list of DiscountRuleProviderDefinition
entities
GetDiscountRuleProviderScaffold
Get a DiscountRuleProviderScaffold
by IDiscountRuleProvider
Alias
public DiscountRuleProviderScaffold GetDiscountRuleProviderScaffold(string alias)
Parameters
Parameter | Description |
---|---|
alias |
The Alias of the IDiscountRuleProvider to create a DiscountRuleProviderScaffold for |
Returns
A DiscountRuleProviderScaffold
GetDiscounts (1 of 2)
Get a list of all DiscountReadOnly
entities from the given Store
public IEnumerable<DiscountReadOnly> GetDiscounts(Guid storeId)
Parameters
Parameter | Description |
---|---|
storeId |
The ID of the Store the DiscountReadOnly entities belong to |
Returns
A list of DiscountReadOnly
entities
GetDiscounts (2 of 2)
Get a list of DiscountReadOnly
entities with the given IDs
public IEnumerable<DiscountReadOnly> GetDiscounts(Guid[] ids)
Parameters
Parameter | Description |
---|---|
ids |
The IDs of the DiscountReadOnly entities to fetch |
Returns
A list of DiscountReadOnly
entities
SaveDiscount
Saves a Discount
public void SaveDiscount(Discount entity)
Parameters
Parameter | Description |
---|---|
entity |
The Discount to save |
SortDiscounts
Sorts a list of Discount
entities by ID according to the order of those IDs
public void SortDiscounts(Guid[] sortedIds)
Parameters
Parameter | Description |
---|---|
sortedIds |
The IDs of the Discount entities to sort, in the order by which to sort them |
ValidateDiscountCode
Check whether a Discount Code is valid
public bool ValidateDiscountCode(Guid storeId, string code)
Parameters
Parameter | Description |
---|---|
storeId |
The ID of the Store the DiscountReadOnly entity belongs to |
code |
The Discount Code to validate |
Returns
Returns true
if the Discount Code is valid, otherwise returns false
.
Remarks
A Discount Code is valid if it's associated Discount has an Active status of true
and it's StartDate and ExpiryDate are either null
, or the current UTC Date Time is between these two dates, and the given Discount Code has not yet reached it's usage limit