Interface OfferService
- All Known Implementing Classes:
OfferServiceImpl
-
Method Summary
Modifier and TypeMethodDescriptionapplyAndSaveFulfillmentGroupOffersToOrder
(List<Offer> offers, Order order) applyAndSaveOffersToOrder
(List<Offer> offers, Order order) Apply offers to order.void
applyFulfillmentGroupOffersToOrder
(List<Offer> offers, Order order) Deprecated.void
applyOffersToOrder
(List<Offer> offers, Order order) Deprecated.Attempts to resolve a list of offer codes associated explicitly with the customer.buildOfferCodeListForCustomer
(Customer customer) Deprecated.buildOfferListForOrder
(Order order) Create a list of offers that applies to this orderdeleteOfferCode
(OfferCode code) Make a production copy of an offer.Returns all offersfindOfferById
(Long offerId) Lookup an OfferCode by its idgetOffersRetrievedFromCodes
(List<OfferCode> codes, Set<Offer> appliedOffers) Given a list of offer codes and a set of offers, return a map of of offer codes that are keyed by the offer that was applied to the ordergetOffersRetrievedFromCodes
(Order order) getUniqueOffersFromOrder
(Order order) Returns a set of offers that have been used for this order by checking adjustments on the different levels like FulfillmentGroups and OrderItems.Lookup all OfferCodes by code.lookupAllOffersByCode
(String code) Lookup all offers by code.lookupOfferByCode
(String code) Lookup offer by code.lookupOfferCodeByCode
(String code) Lookup OfferCode by code.Save a new offer or updates an existing offersaveOfferCode
(OfferCode offerCode) Saves a new Offer or updates an existing Offer that belongs to an OfferCode, then saves or updates the OfferCodevoid
setCustomerOfferDao
(CustomerOfferDao customerOfferDao) void
setFulfillmentGroupOfferProcessor
(FulfillmentGroupOfferProcessor fulfillmentGroupOfferProcessor) void
setItemOfferProcessor
(ItemOfferProcessor itemOfferProcessor) void
setOfferCodeDao
(OfferCodeDao offerCodeDao) void
setOfferDao
(OfferDao offerDao) void
setOrderOfferProcessor
(OrderOfferProcessor orderOfferProcessor) void
setOrderService
(OrderService orderService) void
setPromotableItemFactory
(PromotableItemFactory promotableItemFactory) boolean
verifyMaxCustomerUsageThreshold
(Order order, Offer offer) Validates that the Customer to whom an Order belongs has not exceeded the max uses for the passed in offer.boolean
verifyMaxCustomerUsageThreshold
(Order order, OfferCode code) Validates that the given OfferCode has not reached its maximum number of usages.boolean
verifyMaxCustomerUsageThreshold
(Customer customer, Offer offer) Deprecated.boolean
verifyMaxCustomerUsageThreshold
(Customer customer, OfferCode code) Deprecated.
-
Method Details
-
findAllOffers
Returns all offers- Returns:
- all offers
-
save
Save a new offer or updates an existing offer- Parameters:
offer
-- Returns:
- the offer
-
saveOfferCode
Saves a new Offer or updates an existing Offer that belongs to an OfferCode, then saves or updates the OfferCode- Parameters:
offerCode
-- Returns:
- the offerCode
-
lookupOfferByCode
Lookup offer by code.- Parameters:
code
- the code- Returns:
- the offer
-
findOfferCodeById
Lookup an OfferCode by its id- Parameters:
id
- the offer id- Returns:
- the offer
-
lookupOfferCodeByCode
Lookup OfferCode by code.- Parameters:
code
- the code- Returns:
- the offer
-
applyAndSaveOffersToOrder
Apply offers to order. By default this does not re-price the order.- Parameters:
offers
- the offersorder
- the order- Returns:
- Throws:
PricingException
-
applyOffersToOrder
Deprecated.Apply offers to order. By default this does not re-price the order. This method is deprecated and should not be used. The saved order should be returned from this method, which is the case in applyAndSaveOffersToOrder.- Parameters:
offers
-order
-- Throws:
PricingException
-
lookupAllOffersByCode
Lookup all offers by code.- Parameters:
code
- the code- Returns:
- the list of offers
-
lookupAllOfferCodesByCode
Lookup all OfferCodes by code.- Parameters:
code
- the code- Returns:
- the list of offer codes
-
buildOfferListForOrder
Create a list of offers that applies to this order- Parameters:
order
-- Returns:
-
buildOfferCodeListForCustomer
Attempts to resolve a list of offer codes associated explicitly with the customer. For example, an implementation may choose to associate a specific offer code with a customer in a custom table or in customer attributes. This allows you to associate one or more offer codes with a customer without necessarily having them type it in (e.g. on a URL), or by allowing them to type it in, but before it has been actually applied to an order.- Parameters:
order
-- Returns:
- a list of offer codes associated explicitly with the customer
-
buildOfferCodeListForCustomer
Deprecated.Attempts to resolve a list of offer codes associated explicitly with the customer. For example, an implementation may choose to associate a specific offer code with a customer in a custom table or in customer attributes. This allows you to associate one or more offer codes with a customer without necessarily having them type it in (e.g. on a URL), or by allowing them to type it in, but before it has been actually applied to an order.- Parameters:
customer
-- Returns:
- a list of offer codes associated explicitly with the customer
-
getCustomerOfferDao
CustomerOfferDao getCustomerOfferDao() -
setCustomerOfferDao
-
getOfferCodeDao
OfferCodeDao getOfferCodeDao() -
setOfferCodeDao
-
getOfferDao
OfferDao getOfferDao() -
setOfferDao
-
getOrderOfferProcessor
OrderOfferProcessor getOrderOfferProcessor() -
setOrderOfferProcessor
-
getItemOfferProcessor
ItemOfferProcessor getItemOfferProcessor() -
setItemOfferProcessor
-
getFulfillmentGroupOfferProcessor
FulfillmentGroupOfferProcessor getFulfillmentGroupOfferProcessor() -
setFulfillmentGroupOfferProcessor
void setFulfillmentGroupOfferProcessor(FulfillmentGroupOfferProcessor fulfillmentGroupOfferProcessor) -
applyAndSaveFulfillmentGroupOffersToOrder
Order applyAndSaveFulfillmentGroupOffersToOrder(List<Offer> offers, Order order) throws PricingException - Throws:
PricingException
-
applyFulfillmentGroupOffersToOrder
@Deprecated void applyFulfillmentGroupOffersToOrder(List<Offer> offers, Order order) throws PricingException Deprecated.- Throws:
PricingException
-
getPromotableItemFactory
PromotableItemFactory getPromotableItemFactory() -
setPromotableItemFactory
-
verifyMaxCustomerUsageThreshold
Validates that the Customer to whom an Order belongs has not exceeded the max uses for the passed in offer. This method will take into account if the Offer has already been applied to the Order so as not to prevent the Offer from applying to new items added to the Order by a CRS.
This condition could pass if the system allows two concurrent carts for the same customer. The condition will fail at order submission time when the
VerifyCustomerMaxOfferUsesActivity
runs (if that activity is configured as part of the checkout workflow.)This method only checks offers who have a max_customer_uses value that is greater than zero. By default offers can be used as many times as the customer's order qualifies.
This method offers no protection against systems that allow customers to create multiple ids in the system.
- Parameters:
order
- the order the offer is to be applied tooffer
- the offer to check- Returns:
- true if it is ok for the customer to use this offer with their current order, false if not.
-
verifyMaxCustomerUsageThreshold
@Deprecated boolean verifyMaxCustomerUsageThreshold(@Nonnull Customer customer, @Nonnull Offer offer) Deprecated.Validates that the passed in customer has not exceeded the max uses for the passed in offer.
This condition could pass if the system allows two concurrent carts for the same customer. The condition will fail at order submission time when the
VerifyCustomerMaxOfferUsesActivity
runs (if that activity is configured as part of the checkout workflow.)This method only checks offers who have a max_customer_uses value that is greater than zero. By default offers can be used as many times as the customer's order qualifies.
This method offers no protection against systems that allow customers to create multiple ids in the system.
- Parameters:
customer
- the customer attempting to use the offeroffer
- the offer to check- Returns:
- true if it is ok for the customer to use this offer with their current order, false if not.
-
verifyMaxCustomerUsageThreshold
Validates that the given OfferCode has not reached its maximum number of usages. This method will also delegate to
verifyMaxCustomerUsageThreshold(Order, Offer)
for the code's Offer and the passed in Order's Customer.- Parameters:
order
- the order the offer is to be applied tocode
- the code to check- Returns:
- true if it is ok for the customer to use this offer with their current order, false if not.
-
verifyMaxCustomerUsageThreshold
@Deprecated boolean verifyMaxCustomerUsageThreshold(@Nonnull Customer customer, @Nonnull OfferCode code) Deprecated.Validates that the given OfferCode has not reached its maximum number of usages. This method will also delegate to
verifyMaxCustomerUsageThreshold(Order, Offer)
for the code's Offer and the passed in Customer.- Parameters:
customer
- the customer attempting to use the codecode
- the code to check- Returns:
- true if it is ok for the customer to use this offer with their current order, false if not.
-
getUniqueOffersFromOrder
Returns a set of offers that have been used for this order by checking adjustments on the different levels like FulfillmentGroups and OrderItems. This will return all of the unique offers used for instances where an offer can apply to multiple OrderItems or multiple FulfillmentGroups (and show up as different adjustments on each)- Parameters:
order
-- Returns:
-
getOffersRetrievedFromCodes
Given a list of offer codes and a set of offers, return a map of of offer codes that are keyed by the offer that was applied to the order- Parameters:
codes
-appliedOffers
-- Returns:
-
getOffersRetrievedFromCodes
For a given order, give back a map of allOffer
s that were retrieved fromOfferCode
s. More explicitly, this will look at all of the offers that have been used by looking at a givenOrder
's adjustments and then match those up with the codes fromOrder.getAddedOfferCodes()
. -
getOrderService
OrderService getOrderService() -
setOrderService
-
deleteOfferCode
-
findOfferById
-
findOfferCodesByIds
-
duplicate
Make a production copy of an offer.- Parameters:
offerId
-- Returns:
-
buildOfferCodeListForCustomer(Order)