4 Replies Latest reply: Feb 5, 2014 1:06 PM by 1019844 RSS

    Gift Certificate clain

    1019844

      Hi people!

       

      I am trying to create a process to clain a gift certificate created previously but i am not being able to see the discount on order total

      amount.

      In the handeToMoveConfirmation method of the ShoppigCartModifier i am claiming with "getClaimableManager().claimItem" but after

      the method is complete there is no gift certificate payment group created for the order.

      I have tried to create the gift certificate payment group and attach it to the order manually but no discount was there either.

       

      am i missing step?

      Is there a way to check if the gift certficate was created properly?

      PLease could anyone help me with this issue?

       

      Thanks,

      Best regards,

      Marcos

        • 1. Re: Gift Certificate clain
          karthik chopperla

          Did you update the order ?? Try this if you haven't

           

          getOrderManager().updateOrder(order);

           

          -karthik

          • 2. Re: Gift Certificate clain
            1019844

            Hi, thanks for replying!

             

            But, it did not work. It even add the gift certificate payment group to the order but when it does not

            calculate the total price info with the discount.

            PLease take a look at my code:

             

            public boolean handleMoveToConfirmation(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws ServletException, IOException {

                   String claimCodeId = getGiftCertificateNumbers();

                   try {

                        Order order = getOrder();

                        RepositoryItem giftCertificate = getClaimableManager().claimItem(claimCodeId);

                        if (giftCertificate == null) {

                             addFormException(new DropletException("Vale presente não encontrado"));

                             return checkFormRedirect(getMoveToConfirmationSuccessURL(), getMoveToConfirmationErrorURL(), pRequest, pResponse);

                        }

                        getOrderManager().updateOrder(order);

             

             

                        System.out.println("TEST 1 TOTAL: " + order.getPriceInfo().getTotal());

             

             

                        Double amount = (Double)giftCertificate.getPropertyValue(AMOUNT_REMAINING_PROPERTY);

                        addGiftCertificatePaymentGroup(amount, claimCodeId);

                        getOrderManager().updateOrder(order);

             

             

                        System.out.println("TEST 2 TOTAL: " + order.getPriceInfo().getTotal());

             

             

                   } catch (ClaimableException e) {

                        e.printStackTrace();

                   } catch (CommerceException e) {    

                        e.printStackTrace();

                   }

             

             

                   return super.handleMoveToConfirmation(pRequest, pResponse);

              }

             

            Thanks!

            • 3. Re: Gift Certificate clain
              ClareR-Oracle

              Payment groups do not have any effect on price calculations.  It's correct that you're not seeing the order price reduced by the gift certificate amount.  The order price figures into other things like tax and financial reporting, so it's important to keep prices and payments separate.  If you want to show a shopper how much they'll have to pay via other means, like a credit card, you'll have to do the arithmetic yourself.  That's the kind of computation that usually shows up on a billing page.

               

              It's possible you're getting gift certificates confused with coupons.  Each one is a type of claimable.  A coupon is associated with a promotion, which defines a discount that does get applied to the order (or item or shipping) price.

               

              The code you included in your last post calls updateOrder twice.  That's not a good idea.  updateOrder is a fairly expensive operation.  It should be called once, after all changes to the order have been made.

              • 4. Re: Gift Certificate clain
                1019844

                Hi Thanks!

                 

                The code i have posted above is just to show and print the tests i have made so far trying to get the discount on the order.

                I thought the order total price was adjusted automatically by ATG when it finds a gift certificate payment group. Well so we have

                to calculate all the discount regarding the gift certificate payment group manually.

                 

                Thank you very much!