java.lang.Object
com.broadleafcommerce.promotion.offer.client.web.context.info.OfferRef
All Implemented Interfaces:
Serializable

public class OfferRef extends Object implements Serializable
Slimmed-down reference to an offer.
Author:
Nathan Moore (nathanmoore).
See Also:
  • Constructor Details

    • OfferRef

      public OfferRef()
  • Method Details

    • getId

      public String getId()
      The context ID of the offer.
      Returns:
      the context ID of the offer.
    • getName

      public String getName()
      Display name for this offer.
      Returns:
      the name of this offer
    • getDescription

      public String getDescription()
      Description of this offer.
      Returns:
      Description of this offer.
    • isTotalitarian

      public boolean isTotalitarian()
      Whether the offer is marked as totalitarian, meaning that it can be the only offer applied..
      Returns:
      Whether the offer is marked as totalitarian, meaning that it can be the only offer applied.
    • isCombinable

      public boolean isCombinable()
      Whether the offer is marked as combinable, meaning that it can be combined with other offers.
      Returns:
      Whether the offer is marked as combinable, meaning that it can be combined with other offers.
    • isFutureCredit

      public boolean isFutureCredit()
      Future credit means that the associated adjustment will be discounted at a later time to the user via a credit. It is up to the implementor to decide how to achieve this.
      Returns:
      Whether the offer is to be discounted at a later time and date.
    • isTargetsCanBeTargets

      @Deprecated public boolean isTargetsCanBeTargets()
      Deprecated.
      since 1.6, in favor of offer stacking and combinability
      Determines whether items that this offer targets to receive its discount can also receive discounts from other offers. For example, if this offer targets all "red t-shirts" with a 10% discount and another offer targets all "shirts" for a $5 discount, then this field determines whether that "red t-shirt" receives both discounts (whatever the best combination of the 2 is) or only the better offer of the 2. Default is false: A target can only receive a discount from 1 offer (the best one).
      Returns:
      Determines whether items that this offer targets to receive its discount can also receive discounts from other offers.
    • getCartLabel

      public String getCartLabel()
      A label for this offer typically used by the storefront.
      Returns:
      A label for this offer typically used by the storefront.
    • getProrationType

      public String getProrationType()
      Determines how an offer's discount amount is distributed across the offer's related order item types. This can either be set to prorate across target items or target and qualifier items.

      This property is used downstream in `OrderOperationServices` or other custom services to calculate the proper refund amounts when factoring in offer discounts.

      Returns:
      The type of order items that this discount is prorated across.
      See Also:
    • getCampaignTrackingIds

      public Set<String> getCampaignTrackingIds()
      The tracking identifiers of the campaigns of which this offer is a part. See com.broadleafcommerce.promotion.campaign.domain.Campaign#id
      Returns:
      The tracking codes of the campaigns of which this offer is a part
    • getDiscountMethodType

      public String getDiscountMethodType()
      Determines the method used to apply the discount. This is recorded for audit and potentially for downstream systems that need to recalculate pricing such as for subscriptions.
      Returns:
      The method to use to apply this discount.
      Since:
      2.0.4
      See Also:
    • getDiscountFactor

      public BigDecimal getDiscountFactor()
      The discount factor by which to discount a target. If the amount is 10, then whether it is calculated as a percentage (10%) or a currency amount ($10) is determined by discountMethodType. This is recorded for audit and potentially for downstream systems that need to recalculate pricing such as for subscriptions. This does not represent that actual amount discounted from the target.
      Returns:
      The amount of the discount to be applied.
      Since:
      2.0.4
    • getAttributes

      public Map<String,Object> getAttributes()
      Dynamic attributes that are a part of the offer.
      Returns:
      dynamic attributes that are a part of the offer
    • setId

      public void setId(String id)
      The context ID of the offer.
      Parameters:
      id - the context ID of the offer.
    • setName

      public void setName(String name)
      Display name for this offer.
      Parameters:
      name - the name of this offer
    • setDescription

      public void setDescription(String description)
      Description of this offer.
      Parameters:
      description - Description of this offer.
    • setTotalitarian

      public void setTotalitarian(boolean totalitarian)
      Whether the offer is marked as totalitarian, meaning that it can be the only offer applied..
      Parameters:
      totalitarian - Whether the offer is marked as totalitarian, meaning that it can be the only offer applied.
    • setCombinable

      public void setCombinable(boolean combinable)
      Whether the offer is marked as combinable, meaning that it can be combined with other offers.
      Parameters:
      combinable - Whether the offer is marked as combinable, meaning that it can be combined with other offers.
    • setFutureCredit

      public void setFutureCredit(boolean futureCredit)
      Future credit means that the associated adjustment will be discounted at a later time to the user via a credit. It is up to the implementor to decide how to achieve this.
      Parameters:
      futureCredit - Whether the offer is to be discounted at a later time and date.
    • setTargetsCanBeTargets

      @Deprecated public void setTargetsCanBeTargets(boolean targetsCanBeTargets)
      Deprecated.
      since 1.6, in favor of offer stacking and combinability
      Determines whether items that this offer targets to receive its discount can also receive discounts from other offers. For example, if this offer targets all "red t-shirts" with a 10% discount and another offer targets all "shirts" for a $5 discount, then this field determines whether that "red t-shirt" receives both discounts (whatever the best combination of the 2 is) or only the better offer of the 2. Default is false: A target can only receive a discount from 1 offer (the best one).
      Parameters:
      targetsCanBeTargets - Determines whether items that this offer targets to receive its discount can also receive discounts from other offers.
    • setCartLabel

      public void setCartLabel(String cartLabel)
      A label for this offer typically used by the storefront.
      Parameters:
      cartLabel - A label for this offer typically used by the storefront.
    • setProrationType

      public void setProrationType(String prorationType)
      Determines how an offer's discount amount is distributed across the offer's related order item types. This can either be set to prorate across target items or target and qualifier items.

      This property is used downstream in `OrderOperationServices` or other custom services to calculate the proper refund amounts when factoring in offer discounts.

      Parameters:
      prorationType - The type of order items that this discount is prorated across.
      See Also:
    • setCampaignTrackingIds

      public void setCampaignTrackingIds(Set<String> campaignTrackingIds)
      The tracking identifiers of the campaigns of which this offer is a part. See com.broadleafcommerce.promotion.campaign.domain.Campaign#id
    • setDiscountMethodType

      public void setDiscountMethodType(String discountMethodType)
      Determines the method used to apply the discount. This is recorded for audit and potentially for downstream systems that need to recalculate pricing such as for subscriptions.
      Parameters:
      methodType - The method to use to apply this discount.
      Since:
      2.0.4
      See Also:
    • setDiscountFactor

      public void setDiscountFactor(BigDecimal discountFactor)
      The discount factor by which to discount a target. If the amount is 10, then whether it is calculated as a percentage (10%) or a currency amount ($10) is determined by discountMethodType. This is recorded for audit and potentially for downstream systems that need to recalculate pricing such as for subscriptions. This does not represent that actual amount discounted from the target.
      Parameters:
      amount - The amount of the discount to be applied.
      Since:
      2.0.4
    • setAttributes

      public void setAttributes(Map<String,Object> attributes)
      Dynamic attributes that are a part of the offer.
      Parameters:
      attributes - dynamic attributes that are a part of the offer
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object