org.broadleafcommerce.core.offer.service
Interface OfferService

All Known Implementing Classes:
OfferServiceImpl

public interface OfferService

The Interface OfferService.


Method Summary
 void applyFulfillmentGroupOffersToOrder(List<Offer> offers, Order order)
           
 void applyOffersToOrder(List<Offer> offers, Order order)
          Apply offers to order.
 List<Offer> buildOfferListForOrder(Order order)
          Create a list of offers that applies to this order
 List<Offer> findAllOffers()
          Returns all offers
 OfferCode findOfferCodeById(Long id)
          Lookup an OfferCode by its id
 CustomerOfferDao getCustomerOfferDao()
           
 FulfillmentGroupOfferProcessor getFulfillmentGroupOfferProcessor()
           
 ItemOfferProcessor getItemOfferProcessor()
           
 OfferCodeDao getOfferCodeDao()
           
 OfferDao getOfferDao()
           
 Map<Offer,OfferCode> getOffersRetrievedFromCodes(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 order
 Map<Offer,OfferCode> getOffersRetrievedFromCodes(Order order)
          For a given order, give back a map of all Offers that were retrieved from OfferCodes.
 OrderOfferProcessor getOrderOfferProcessor()
           
 OrderService getOrderService()
           
 PromotableItemFactory getPromotableItemFactory()
           
 Set<Offer> 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.
 Offer lookupOfferByCode(String code)
          Lookup offer by code.
 OfferCode lookupOfferCodeByCode(String code)
          Lookup OfferCode by code.
 Offer save(Offer offer)
          Save a new offer or updates an existing offer
 OfferCode saveOfferCode(OfferCode offerCode)
          Saves a new Offer or updates an existing Offer that belongs to an OfferCode, then saves or updates the OfferCode
 void 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(Customer customer, Offer offer)
          Validates that the passed in customer has not exceeded the max uses for the passed in offer.
 boolean verifyMaxCustomerUsageThreshold(Customer customer, OfferCode code)
          Validates that the given code is underneath the max uses for that code.
 

Method Detail

findAllOffers

List<Offer> findAllOffers()
Returns all offers

Returns:
all offers

save

Offer save(Offer offer)
Save a new offer or updates an existing offer

Parameters:
offer -
Returns:
the offer

saveOfferCode

OfferCode saveOfferCode(OfferCode offerCode)
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

Offer lookupOfferByCode(String code)
Lookup offer by code.

Parameters:
code - the code
Returns:
the offer

findOfferCodeById

OfferCode findOfferCodeById(Long id)
Lookup an OfferCode by its id

Parameters:
id - the offer id
Returns:
the offer

lookupOfferCodeByCode

OfferCode lookupOfferCodeByCode(String code)
Lookup OfferCode by code.

Parameters:
code - the code
Returns:
the offer

applyOffersToOrder

void applyOffersToOrder(List<Offer> offers,
                        Order order)
                        throws PricingException
Apply offers to order.

Parameters:
offers - the offers
order - the order
Throws:
PricingException

buildOfferListForOrder

List<Offer> buildOfferListForOrder(Order order)
Create a list of offers that applies to this order

Parameters:
order -
Returns:

getCustomerOfferDao

CustomerOfferDao getCustomerOfferDao()

setCustomerOfferDao

void setCustomerOfferDao(CustomerOfferDao customerOfferDao)

getOfferCodeDao

OfferCodeDao getOfferCodeDao()

setOfferCodeDao

void setOfferCodeDao(OfferCodeDao offerCodeDao)

getOfferDao

OfferDao getOfferDao()

setOfferDao

void setOfferDao(OfferDao offerDao)

getOrderOfferProcessor

OrderOfferProcessor getOrderOfferProcessor()

setOrderOfferProcessor

void setOrderOfferProcessor(OrderOfferProcessor orderOfferProcessor)

getItemOfferProcessor

ItemOfferProcessor getItemOfferProcessor()

setItemOfferProcessor

void setItemOfferProcessor(ItemOfferProcessor itemOfferProcessor)

getFulfillmentGroupOfferProcessor

FulfillmentGroupOfferProcessor getFulfillmentGroupOfferProcessor()

setFulfillmentGroupOfferProcessor

void setFulfillmentGroupOfferProcessor(FulfillmentGroupOfferProcessor fulfillmentGroupOfferProcessor)

applyFulfillmentGroupOffersToOrder

void applyFulfillmentGroupOffersToOrder(List<Offer> offers,
                                        Order order)
                                        throws PricingException
Throws:
PricingException

getPromotableItemFactory

PromotableItemFactory getPromotableItemFactory()

setPromotableItemFactory

void setPromotableItemFactory(PromotableItemFactory promotableItemFactory)

verifyMaxCustomerUsageThreshold

boolean verifyMaxCustomerUsageThreshold(@Nonnull
                                        Customer customer,
                                        @Nonnull
                                        Offer offer)

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 offer
offer - 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

boolean verifyMaxCustomerUsageThreshold(@Nonnull
                                        Customer customer,
                                        @Nonnull
                                        OfferCode code)

Validates that the given code is underneath the max uses for that code. This method will also delegate to verifyMaxCustomerUsageThreshold(Customer, Offer) for the code's offer and the passed in customer

Parameters:
customer - the customer attempting to use the code
code - 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

Set<Offer> 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. 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

Map<Offer,OfferCode> getOffersRetrievedFromCodes(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 order

Parameters:
codes -
appliedOffers -
Returns:

getOffersRetrievedFromCodes

Map<Offer,OfferCode> getOffersRetrievedFromCodes(Order order)
For a given order, give back a map of all Offers that were retrieved from OfferCodes. More explicitly, this will look at all of the offers that have been used by looking at a given Order's adjustments and then match those up with the codes from Order.getAddedOfferCodes().

Parameters:
order -
Returns:
a map from Offer to the OfferCode that was used to obtain it

getOrderService

OrderService getOrderService()

setOrderService

void setOrderService(OrderService orderService)


Copyright © 2013. All Rights Reserved.