Table of Contents

Class Reward

Namespace
Dynamicweb.Ecommerce.Orders.Adjustments
Assembly
Dynamicweb.Ecommerce.dll

The base class for all discounts. A discount is applied when all conditions on a discount group is satisfied.

[Experimental("DWEX100001")]
public abstract class Reward : ConfigurableAddIn
Inheritance
Reward
Derived
Inherited Members

Properties

Active

public bool Active { get; set; }

Property Value

bool

ContextType

The type of context the discount is applied to.

public abstract AdjustmentContextType ContextType { get; }

Property Value

AdjustmentContextType

DiscountId

The Id of the group the discount is attached to.

public required string DiscountId { get; set; }

Property Value

string

Id

public string Id { get; set; }

Property Value

string

Settings

The AddIn parameters of the discount serialized as xml.

public string? Settings { get; set; }

Property Value

string

SortOrder

public required int SortOrder { get; set; }

Property Value

int

Methods

ApplyReward(OrderAdjustmentContext)

Applies the discount. The way a reward is applied is up to the implementation. It can use the OrderAdjustmentContext to get a reference to the order and apply the discount to the order.

public abstract bool ApplyReward(OrderAdjustmentContext context)

Parameters

context OrderAdjustmentContext

The current context containing the order or orderline where the discount is being applied to, depending on the AdjustmentContextType.

Returns

bool

GetDiscountAmount(AdjustmentContext)

Gets the discount amount for the product.

public abstract PriceInfo? GetDiscountAmount(AdjustmentContext context)

Parameters

context AdjustmentContext

The context containing the product being fetched.

Returns

PriceInfo

The discount amount for the product.

GetDiscountAmount(AdjustmentContext, PriceInfo)

Gets the discount amount for the product when applied sequentially after previously applied rewards. Rewards whose amount depends on the current net price (e.g. percentage rewards) should override this method and compute the discount from basePrice rather than the raw product price. The default implementation ignores basePrice and falls back to GetDiscountAmount(AdjustmentContext), which is the correct behaviour for rewards that produce a fixed discount independent of the current price.

public virtual PriceInfo? GetDiscountAmount(AdjustmentContext context, PriceInfo basePrice)

Parameters

context AdjustmentContext

The context containing the product being fetched.

basePrice PriceInfo

The running price this reward should be applied to (i.e. the product price reduced by previously applied rewards).

Returns

PriceInfo

The discount amount for the product.

GetDisplayValue(string)

Returns the UI display format for the discount, visible in the Discount overview screen.

public abstract string? GetDisplayValue(string parameterName)

Parameters

parameterName string

The name of the parameter.

Returns

string
To top