@DefaultHandler
 public Resolution pre() {
   pricingDto = new PricingDto(order.getCartLineItems(), order.getAddress());
   coupon = referrerProgramManager.getOrCreateRefferrerCoupon(order.getUser());
   barcodePath = barcodeGenerator.getBarcodePath(order.getGatewayOrderId(), 1.0f, 150, false);
   return new ForwardResolution("/pages/invoice.jsp");
 }
예제 #2
0
 public Set<Offer> getApplicableOffers(Order order) {
   applicableOffers = new HashSet<Offer>();
   User user = order.getUser();
   List<Offer> activeOffers = offerDao.listAllValidShowPromptly();
   if (activeOffers != null) {
     for (Offer activeOffer : activeOffers) {
       if (activeOffer.getOfferTrigger() != null) {
         logger.debug("Active Offer ID -> " + activeOffer.getId());
         OfferTriggerMatcher offerTriggerMatcher =
             new OfferTriggerMatcher(activeOffer.getOfferTrigger(), order.getCartLineItems());
         if (offerTriggerMatcher.hasEasyMatch(false)
             && offerManager.isOfferValidForUser(activeOffer, user)
             && activeOffer.isShowPromptly()) {
           if (activeOffer.getOfferAction().getFreeVariant() != null) {
             ProductVariant freeVariant = activeOffer.getOfferAction().getFreeVariant();
             if (!freeVariant.isDeleted() && !freeVariant.isOutOfStock()) {
               applicableOffers.add(activeOffer);
             }
           } else {
             applicableOffers.add(activeOffer);
           }
         }
       }
     }
   }
   List<OfferInstance> offerInstances = offerInstanceDao.getActiveOffers(user);
   for (OfferInstance instance : offerInstances) {
     if (offerManager.isOfferValidForUser(instance.getOffer(), user)) {
       applicableOffers.add(instance.getOffer());
     }
   }
   return applicableOffers;
 }