Class LineItemOfferDetail
java.lang.Object
com.broadleafcommerce.promotion.offer.web.context.info.LineItemOfferDetail
- All Implemented Interfaces:
Serializable
DTO containing information about the effects of all the
offer's applicable to an
EnhancedLineItem either treating it as a Offer.getTargetItemCriteria() target} or
a Offer.getItemQualifierCriteria() qualifier}.- Author:
- Nathan Moore (nathanmoore).
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected OfferQualifieraddNewQualifierAndGet(com.broadleafcommerce.common.extension.TypeFactory offerFactory, CandidateItemOffer itemOffer) protected OfferDiscountaddNewTargetAndGet(com.broadleafcommerce.common.extension.TypeFactory offerFactory, CandidateItemOffer itemOffer) addOrUpdateMatchingOfferQualifier(CandidateItemOffer itemOffer, ItemCriteriaRule qualifierCriteria, int qtyToMarkAsQualifier, com.broadleafcommerce.common.extension.TypeFactory offerFactory) Either creates a newOfferQualifieror updates a preexisting one for the givenCandidateItemOffer, marking the quantity of to reserve for use as qualifiers for the givenItemCriteriaRule.voidaddOrUpdateMatchingOfferTarget(CandidateItemOffer itemOffer, ItemCriteriaRule targetCriteria, int qtyToMarkAsTarget, com.broadleafcommerce.common.extension.TypeFactory offerFactory) Either creates a newOfferDiscountor updates a preexisting one for the givenCandidateItemOffer, marking the quantity of to reserve for use as targets for the givenItemCriteriaRule.javax.money.MonetaryAmountcalculateAdjustmentValue(javax.money.CurrencyUnit currency, boolean useSaleAdjustments) javax.money.MonetaryAmountcalculateItemRecurringPriceWithAdjustments(boolean allowSalePrice) Similar tocalculateItemUnitPriceWithAdjustments(boolean)but for recurring prices.javax.money.MonetaryAmountcalculateItemUnitPriceWithAdjustments(boolean allowSalePrice) protected javax.money.MonetaryAmountprotected javax.money.MonetaryAmountprotected javax.money.MonetaryAmountprotected javax.money.MonetaryAmountjavax.money.MonetaryAmountcalculateTotalAdjustmentValue(javax.money.CurrencyUnit currency, boolean useSaleAdjustments) protected booleancheckStackable(Offer offer, Offer otherOffer) voidThis method will check to see if the salePriceAdjustments or standardPriceAdjustments are better and remove those that should not apply.protected voidvoidClears target and qualifier quantities that were marked for a promotion that did not have enough qualifiers or targets to get applied.protected voidcopyDiscountsAndAdjustmentsToNewDetail(com.broadleafcommerce.common.extension.TypeFactory offerFactory, int discountQty, LineItemOfferDetail newDetail) protected voidfinalizeAdjustments(boolean useSaleAdjustments) voidUpdates the target and qualifier quantities to indicate the number that are being used.protected voidfinalizeRecurringAdjustments(boolean useSaleAdjustments) javax.money.MonetaryAmountThe total value of alladjustments(excluding recurring) times thequantityof this detail.protected javax.money.MonetaryAmountgetAdjustedTotalUsingSalePrice(javax.money.MonetaryAmount standardAdjustmentPrice) Determine the upfront adjustment total using the sale price.protected javax.money.MonetaryAmountgetAdjustedTotalUsingSalePrice(javax.money.MonetaryAmount standardAdjustmentPrice, javax.money.MonetaryAmount saleAdjustmentPrice, javax.money.MonetaryAmount unadjustedSalePrice, boolean useRecurring) protected javax.money.MonetaryAmountgetAdjustedTotalUsingStandardPrice(javax.money.MonetaryAmount standardAdjustmentPrice) doubleThe ratio of the offer discount to apply to this item.doublejavax.money.MonetaryAmountgetFinalAdjustmentValue(javax.money.CurrencyUnit currency) javax.money.MonetaryAmountgetFinalAdjustmentValueIncludingFutureDiscounts(javax.money.CurrencyUnit currency) javax.money.MonetaryAmountgetFinalAdjustmentValueIncludingFutureDiscountsForPermutation(javax.money.CurrencyUnit currency) javax.money.MonetaryAmountReturns the final total for this item taking into account the finalized orderAdjustments.javax.money.MonetaryAmountgetFinalTotalAdjustmentValue(javax.money.CurrencyUnit currency) javax.money.MonetaryAmountgetFutureCreditValue(javax.money.CurrencyUnit currency) TheEnhancedLineItemaffected byoffers.Additional info for all theofferstreating thelineItemas a target.Additional information about theoffersusing thelineItemas item qualifiers.TheProratedItemOfferAdjustmentscaused byofferswithDiscount.getProrationType()orProrationType.TARGET_AND_QUALIFIERtreating bothlineItemas a target and the items that qualify it.protected intgetQtyAvailableToBeUsed(CandidateItemOffer offer, boolean isForQualifierQty) Calculates the number oforder itemsnot already exclusively used as targets or qualifiers either by this offer or any other and, therefore, are available to be used as qualifiers or targets by the givenOffer.intCalculates the number oforder itemsavailable to be used as qualifiers for the providedOffer.intCalculates the number oforder itemsavailable to be used as targets for the providedOffer.intThe quantity of items related to this detail.protected intgetQuantityOfItemsExclusivelyUsedAsQualifiers(CandidateItemOffer thisOffer, Set<OfferQualifier> offerQualifiers, boolean isForQualifierQty) Calculates the number oforder itemsalready exclusively used as qualifiers.protected intgetQuantityOfItemsExclusivelyUsedAsTargets(CandidateItemOffer thisOffer, Set<OfferDiscount> offerDiscounts, boolean isForQualifierQty) Calculates the number oforder itemsalready exclusively used as targets.javax.money.MonetaryAmountThe total value of all recurringadjustmentstimes thequantityof this detail.protected javax.money.MonetaryAmountgetRecurringAdjustedTotalUsingSalePrice(javax.money.MonetaryAmount standardAdjustmentPrice) Determine the recurring (a.k.a., subscription) adjustment total using the sale recurring price.protected javax.money.MonetaryAmountgetRecurringAdjustedTotalUsingStandardPrice(javax.money.MonetaryAmount standardAdjustmentPrice) javax.money.MonetaryAmountgetRecurringDiscountValue(javax.money.CurrencyUnit currency) Totals the discount value for recurring adjustments only.inthashCode()protected booleanbooleanWhether theadjustmentsare the orderAdjustments to actually use rather than being potential or incomplete.protected Predicate<ItemOfferAdjustment>protected booleanprotected booleanisStackable(Offer offer, Offer otherOffer) booleanbooleanWhether to useEnhancedLineItem.getSaleRecurringPrice()in price adjustment calculations.booleanWhether to useEnhancedLineItem.getSalePrice()in price adjustment calculations.protected Optional<OfferQualifier>lookupOfferQualifierByOffer(CandidateItemOffer itemOffer) protected Optional<OfferDiscount>lookupOfferTargetByOffer(CandidateItemOffer itemOffer) voidRemoves all orderAdjustments from this detail.protected voidprotected voidprotected voidremoveZeroDollarAdjustments(boolean useSalePrice) protected voidremoveZeroDollarRecurringAdjustments(boolean useSalePrice) voidsetAdjustedTotal(javax.money.MonetaryAmount adjustedTotal) The total value of alladjustments(excluding recurring) times thequantityof this detail.voidsetAdjustments(Set<ItemOfferAdjustment> adjustments) voidsetAdjustmentsFinalized(boolean adjustmentsFinalized) Whether theadjustmentsare the orderAdjustments to actually use rather than being potential or incomplete.voidsetBundleRatio(double bundleRatio) The ratio of the offer discount to apply to this item.voidsetLineItem(EnhancedLineItem lineItem) TheEnhancedLineItemaffected byoffers.voidsetOfferDiscounts(Set<OfferDiscount> offerDiscounts) Additional info for all theofferstreating thelineItemas a target.voidsetOfferQualifiers(Set<OfferQualifier> offerQualifiers) Additional information about theoffersusing thelineItemas item qualifiers.voidsetProratedAdjustments(Set<EnhancedProratedItemOfferAdjustment> proratedAdjustments) TheProratedItemOfferAdjustmentscaused byofferswithDiscount.getProrationType()orProrationType.TARGET_AND_QUALIFIERtreating bothlineItemas a target and the items that qualify it.voidsetQuantity(int quantity) The quantity of items related to this detail.voidsetRecurringAdjustedTotal(javax.money.MonetaryAmount recurringAdjustedTotal) The total value of all recurringadjustmentstimes thequantityof this detail.voidsetUseRecurringSaleAdjustments(boolean useRecurringSaleAdjustments) Whether to useEnhancedLineItem.getSaleRecurringPrice()in price adjustment calculations.voidsetUseSaleAdjustments(boolean useSaleAdjustments) Whether to useEnhancedLineItem.getSalePrice()in price adjustment calculations.protected LineItemOfferDetailsplit(com.broadleafcommerce.common.extension.TypeFactory offerFactory, int discountQty, String offerId, boolean hasQualifiers) Deprecated.protected LineItemOfferDetailsplit(com.broadleafcommerce.common.extension.TypeFactory offerFactory, OfferDiscount offerDiscount) Splits this item into twoLineItemOfferDetailsand returns the newly createdLineItemOfferDetail.splitIfNecessary(com.broadleafcommerce.common.extension.TypeFactory offerFactory) Checks to see that the discount quantities match the target quantities.toString()
-
Constructor Details
-
LineItemOfferDetail
public LineItemOfferDetail()
-
-
Method Details
-
finalizeQuantities
public void finalizeQuantities()Updates the target and qualifier quantities to indicate the number that are being used. -
clearAllNonFinalizedQuantities
public void clearAllNonFinalizedQuantities()Clears target and qualifier quantities that were marked for a promotion that did not have enough qualifiers or targets to get applied. -
addOrUpdateMatchingOfferQualifier
@NonNull public OfferQualifier addOrUpdateMatchingOfferQualifier(@NonNull CandidateItemOffer itemOffer, @NonNull ItemCriteriaRule qualifierCriteria, int qtyToMarkAsQualifier, @NonNull com.broadleafcommerce.common.extension.TypeFactory offerFactory) Either creates a newOfferQualifieror updates a preexisting one for the givenCandidateItemOffer, marking the quantity of to reserve for use as qualifiers for the givenItemCriteriaRule.- Parameters:
itemOffer- theCandidateItemOfferfor which to either create a newOfferQualifieror update a preexisting one.qualifierCriteria- theOffer.getItemQualifierCriteria()matched by thelineItemqtyToMarkAsQualifier- the number of items to mark as reserved for use as item qualifiersofferFactory- theTypeFactoryused to create a newOfferQualifierif needed- Returns:
- the new or updated
OfferQualifierDTO related to the givenCandidateItemOffer
-
addOrUpdateMatchingOfferTarget
public void addOrUpdateMatchingOfferTarget(@NonNull CandidateItemOffer itemOffer, @NonNull ItemCriteriaRule targetCriteria, int qtyToMarkAsTarget, @NonNull com.broadleafcommerce.common.extension.TypeFactory offerFactory) Either creates a newOfferDiscountor updates a preexisting one for the givenCandidateItemOffer, marking the quantity of to reserve for use as targets for the givenItemCriteriaRule.- Parameters:
itemOffer- theCandidateItemOfferfor which to either create a newOfferDiscountor update a preexisting one.targetCriteria- theOffer.getTargetItemCriteria()matched by thelineItemqtyToMarkAsTarget- the number of items to mark as reserved for use as target itemsofferFactory- theTypeFactoryused to create a newOfferDiscountif needed
-
isNonCombinableOfferApplied
protected boolean isNonCombinableOfferApplied()- Returns:
- whether any
ItemOfferAdjustment.getOffer()adjustment's offer} doesn't have aOffer.getCombinabilityType()ofCombinabilityType.ANY.
-
isTotalitarianOfferApplied
public boolean isTotalitarianOfferApplied()- Returns:
- whether any
ItemOfferAdjustment.getOffer()adjustment's offer} has aOffer.getCombinabilityType()ofCombinabilityType.NONE.
-
getQtyAvailableToUseAsTarget
Calculates the number oforder itemsavailable to be used as targets for the providedOffer.Checks if the provided
Offeriscombinableand if all offers already applied tothe related order itemare also combinable, then returns the result of#getQtyAvailableToBeUsed(Offer, boolean). If this or an already applied offer arenon-combinableortotalitarian, then returns 0.- Parameters:
offer- the offer for which we are counting the number of possible targets- Returns:
- the number of
orderLineItemsnot already exclusively used as targets or qualifiers
-
getQtyAvailableToUseAsQualifier
Calculates the number oforder itemsavailable to be used as qualifiers for the providedOffer.- Parameters:
offer- the offer for which we are counting the number of possible qualifiers- Returns:
- the number of
orderLineItemsnot already exclusively used as targets or qualifiers
-
getFinalizedTotalWithAdjustments
public javax.money.MonetaryAmount getFinalizedTotalWithAdjustments()Returns the final total for this item taking into account the finalized orderAdjustments. CallschooseSaleOrStandardPrice()to finalize the orderAdjustments before returning them.- Returns:
- the final total for this item taking into account the finalized orderAdjustments.
-
splitIfNecessary
@NonNull public Optional<LineItemOfferDetail> splitIfNecessary(@NonNull com.broadleafcommerce.common.extension.TypeFactory offerFactory) Checks to see that the discount quantities match the target quantities. If not, splits this item into two.- Returns:
- the item created by splitting
-
calculateItemUnitPriceWithAdjustments
public javax.money.MonetaryAmount calculateItemUnitPriceWithAdjustments(boolean allowSalePrice) - Parameters:
allowSalePrice- whether to use the sale price in the calculation- Returns:
- the price to be used for this priceDetail taking into account whether or not the sales price can be used.
-
calculateItemRecurringPriceWithAdjustments
public javax.money.MonetaryAmount calculateItemRecurringPriceWithAdjustments(boolean allowSalePrice) Similar tocalculateItemUnitPriceWithAdjustments(boolean)but for recurring prices.- Parameters:
allowSalePrice- whether to use the sale price in the calculation- Returns:
- the price to be used for this priceDetail taking into account whether or not the sales price can be used.
- Since:
- Offer Service 3.1.0, Release Train 2.2.0
-
chooseSaleOrStandardPrice
public void chooseSaleOrStandardPrice()This method will check to see if the salePriceAdjustments or standardPriceAdjustments are better and remove those that should not apply. -
buildDetailKey
- Returns:
- a key that represents a unique offer detail
-
getFinalTotalAdjustmentValue
public javax.money.MonetaryAmount getFinalTotalAdjustmentValue(javax.money.CurrencyUnit currency) - Returns:
- the finalized adjustment value multiplied by the quantity
-
calculateTotalAdjustmentValue
public javax.money.MonetaryAmount calculateTotalAdjustmentValue(javax.money.CurrencyUnit currency, boolean useSaleAdjustments) -
calculateAdjustmentValue
public javax.money.MonetaryAmount calculateAdjustmentValue(javax.money.CurrencyUnit currency, boolean useSaleAdjustments) -
getFinalAdjustmentValue
public javax.money.MonetaryAmount getFinalAdjustmentValue(javax.money.CurrencyUnit currency) -
isDiscountCurrentOrder
-
getFinalAdjustmentValueIncludingFutureDiscounts
public javax.money.MonetaryAmount getFinalAdjustmentValueIncludingFutureDiscounts(javax.money.CurrencyUnit currency) -
getFinalAdjustmentValueIncludingFutureDiscountsForPermutation
public javax.money.MonetaryAmount getFinalAdjustmentValueIncludingFutureDiscountsForPermutation(javax.money.CurrencyUnit currency) -
removeAllAdjustments
public void removeAllAdjustments()Removes all orderAdjustments from this detail. Typically called when it has been determined that another "totalitarian" offer has been applied. -
getQuantityOfItemsExclusivelyUsedAsTargets
protected int getQuantityOfItemsExclusivelyUsedAsTargets(CandidateItemOffer thisOffer, Set<OfferDiscount> offerDiscounts, boolean isForQualifierQty) Calculates the number oforder itemsalready exclusively used as targets.For qualifiers, his will include:
- The number of items already used as targets by this offer
- The number of items already used as targets by another offer if
Offer.isQualifiersCanBeTargets()is false for this offer or the other
For targets, his will include:
- The number of items already used as targets by this offer
- The number of items already used as targets by another offer if
Offer#isTargetsCanBeTargets()is false for that offerr
- Parameters:
thisOffer- the offer for which we are counting the number of possible qualifiersofferDiscounts- theOfferDiscountDTOs containing information about items already used as targets- Returns:
- the number of
orderLineItemsnot already exclusively used as targets
-
isStackable
-
checkStackable
-
getQuantityOfItemsExclusivelyUsedAsQualifiers
protected int getQuantityOfItemsExclusivelyUsedAsQualifiers(CandidateItemOffer thisOffer, Set<OfferQualifier> offerQualifiers, boolean isForQualifierQty) Calculates the number oforder itemsalready exclusively used as qualifiers.For qualifiers, this will include:
- The number of items already used as qualifiers by this offer
- The number of items already used as qualifiers by another offer if
Offer.isQualifiersCanBeQualifiers()is false for this offer or the other offer
For targets, this will include:
- The number of items already used as qualifiers by this offer
- The number of items already used as qualifiers by another offer if
Offer.isQualifiersCanBeTargets()is false that offer
- Parameters:
thisOffer- the offer for which we are counting the number of possible qualifiersofferQualifiers- theOfferQualifierDTOs containing information about items already used as qualifiers- Returns:
- the number of
orderLineItemsalready exclusively used as qualifiers
-
hasOrderItemAdjustments
protected boolean hasOrderItemAdjustments() -
chooseUnadjustedSaleOrStandardPrice
protected void chooseUnadjustedSaleOrStandardPrice() -
calculateSaleAdjustmentUnitPrice
protected javax.money.MonetaryAmount calculateSaleAdjustmentUnitPrice() -
calculateSaleRecurringAdjustmentUnitPrice
protected javax.money.MonetaryAmount calculateSaleRecurringAdjustmentUnitPrice() -
calculateStandardAdjustmentUnitPrice
protected javax.money.MonetaryAmount calculateStandardAdjustmentUnitPrice() -
calculateStandardRecurringAdjustmentUnitPrice
protected javax.money.MonetaryAmount calculateStandardRecurringAdjustmentUnitPrice() -
getAdjustedTotalUsingSalePrice
protected javax.money.MonetaryAmount getAdjustedTotalUsingSalePrice(javax.money.MonetaryAmount standardAdjustmentPrice) Determine the upfront adjustment total using the sale price. If the adjusted total is less than the unadjusted, then all non-DefaultAdjustmentType.RECURRING_DISCOUNTadjustments will be cleared.- Parameters:
standardAdjustmentPrice- The standard price to use as a baseline for comparison- Returns:
- The total of recurring adjustments
-
getRecurringAdjustedTotalUsingSalePrice
protected javax.money.MonetaryAmount getRecurringAdjustedTotalUsingSalePrice(javax.money.MonetaryAmount standardAdjustmentPrice) Determine the recurring (a.k.a., subscription) adjustment total using the sale recurring price. If the adjusted total is less than the unadjusted, then allDefaultAdjustmentType.RECURRING_DISCOUNTadjustments will be cleared.- Parameters:
standardAdjustmentPrice- The standard price to use as a baseline for comparison- Returns:
- The total of recurring adjustments
- Since:
- Offer Service 3.1.0, Release Train 2.2.0
-
getAdjustedTotalUsingSalePrice
protected javax.money.MonetaryAmount getAdjustedTotalUsingSalePrice(javax.money.MonetaryAmount standardAdjustmentPrice, javax.money.MonetaryAmount saleAdjustmentPrice, javax.money.MonetaryAmount unadjustedSalePrice, boolean useRecurring) - Since:
- Offer Service 3.1.0, Release Train 2.2.0
- See Also:
-
getAdjustedTotalUsingStandardPrice
protected javax.money.MonetaryAmount getAdjustedTotalUsingStandardPrice(javax.money.MonetaryAmount standardAdjustmentPrice) -
getRecurringAdjustedTotalUsingStandardPrice
protected javax.money.MonetaryAmount getRecurringAdjustedTotalUsingStandardPrice(javax.money.MonetaryAmount standardAdjustmentPrice) -
removeStandardOnlyAdjustments
protected void removeStandardOnlyAdjustments() -
removeStandardOnlyRecurringAdjustments
protected void removeStandardOnlyRecurringAdjustments() -
removeZeroDollarAdjustments
protected void removeZeroDollarAdjustments(boolean useSalePrice) -
removeZeroDollarRecurringAdjustments
protected void removeZeroDollarRecurringAdjustments(boolean useSalePrice) -
finalizeAdjustments
protected void finalizeAdjustments(boolean useSaleAdjustments) -
finalizeRecurringAdjustments
protected void finalizeRecurringAdjustments(boolean useSaleAdjustments) -
split
protected LineItemOfferDetail split(com.broadleafcommerce.common.extension.TypeFactory offerFactory, OfferDiscount offerDiscount) Splits this item into twoLineItemOfferDetailsand returns the newly createdLineItemOfferDetail.- Parameters:
offerFactory- theTypeFactoryused to create a newOfferDiscountif neededofferDiscount- theOfferDiscountto split- Returns:
- the
LineItemOfferDetailcreated by splitting
-
split
@Deprecated protected LineItemOfferDetail split(com.broadleafcommerce.common.extension.TypeFactory offerFactory, int discountQty, String offerId, boolean hasQualifiers) Deprecated.since 1.6, in favor ofsplit(TypeFactory, OfferDiscount).Splits this item into twoLineItemOfferDetailsand returns the newly createdLineItemOfferDetail.- Parameters:
offerFactory- theTypeFactoryused to create a newOfferDiscountif neededdiscountQty- the discount quantity to splitofferId- the offer id of theOfferDiscount.getOffer()hasQualifiers- whether or not theOfferDiscount.getOffer()has qualifiers- Returns:
- the
LineItemOfferDetailcreated by splitting
-
copyDiscountsAndAdjustmentsToNewDetail
protected void copyDiscountsAndAdjustmentsToNewDetail(com.broadleafcommerce.common.extension.TypeFactory offerFactory, int discountQty, LineItemOfferDetail newDetail) - Parameters:
offerFactory- theTypeFactoryused to create a newOfferDiscountif neededdiscountQty- quantity to split the discountnewDetail- the newLineItemOfferDetailto copy theOfferDiscountsandItemOfferAdjustmentsto
-
addNewQualifierAndGet
protected OfferQualifier addNewQualifierAndGet(com.broadleafcommerce.common.extension.TypeFactory offerFactory, CandidateItemOffer itemOffer) -
lookupOfferQualifierByOffer
-
getQtyAvailableToBeUsed
Calculates the number oforder itemsnot already exclusively used as targets or qualifiers either by this offer or any other and, therefore, are available to be used as qualifiers or targets by the givenOffer.Items that are not available to be qualifiers will be:
- Items already used as targets by the given offer
- Items already used as qualifiers by the given offer
- Items already used as targets by another offer if
Offer.isQualifiersCanBeTargets()is false for the given offer - Items already used as qualifiers by another offer if
Offer.isQualifiersCanBeQualifiers()is false for the given offer or for the other offer
Items that are not available to be targets will be:
- Items already used as targets by the given offer
- Items already used as qualifiers by the given offer
- Items already used as targets by another offer if
Offer#isTargetsCanBeTargets()is false for the given offer - Items already used as qualifiers by another offer if
Offer.isQualifiersCanBeTargets()is false for the given offer or for the other offer
- Parameters:
offer- the offer for which we are counting the number of possible qualifiers and targetsisForQualifierQty- Whether this calculation is for qualifiers available or targets.- Returns:
- the number of
orderLineItemsnot already exclusively used as targets or qualifiers
-
addNewTargetAndGet
protected OfferDiscount addNewTargetAndGet(com.broadleafcommerce.common.extension.TypeFactory offerFactory, CandidateItemOffer itemOffer) -
lookupOfferTargetByOffer
-
getFutureCreditValue
public javax.money.MonetaryAmount getFutureCreditValue(javax.money.CurrencyUnit currency) -
getRecurringDiscountValue
public javax.money.MonetaryAmount getRecurringDiscountValue(javax.money.CurrencyUnit currency) Totals the discount value for recurring adjustments only.- Parameters:
currency- The currency to use.- Returns:
- The total recurring discount value.
- Since:
- Offer Service 3.1.0, Release Train 2.2.0
-
getBundleRatioOr1
public double getBundleRatioOr1() -
getDetailAsAmountQtyTuple
-
hashCode
public int hashCode() -
getLineItem
TheEnhancedLineItemaffected byoffers.- Returns:
- The
EnhancedLineItemaffected byoffers.
-
getAdjustments
- Returns:
- The
ItemOfferAdjustmentscaused byofferstreating thelineItemas a target.
-
getProratedAdjustments
TheProratedItemOfferAdjustmentscaused byofferswithDiscount.getProrationType()orProrationType.TARGET_AND_QUALIFIERtreating bothlineItemas a target and the items that qualify it.- Returns:
- The
ProratedItemOfferAdjustmentscaused byofferswithDiscount.getProrationType()orProrationType.TARGET_AND_QUALIFIERtreating bothlineItemas a target and the items that qualify it.
-
getOfferDiscounts
Additional info for all theofferstreating thelineItemas a target. Whileadjustmentsare the price orderAdjustments, offer discounts track whichOffer.getTargetItemCriteria()matched thelineItemand how many were matched.- Returns:
- Additional info for all the
offerstreating thelineItemas a target.
-
getOfferQualifiers
Additional information about theoffersusing thelineItemas item qualifiers. This includes the quantity used and theOffer.getItemQualifierCriteria()of an order item matched.- Returns:
- Additional information about the
offersusing thelineItemas item qualifiers.
-
getQuantity
public int getQuantity()The quantity of items related to this detail.- Returns:
- The quantity of items related to this detail.
-
isUseSaleAdjustments
public boolean isUseSaleAdjustments()Whether to useEnhancedLineItem.getSalePrice()in price adjustment calculations. Default is false.- Returns:
- Whether to use
EnhancedLineItem.getSalePrice()in price adjustment calculations.
-
isUseRecurringSaleAdjustments
public boolean isUseRecurringSaleAdjustments()Whether to useEnhancedLineItem.getSaleRecurringPrice()in price adjustment calculations. Default is false.- Returns:
- Whether to use
EnhancedLineItem.getSaleRecurringPrice()in price adjustment calculations. - Since:
- Offer Service 3.1.0, Release Train 2.2.0
-
isAdjustmentsFinalized
public boolean isAdjustmentsFinalized()Whether theadjustmentsare the orderAdjustments to actually use rather than being potential or incomplete.- Returns:
- Whether the
adjustmentsare the orderAdjustments to actually use rather than being potential or incomplete.
-
getAdjustedTotal
public javax.money.MonetaryAmount getAdjustedTotal()The total value of alladjustments(excluding recurring) times thequantityof this detail.- Returns:
- The total value of all
adjustmentstimes thequantityof this detail.
-
getRecurringAdjustedTotal
public javax.money.MonetaryAmount getRecurringAdjustedTotal()The total value of all recurringadjustmentstimes thequantityof this detail.- Returns:
- The total value of all recurring
adjustmentstimes thequantityof this detail. - Since:
- Offer Service 3.1.0, Release Train 2.2.0
-
getBundleRatio
public double getBundleRatio()The ratio of the offer discount to apply to this item. Used for bundle offers like buy 3 for a fixed price of $10.- Returns:
- The ratio of the offer discount to apply to this item
-
setLineItem
TheEnhancedLineItemaffected byoffers.- Parameters:
item- TheEnhancedLineItemaffected byoffers.
-
setAdjustments
- Parameters:
orderAdjustments- TheItemOfferAdjustmentscaused byofferstreating thelineItemas a target.
-
setProratedAdjustments
TheProratedItemOfferAdjustmentscaused byofferswithDiscount.getProrationType()orProrationType.TARGET_AND_QUALIFIERtreating bothlineItemas a target and the items that qualify it.- Parameters:
proratedAdjustments- TheProratedItemOfferAdjustmentscaused byofferswithDiscount.getProrationType()orProrationType.TARGET_AND_QUALIFIERtreating bothlineItemas a target and the items that qualify it.
-
setOfferDiscounts
Additional info for all theofferstreating thelineItemas a target. Whileadjustmentsare the price orderAdjustments, offer discounts track whichOffer.getTargetItemCriteria()matched thelineItemand how many were matched.- Parameters:
offerDiscounts- Additional info for all theofferstreating thelineItemas a target.
-
setOfferQualifiers
Additional information about theoffersusing thelineItemas item qualifiers. This includes the quantity used and theOffer.getItemQualifierCriteria()of an order item matched.- Parameters:
offerQualifiers- Additional information about theoffersusing thelineItemas item qualifiers.
-
setQuantity
public void setQuantity(int quantity) The quantity of items related to this detail.- Parameters:
quantity- The quantity of items related to this detail.
-
setUseSaleAdjustments
public void setUseSaleAdjustments(boolean useSaleAdjustments) Whether to useEnhancedLineItem.getSalePrice()in price adjustment calculations. Default is false.- Parameters:
useSaleAdjustments- Whether to useEnhancedLineItem.getSalePrice()in price adjustment calculations.
-
setUseRecurringSaleAdjustments
public void setUseRecurringSaleAdjustments(boolean useRecurringSaleAdjustments) Whether to useEnhancedLineItem.getSaleRecurringPrice()in price adjustment calculations. Default is false.- Parameters:
useSaleAdjustments- Whether to useEnhancedLineItem.getSaleRecurringPrice()in price adjustment calculations.- Since:
- Offer Service 3.1.0, Release Train 2.2.0
-
setAdjustmentsFinalized
public void setAdjustmentsFinalized(boolean adjustmentsFinalized) Whether theadjustmentsare the orderAdjustments to actually use rather than being potential or incomplete.- Parameters:
adjustmentsFinalized- Whether theadjustmentsare the orderAdjustments to actually use rather than being potential or incomplete.
-
setAdjustedTotal
public void setAdjustedTotal(javax.money.MonetaryAmount adjustedTotal) The total value of alladjustments(excluding recurring) times thequantityof this detail.- Parameters:
adjustedTotal- The total value of alladjustmentstimes thequantityof this detail.
-
setRecurringAdjustedTotal
public void setRecurringAdjustedTotal(javax.money.MonetaryAmount recurringAdjustedTotal) The total value of all recurringadjustmentstimes thequantityof this detail.- Parameters:
adjustedTotal- The total value of all recurringadjustmentstimes thequantityof this detail.- Since:
- Offer Service 3.1.0, Release Train 2.2.0
-
setBundleRatio
public void setBundleRatio(double bundleRatio) The ratio of the offer discount to apply to this item. Used for bundle offers like buy 3 for a fixed price of $10.- Parameters:
bundleRatio- Fraction of the offer discount amount to use for this item detail
-
toString
-
split(TypeFactory, OfferDiscount).