Class AddItemRequest
- All Implemented Interfaces:
Serializable
- Author:
- Nathan Moore (nathandmoore)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanMiscellaneous attributes that can be set to this request in order to inform business logic for adding aCartItem.Attributes that should be copied to theCart.getAttributes()for this request.javax.money.CurrencyUnitTheCurrencyUnitof the item to be added to theCart.A list of additionalAddItemRequeststhat should be processed as dependent items of the resulting parent item of this currentAddItemRequest.Attribute choices that should be copied toCartItem.getAttributeChoices()for this request.Miscellaneous attributes that should be copied to theCartItem.getAttributes()for this request.If thisAddItemRequestis one withingetDependentCartItems(), this is the key to use to relate to thisCartItemto a configured product item choice.Miscellaneous internal attributes that should be copied to theCartItem.getInternalAttributes()for this request.Thetypeof this item (e.g.The value that should be mapped toCartItem.getMerchandisingContext().Details of the item not present in a catalog.intThe original quantity of the SubscriptionItem.Declares that payments made against a subscription are going towards the goods/services rendered in the previous vs current period.The id of the product for this add item request.intThe quantity of this item to be added to theCart.The frequency of the recurring period, e.g., if this is 1 andrecurringPeriodTypeis MONTHLY, then the recurring price should be charged every 1 month.The period type for the recurring price, e.g.getSku()The SKU code for the item (e.g., Product or Variant).The length of the term duration selected for the item, if any.The type of the term duration selected for the item, if any.The id of the variant for this add item request.The version of the cart being modified.inthashCode()voidsetAdditionalAttributes(Map<String, Object> additionalAttributes) Miscellaneous attributes that can be set to this request in order to inform business logic for adding aCartItem.voidsetCartAttributes(Map<String, Object> cartAttributes) Attributes that should be copied to theCart.getAttributes()for this request.voidsetCurrency(javax.money.CurrencyUnit currency) TheCurrencyUnitof the item to be added to theCart.voidsetDependentCartItems(List<AddItemRequest> dependentCartItems) A list of additionalAddItemRequeststhat should be processed as dependent items of the resulting parent item of this currentAddItemRequest.voidsetItemAttributeChoices(Map<String, String> itemAttributeChoices) Attribute choices that should be copied toCartItem.getAttributeChoices()for this request.voidsetItemAttributes(Map<String, Object> itemAttributes) Miscellaneous attributes that should be copied to theCartItem.getAttributes()for this request.voidsetItemChoiceKey(String itemChoiceKey) If thisAddItemRequestis one withingetDependentCartItems(), this is the key to use to relate to thisCartItemto a configured product item choice.voidsetItemInternalAttributes(Map<String, Object> itemInternalAttributes) Miscellaneous internal attributes that should be copied to theCartItem.getInternalAttributes()for this request.voidsetItemType(String itemType) Thetypeof this item (e.g.voidsetMerchandisingContext(String merchandisingContext) The value that should be mapped toCartItem.getMerchandisingContext().voidsetNonCatalogItemDetails(NonCatalogItemDetails nonCatalogItemDetails) Details of the item not present in a catalog.voidsetOriginalSubscriptionItemQuantity(int originalSubscriptionItemQuantity) The original quantity of the SubscriptionItem.voidsetPaymentStrategy(String paymentStrategy) Declares that payments made against a subscription are going towards the goods/services rendered in the previous vs current period.voidsetProductId(String productId) The id of the product for this add item request.voidsetQuantity(int quantity) The quantity of this item to be added to theCart.voidsetRecurringPeriodFrequency(Integer recurringPeriodFrequency) The frequency of the recurring period, e.g., if this is 1 andrecurringPeriodTypeis MONTHLY, then the recurring price should be charged every 1 month.voidsetRecurringPeriodType(String recurringPeriodType) The period type for the recurring price, e.g.voidThe SKU code for the item (e.g., Product or Variant).voidsetTermDurationLength(Integer termDurationLength) The length of the term duration selected for the item, if any.voidsetTermDurationType(String termDurationType) The type of the term duration selected for the item, if any.voidsetVariantId(String variantId) The id of the variant for this add item request.voidsetVersion(Integer version) The version of the cart being modified.toString()
-
Constructor Details
-
AddItemRequest
public AddItemRequest()
-
-
Method Details
-
getVariantId
The id of the variant for this add item request. Used to retrieve variant information for the cart item.- Returns:
- The id of the variant for this add item request. Used to retrieve variant information for the cart item.
-
getProductId
The id of the product for this add item request. Used to retrieve product information for the cart item.- Returns:
- The id of the product for this add item request. Used to retrieve product information for the cart item.
-
getSku
The SKU code for the item (e.g., Product or Variant).- Returns:
- SKU code for the item
-
getItemType
Thetypeof this item (e.g. Standard or Custom Quote Item). Defaults toDefaultCartItemTypes.STANDARD.- Returns:
- type of this item
-
getQuantity
public int getQuantity()The quantity of this item to be added to theCart.- Returns:
- The quantity of this item to be added to the
Cart.
-
getOriginalSubscriptionItemQuantity
public int getOriginalSubscriptionItemQuantity()The original quantity of the SubscriptionItem. This is different fromquantityasquantitycan be updated to "revert" the scaling based on the parent item quantity, while this field is the original SubscriptionItem quantity that is never changed.This field is used to revert the quantity scaling based on the parent item for the dependent item, particularly important for nested dependent item scenarios. For example, let's say we have the following nested dependent item scenario:
In cart, we have the following cart item structure:
- RootCartItem, quantity = 3
- DepCartItem, quantity = 2
- DepCartItemOfDepCartItem, quantity = 1
Since each dependent item's quantity is scaled based on the quantity of its parent. When converted into SubscriptionItems, the quantities becomes:
- RootItem, quantity = 3
- DepItem, quantity = 6
- DepItemOfDepItem, quantity = 6
So when we are converting the SubscriptionItems into AddItemRequests, we need to revert the scaling of quantities, which can be problematic if we use
quantityto de-scale the quantity in a nested dependent item scenario, as the parent'squantityis already reverted by the time it's used to revert its dependent item's quantity.This field is only relevant for the internal working of the system and is therefore marked with
JsonIgnore. -
getCurrency
public javax.money.CurrencyUnit getCurrency()TheCurrencyUnitof the item to be added to theCart. -
getItemAttributes
Miscellaneous attributes that should be copied to theCartItem.getAttributes()for this request.- Returns:
- Miscellaneous attributes that should be copied to the
CartItem.getAttributes()for this request.
-
getItemInternalAttributes
Miscellaneous internal attributes that should be copied to theCartItem.getInternalAttributes()for this request.- Returns:
- Miscellaneous internal attributes that should be copied to the
CartItem.getInternalAttributes()for this request.
-
getItemAttributeChoices
Attribute choices that should be copied toCartItem.getAttributeChoices()for this request.- Returns:
- Attribute choices that should be copied to
CartItem.getAttributeChoices()for this request.
-
getCartAttributes
Attributes that should be copied to theCart.getAttributes()for this request.- Returns:
- Attributes that should be copied to the
Cart.getAttributes()for this request.
-
getDependentCartItems
A list of additionalAddItemRequeststhat should be processed as dependent items of the resulting parent item of this currentAddItemRequest.- Returns:
- A list of additional
AddItemRequeststhat should be processed as dependent items of the resulting parent item of this currentAddItemRequest.
-
getItemChoiceKey
If thisAddItemRequestis one withingetDependentCartItems(), this is the key to use to relate to thisCartItemto a configured product item choice.- Returns:
- The key to use to relate to this
CartItemto a configured product item choice.
-
getMerchandisingContext
The value that should be mapped toCartItem.getMerchandisingContext(). This holds the selector or merchandising product's id.- Returns:
- The context of the item signifying where it's added from
-
getAdditionalAttributes
Miscellaneous attributes that can be set to this request in order to inform business logic for adding aCartItem.- Returns:
- Miscellaneous attributes that can be set to this request in order to inform business
logic for adding a
CartItem.
-
getTermDurationType
The type of the term duration selected for the item, if any. Some items may have terms to allow certain pricing for the user. This indicates the type of duration, e.g., DAYS, WEEKS, MONTHS, YEARS, for the selected term. For example, choosing between paying the full price for a device (no terms) vs splitting payment over 36 months (termDurationLengthof 36 andtermDurationTypeof MONTHS).- See Also:
-
termDurationLength
-
getTermDurationLength
The length of the term duration selected for the item, if any. Some items may have terms to allow certain pricing for the user. This indicates the length of duration for the selected term. For example, choosing between paying the full price for a device (no terms) vs splitting payment over 36 months (termDurationLengthof 36 andtermDurationTypeof MONTHS).- See Also:
-
termDurationType
-
getRecurringPeriodFrequency
The frequency of the recurring period, e.g., if this is 1 andrecurringPeriodTypeis MONTHLY, then the recurring price should be charged every 1 month.- See Also:
-
recurringPeriodType
-
getRecurringPeriodType
The period type for the recurring price, e.g. MONTHLY, QUARTERLY, ANNUALLY.- See Also:
-
recurringPeriodFrequency
-
getVersion
The version of the cart being modified. Not needed for creation requests. -
getNonCatalogItemDetails
Details of the item not present in a catalog.This is used as the cartItem in the
InitiateCancelSubscriptionHandlerthat is added to the cart which holds subscription cancellation related details. -
getPaymentStrategy
Declares that payments made against a subscription are going towards the goods/services rendered in the previous vs current period. -
setVariantId
The id of the variant for this add item request. Used to retrieve variant information for the cart item.- Parameters:
variantId- The id of the variant for this add item request. Used to retrieve variant information for the cart item.
-
setProductId
The id of the product for this add item request. Used to retrieve product information for the cart item.- Parameters:
productId- The id of the product for this add item request. Used to retrieve product information for the cart item.
-
setSku
The SKU code for the item (e.g., Product or Variant).- Parameters:
sku- SKU code for the item
-
setItemType
Thetypeof this item (e.g. Standard or Custom Quote Item). Defaults toDefaultCartItemTypes.STANDARD.- Parameters:
type- type of this item
-
setQuantity
public void setQuantity(int quantity) The quantity of this item to be added to theCart.- Parameters:
quantity- The quantity of this item to be added to theCart.
-
setOriginalSubscriptionItemQuantity
public void setOriginalSubscriptionItemQuantity(int originalSubscriptionItemQuantity) The original quantity of the SubscriptionItem. This is different fromquantityasquantitycan be updated to "revert" the scaling based on the parent item quantity, while this field is the original SubscriptionItem quantity that is never changed.This field is used to revert the quantity scaling based on the parent item for the dependent item, particularly important for nested dependent item scenarios. For example, let's say we have the following nested dependent item scenario:
In cart, we have the following cart item structure:
- RootCartItem, quantity = 3
- DepCartItem, quantity = 2
- DepCartItemOfDepCartItem, quantity = 1
Since each dependent item's quantity is scaled based on the quantity of its parent. When converted into SubscriptionItems, the quantities becomes:
- RootItem, quantity = 3
- DepItem, quantity = 6
- DepItemOfDepItem, quantity = 6
So when we are converting the SubscriptionItems into AddItemRequests, we need to revert the scaling of quantities, which can be problematic if we use
quantityto de-scale the quantity in a nested dependent item scenario, as the parent'squantityis already reverted by the time it's used to revert its dependent item's quantity.This field is only relevant for the internal working of the system and is therefore marked with
JsonIgnore. -
setCurrency
public void setCurrency(javax.money.CurrencyUnit currency) TheCurrencyUnitof the item to be added to theCart. -
setItemAttributes
Miscellaneous attributes that should be copied to theCartItem.getAttributes()for this request.- Parameters:
itemAttributes- Miscellaneous attributes that should be copied to theCartItem.getAttributes()for this request.
-
setItemInternalAttributes
Miscellaneous internal attributes that should be copied to theCartItem.getInternalAttributes()for this request.- Parameters:
itemAttributes- Miscellaneous internal attributes that should be copied to theCartItem.getInternalAttributes()for this request.
-
setItemAttributeChoices
Attribute choices that should be copied toCartItem.getAttributeChoices()for this request.- Parameters:
itemAttributeChoices- Attribute choices that should be copied toCartItem.getAttributeChoices()for this request.
-
setCartAttributes
Attributes that should be copied to theCart.getAttributes()for this request.- Parameters:
cartAttributes- Attributes that should be copied to theCart.getAttributes()for this request.
-
setDependentCartItems
A list of additionalAddItemRequeststhat should be processed as dependent items of the resulting parent item of this currentAddItemRequest.- Parameters:
dependentCartItems- A list of additionalAddItemRequeststhat should be processed as dependent items of the resulting parent item of this currentAddItemRequest.
-
setItemChoiceKey
If thisAddItemRequestis one withingetDependentCartItems(), this is the key to use to relate to thisCartItemto a configured product item choice.- Parameters:
itemChoiceKey- The key to use to relate to thisCartItemto a configured product item choice.
-
setMerchandisingContext
The value that should be mapped toCartItem.getMerchandisingContext(). This holds the selector or merchandising product's id.- Parameters:
merchandisingContext- The context of the item signifying where it's added from
-
setAdditionalAttributes
Miscellaneous attributes that can be set to this request in order to inform business logic for adding aCartItem.- Parameters:
additionalAttributes- Miscellaneous attributes that can be set to this request in order to inform business logic for adding aCartItem.
-
setTermDurationType
The type of the term duration selected for the item, if any. Some items may have terms to allow certain pricing for the user. This indicates the type of duration, e.g., DAYS, WEEKS, MONTHS, YEARS, for the selected term. For example, choosing between paying the full price for a device (no terms) vs splitting payment over 36 months (termDurationLengthof 36 andtermDurationTypeof MONTHS).- See Also:
-
termDurationLength
-
setTermDurationLength
The length of the term duration selected for the item, if any. Some items may have terms to allow certain pricing for the user. This indicates the length of duration for the selected term. For example, choosing between paying the full price for a device (no terms) vs splitting payment over 36 months (termDurationLengthof 36 andtermDurationTypeof MONTHS).- See Also:
-
termDurationType
-
setRecurringPeriodFrequency
The frequency of the recurring period, e.g., if this is 1 andrecurringPeriodTypeis MONTHLY, then the recurring price should be charged every 1 month.- See Also:
-
recurringPeriodType
-
setRecurringPeriodType
The period type for the recurring price, e.g. MONTHLY, QUARTERLY, ANNUALLY.- See Also:
-
recurringPeriodFrequency
-
setVersion
The version of the cart being modified. Not needed for creation requests. -
setNonCatalogItemDetails
Details of the item not present in a catalog.This is used as the cartItem in the
InitiateCancelSubscriptionHandlerthat is added to the cart which holds subscription cancellation related details. -
setPaymentStrategy
Declares that payments made against a subscription are going towards the goods/services rendered in the previous vs current period. -
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-