svn commit: r541311 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java

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

svn commit: r541311 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java

jacopoc
Author: jacopoc
Date: Thu May 24 07:45:01 2007
New Revision: 541311

URL: http://svn.apache.org/viewvc?view=rev&rev=541311
Log:
Misc code cleanups, no functional changes.

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

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?view=diff&rev=541311&r1=541310&r2=541311
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Thu May 24 07:45:01 2007
@@ -342,7 +342,7 @@
               result = ServiceUtil.returnSuccess();
           }
           return result;
-      }
+    }
 
 
     public Map setCheckOutOptions(String shippingMethod, String shippingContactMechId, Map selectedPaymentMethods,
@@ -841,8 +841,6 @@
             RETRY_ON_ERROR = "Y";
         }
 
-        // Check the payment preferences; if we have ANY w/ status PAYMENT_NOT_AUTH invoke payment service.
-        boolean requireAuth = false;
         List allPaymentPreferences = null;
         try {
             allPaymentPreferences = delegator.findByAnd("OrderPaymentPreference", UtilMisc.toMap("orderId", orderId));
@@ -905,12 +903,9 @@
         Map paymentFields = UtilMisc.toMap("statusId", "PAYMENT_NOT_AUTH");
         List onlinePaymentPrefs = EntityUtil.filterByAnd(allPaymentPreferences, paymentFields);
 
-        if (onlinePaymentPrefs != null && onlinePaymentPrefs.size() > 0) {
-            requireAuth = true;
-        }
-
+        // Check the payment preferences; if we have ANY w/ status PAYMENT_NOT_AUTH invoke payment service.
         // Invoke payment processing.
-        if (requireAuth) {
+        if (onlinePaymentPrefs != null && onlinePaymentPrefs.size() > 0) {
             boolean autoApproveOrder = UtilValidate.isEmpty(productStore.get("autoApproveOrder")) || "Y".equalsIgnoreCase(productStore.getString("autoApproveOrder"));
             if (orderTotal == 0 && autoApproveOrder) {
                 // if there is nothing to authorize; don't bother
@@ -1363,7 +1358,7 @@
         return result;
     }
 
-    public double availableAccountBalance(String billingAccountId) {
+    public static double availableAccountBalance(String billingAccountId, LocalDispatcher dispatcher) {
         if (billingAccountId == null) return 0.0;
         try {
             Map res = dispatcher.runSync("calcBillingAccountBalance", UtilMisc.toMap("billingAccountId", billingAccountId));
@@ -1375,6 +1370,10 @@
             Debug.logError(e, module);
         }
         return 0.0;
+    }
+
+    public double availableAccountBalance(String billingAccountId) {
+        return availableAccountBalance(billingAccountId, dispatcher);
     }
 
     public Map makeBillingAccountMap(List paymentPrefs) {