• Welcome to KonaKart Community Forum. Please login or sign up.
 
May 03, 2024, 07:39:00 am

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - anstuff

1
While using Order Total Discount module to implement buy 1 get 1 free promotion, we found that on adding a product other than the eligible products for promotion the discount was not getting applied.
e.g. When you add A and B (both eligible) to cart, you would see one of the products for Free.
But when you add C to cart, the discount was no longer applied.

The promotion we created for this is as follows;
Promo type : Order Total Discount
Active: true, Requires Coupon: true, Cumulative: true
Minimum order value: 39.90, Min total quantity: 2, Min Quantity for a product: 1
Discount 19.95, Percent/Amount: false

Following is the code change, that will fix the problem.

                //Generate a list containing eligible product ids
                List<Integer> applicableProductIds = new ArrayList<Integer>();
                for (OrderProductIf op : promotion.getApplicableProducts()) {                   
                    applicableProductIds.add(op.getProductId());
                }

                ot = new OrderTotal();
                ot.setSortOrder(sortOrder);
                ot.setClassName(code);
                ot.setPromotions(new Promotion[]{promotion});

                // Does promotion only apply to a min order value ?
                if (minTotalOrderVal != null) {
                    if (orderValue.compareTo(minTotalOrderVal) < 0) {
                        // If we haven't reached the minimum amount then continue to the next
                        // promotion
                        continue;
                    }
                }

                // Does promotion only apply to a minimum number of products ordered ?
                if (minTotalQuantity > 0) {
                    int total = 0;
                    //instead of looping through promo.applicableProducts, loop through order.OrderProducts
                    //for (int j = 0; j < promotion.getApplicableProducts().length; j++)
                    for (int j = 0; j < order.getOrderProducts().length; j++) {
                        //ensure that applicable product ids has the product that you are trying use
                        if (applicableProductIds.contains(order.getOrderProducts()[j].getProductId())) {
                            total += order.getOrderProducts()[j].getQuantity();
                        }
                    }
                    if (total < minTotalQuantity) {
                        // If we haven't reached the minimum total then continue to the next
                        // promotion
                        continue;
                    }
                }

                // Does promotion only apply to a minimum number of single products ordered ?
                if (minProdQuantity > 0) {
                    boolean foundMin = false;
                    //instead of looping through promo.applicableProducts, loop through order.OrderProducts
                    //for (int j = 0; j < promotion.getApplicableProducts().length; j++)
                    for (int j = 0; j < order.getOrderProducts().length; j++) {
                        //ensure that applicable product ids has the product that you are trying use
                        if (applicableProductIds.contains(order.getOrderProducts()[j].getProductId())) {
                            if (order.getOrderProducts()[j].getQuantity() >= minProdQuantity) {
                                foundMin = true;
                            }
                        }
                    }
                    if (!foundMin) {
                        // If we haven't reached the minimum total then continue to the next
                        // promotion
                        continue;
                    }
                }
2
We would want to let user apply as many coupon codes as he wants to his order and get discount associated with each of those coupons.  Is it possible?
Currently, when I apply a different coupon code then the one earlier applied, it gives discount ONLY for the last coupon code applied.  Is there a way it would apply promotions associated with both coupon codes?
3
I need to implement a feature where in I have to display all the products with discounted prices for a particular promotion.  Is there a way I can do this?
I have retrieved the promotion using getPromotion method of admin api, it seems to have applicableProducts which is an array of AdminOrderProduct.  But this array is always null. 
The hard way, I could get all products based on categoryRule and productRule but that will not have the discounted values. 
Suggestions well appreciated.
4
I am using admin web service to retrieve promotions which matches my specified criteria.  Here under is my unit test;
        String sessionId = long(DEFAULT_USERNAME,DEFAULT_PASSWORD);
        AdminPromotionSearch adminPromoSearch = new AdminPromotionSearch();               
        adminPromoSearch.setActive(Boolean.TRUE);
        adminPromoSearch.setCumulative(Boolean.FALSE);
        adminPromoSearch.setRequiresCoupon(Boolean.TRUE);
        Calendar startDate = new GregorianCalendar(2010, 06, 01);
        adminPromoSearch.setStartDate(startDate);
        Calendar endDate = new GregorianCalendar(2011, 06, 27);       
        adminPromoSearch.setEndDate(endDate); 
        adminPromoSearch.setOrderTotalCode("ot_product_discount");

        AdminPromotionSearchResult adminPromoSearchResult = kkClient.getPromotions(sessionId, adminPromoSearch, 0, 10);
        Assert.assertNotNull(adminPromoSearchResult);

I have promotions matching the above mentioned criteria in my app, yet adminPromoSearchResult is returned with empty promotions array and zero totalSetSize.

What am i missing?
5
I have configured struts-config.xml as per Authorize.net payment module for my custom payment module.
Here under is my configuration;
<action path="/CheckoutServerPaymentSubmit" type="com.konakart.actions.CheckoutServerPaymentSubmitAction" name="CreditCardForm" scope="request" validate="true" input="/CheckoutServerPayment.do">
         <forward name="usaepay" path="/USAePay.do" redirect="false"/>
         <forward name="authorizenet" path="/AuthorizeNet.do" redirect="false"/>
         <forward name="payjunction" path="/PayJunction.do" redirect="false"/>
         <forward name="yourpay" path="/YourPay.do" redirect="false"/>
         <forward name="elink" path="/Elink.do" redirect="false"/>
                        <forward name="Mypay" path="/Mypay.do" redirect="false"/>
      </action>


<action path="/Mypay" type="com.konakart.actions.gateways.MypayAction">
         <forward name="Approved" path="/CheckoutFinished.do"/>
         <forward name="TryAgain" path="/CheckoutServerPayment.do"/>
         <forward name="NotLoggedIn" path="/CheckoutDelivery.do"/>
      </action>


The code value in the class implementing PaymentInterface is "Mypay" and same is the module code in the class implementing PaymentModule.

When I run my test case, the action class MypayAction is not getting executed.  Am I missing something?
6
Is it necessary to have Struts configuration for the payment module?  I intend to plug in Payment Module with our website which has its own GUI.  The website will be interacting with Konakart to search/select products and creating orders in Konakart.
When order gets saved, we want to authorize and capture payment based on order details saved with the order. 
When the card is declined, we would like to get a notification regarding the same and would want to give customer another chance to re-enter his/her credit card details.

For doing the above mentioned, we have our own web pages, business logic etc.  Albeit, I followed the instructions as mentioned in the documentation, the implementation I did in my action class is not getting executed when I run my test case.  It does get fired when I try to place an order through Konakart Web App.  Am I missing something?

Any help appreciated.
7
I am trying to develop a new payment module named Cybersource.  I see this module available in the list of modules and I am able to install it as well.  I also verified the parameter values in configuration table and they all appear to be correct.
During installation or removal of any of the payment modules, the constructor and setStaticVariables do get executed (Verified with SOPs put in there).  Although, getPaymentDetails are never getting executed.

Despite of all the above, when I make a call to getPaymentGateways method with my order passed in there, I do not get the Cybersource module in there at all.  Under what circumstances can this happen?

Any help appreciated...