svn commit: r434334 - /incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r434334 - /incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java

jacopoc
Author: jacopoc
Date: Thu Aug 24 00:55:36 2006
New Revision: 434334

URL: http://svn.apache.org/viewvc?rev=434334&view=rev
Log:
The CheckOutEvents.finalizeOrderEntry(...) method has been separated into two new methods:

1) CheckOutEvents.finalizeOrderEntry(...) where all the actions are taken
2) (new) CheckOutEvents.determineNextFinalizeStep(...) where the next step is determined: I've simply moved the logic at the end of the original finalizeOrderEntry method into this new one to make things a bit more clear (hopefully)

Modified:
    incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java

Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java?rev=434334&r1=434333&r2=434334&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java (original)
+++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Thu Aug 24 00:55:36 2006
@@ -694,12 +694,6 @@
            cart.setOrderTermSet(true);
         }
 
-        // flag anoymous checkout to bypass additional party settings
-        boolean isAnonymousCheckout = false;
-        if (userLogin != null && "anonymous".equals(userLogin.getString("userLoginId"))) {
-            isAnonymousCheckout = true;
-        }
-
         CheckOutHelper checkOutHelper = new CheckOutHelper(dispatcher, delegator, cart);
 
         // ====================================================================================
@@ -787,7 +781,7 @@
                 request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderInvalidAmountSetForBillingAccount", UtilMisc.toMap("billingAccountId",billingAccountId), (cart != null ? cart.getLocale() : Locale.getDefault())));
                 return "error";
             }
-              
+
             Map selPaymentMethods = null;
             if (checkOutPaymentId != null) {
                 callResult = checkOutHelper.finalizeOrderEntryPayment(checkOutPaymentId, null, isSingleUsePayment, doAppendPayment);
@@ -819,6 +813,18 @@
                 return "error";
             }
         }
+        // determine where to direct the browser
+        return determineNextFinalizeStep(request, response);
+    }
+
+    public static String determineNextFinalizeStep(HttpServletRequest request, HttpServletResponse response) {
+        GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin");
+        ShoppingCart cart = (ShoppingCart) request.getSession().getAttribute("shoppingCart");
+        // flag anoymous checkout to bypass additional party settings
+        boolean isAnonymousCheckout = false;
+        if (userLogin != null && "anonymous".equals(userLogin.getString("userLoginId"))) {
+            isAnonymousCheckout = true;
+        }
 
         // determine where to direct the browser
         // these are the default values
@@ -829,7 +835,7 @@
         boolean requirePayment = !cart.getOrderType().equals("PURCHASE_ORDER");
         boolean requireTerm = cart.getOrderType().equals("PURCHASE_ORDER");
         boolean requireAdditionalParty = isAnonymousCheckout;
-
+        boolean isSingleUsePayment = true;
         // these options are not available to anonymous shoppers (security)
         if (userLogin != null && !"anonymous".equals(userLogin.getString("userLoginId"))) {
             String requireCustomerStr = request.getParameter("finalizeReqCustInfo");
@@ -839,6 +845,7 @@
             String requireTermStr = request.getParameter("finalizeReqTermInfo");
             String requireAdditionalPartyStr = request.getParameter("finalizeReqAdditionalParty");
             String requireShipGroupsStr = request.getParameter("finalizeReqShipGroups");
+            String singleUsePaymentStr = request.getParameter("singleUsePayment");
             requireCustomer = requireCustomerStr == null || requireCustomerStr.equalsIgnoreCase("true");
             requireShipping = requireShippingStr == null || requireShippingStr.equalsIgnoreCase("true");
             requireOptions = requireOptionsStr == null || requireOptionsStr.equalsIgnoreCase("true");
@@ -850,6 +857,7 @@
                 requireTerm = requireTermStr == null || requireTermStr.equalsIgnoreCase("true");
             }
             requireAdditionalParty = requireAdditionalPartyStr == null || requireAdditionalPartyStr.equalsIgnoreCase("true");
+            isSingleUsePayment = singleUsePaymentStr != null && "Y".equalsIgnoreCase(singleUsePaymentStr) ? true : false;
         }
 
         boolean shippingAddressSet = true;