Interface OfferService

All Known Implementing Classes:
OfferServiceImpl

public interface OfferService
The Interface OfferService.
  • Method Details

    • 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
    • applyAndSaveOffersToOrder

      Order applyAndSaveOffersToOrder(List<Offer> offers, Order order) throws PricingException
      Apply offers to order. By default this does not re-price the order.
      Parameters:
      offers - the offers
      order - the order
      Returns:
      Throws:
      PricingException
    • applyOffersToOrder

      @Deprecated void applyOffersToOrder(List<Offer> offers, Order order) throws PricingException
      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

      List<Offer> lookupAllOffersByCode(String code)
      Lookup all offers by code.
      Parameters:
      code - the code
      Returns:
      the list of offers
    • lookupAllOfferCodesByCode

      List<OfferCode> lookupAllOfferCodesByCode(String code)
      Lookup all OfferCodes by code.
      Parameters:
      code - the code
      Returns:
      the list of offer codes
    • buildOfferListForOrder

      List<Offer> buildOfferListForOrder(Order order)
      Create a list of offers that applies to this order
      Parameters:
      order -
      Returns:
    • buildOfferCodeListForCustomer

      List<OfferCode> buildOfferCodeListForCustomer(Order order)
      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 List<OfferCode> buildOfferCodeListForCustomer(Customer customer)
      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

      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)
    • 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

      void setPromotableItemFactory(PromotableItemFactory promotableItemFactory)
    • verifyMaxCustomerUsageThreshold

      boolean verifyMaxCustomerUsageThreshold(@Nonnull Order order, @Nonnull Offer offer)

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

      @Deprecated 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 Order order, @Nonnull OfferCode code)

      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 to
      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.
    • verifyMaxCustomerUsageThreshold

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

      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 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)
    • deleteOfferCode

      Boolean deleteOfferCode(OfferCode code)
    • findOfferById

      Offer findOfferById(Long offerId)
    • findOfferCodesByIds

      List<OfferCode> findOfferCodesByIds(Collection<Long> ids)
    • duplicate

      Offer duplicate(Long offerId)
      Make a production copy of an offer.
      Parameters:
      offerId -
      Returns: