Class VoucherManager

    • Constructor Detail

      • VoucherManager

        public VoucherManager()
    • Method Detail

      • createEssentialData

        public void createEssentialData​(java.util.Map params,
                                        JspContext jspc)
        Creates essential data for the voucher extension.
        Overrides:
        createEssentialData in class Extension
      • afterOrderCreation

        public void afterOrderCreation​(Order order,
                                       Cart cart)
        Transfers vouchers form cart to newly created order. Please make sure to call this always after OrderManager.createOrder(AbstractOrder).
        Parameters:
        order - the newly created order
        cart - the cart which this order has been created from
      • afterOrderCreation

        public void afterOrderCreation​(SessionContext ctx,
                                       Order order,
                                       Cart cart)
        Transfers vouchers form cart to newly created order. Please make sure to call this always after OrderManager.createOrder(AbstractOrder).
        Parameters:
        ctx - the session context
        order - the newly created order
        cart - the cart which this order has been created from
      • getAllVouchers

        public java.util.Collection getAllVouchers()
        Returns:
        a Collection with all found Vouchers
      • getAppliedVoucherCodes

        public java.util.Collection<java.lang.String> getAppliedVoucherCodes​(Cart item)
      • getAppliedVoucherCodes

        public java.util.Collection<java.lang.String> getAppliedVoucherCodes​(Order order)
      • getAppliedVoucherCodes

        public java.util.Collection<java.lang.String> getAppliedVoucherCodes​(SessionContext ctx,
                                                                             Order order)
      • getAppliedVoucherCodes

        public java.util.Collection<java.lang.String> getAppliedVoucherCodes​(SessionContext ctx,
                                                                             Cart item)
      • getAppliedVouchers

        public java.util.Collection getAppliedVouchers​(AbstractOrder anOrder)
        Parameters:
        anOrder - the given order
        Returns:
        a Collection with all applied Vouchers for this order
      • getInstance

        public static VoucherManager getInstance​(JaloSession jaloSession)
        Gets the Instance of the VoucherManager
        Parameters:
        jaloSession - the Jalo Session
        Returns:
        the Instance of the VoucherManager
      • getInstance

        public static VoucherManager getInstance()
        Returns:
        instance of this manager
      • getPromotionVouchers

        public java.util.Collection getPromotionVouchers​(java.lang.String voucherCode)
        Parameters:
        voucherCode - the code
        Returns:
        a Collection of PromotionVouchers
      • getSerialVouchers

        public java.util.Collection getSerialVouchers​(java.lang.String aVoucherCode)
        Parameters:
        aVoucherCode - the code
        Returns:
        a Collection of SerialVouchers
      • redeemVoucher

        public boolean redeemVoucher​(java.lang.String aVoucherCode,
                                     Cart aCart)
                              throws JaloPriceFactoryException
        For the given Cart the given Voucher will be redeem.

        WARNING!
        If some methods for checking voucher availability are called before this method, all these methods have to be in one synchronize block! Suggested synchronization object is cart.

        Parameters:
        aVoucherCode - code of the Voucher
        aCart - the cart
        Returns:
        true if the redemption was successful
        Throws:
        JaloPriceFactoryException