svn commit: r794227 - /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: r794227 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java

lektran
Author: lektran
Date: Wed Jul 15 10:50:38 2009
New Revision: 794227

URL: http://svn.apache.org/viewvc?rev=794227&view=rev
Log:
Allow the event that checks if a paypal redirect is required to be inserted anywhere in the checkout process

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

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java?rev=794227&r1=794226&r2=794227&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Wed Jul 15 10:50:38 2009
@@ -634,21 +634,19 @@
         ShoppingCart cart = ShoppingCartEvents.getCartObject(request);
         GenericValue productStore = ProductStoreWorker.getProductStore(cart.getProductStoreId(), delegator);
         String paymentMethodTypeId = (String) request.getParameter("paymentMethodTypeId");
-        if (UtilValidate.isNotEmpty(paymentMethodTypeId)) {
-            if ("EXT_PAYPAL".equals(paymentMethodTypeId)) {
-                List<GenericValue> payPalProdStorePaySettings = null;
-                try {
-                    payPalProdStorePaySettings = delegator.findByAnd("ProductStorePaymentSetting", "productStoreId", productStore.getString("productStoreId"), "paymentMethodTypeId", "EXT_PAYPAL");
-                    GenericValue payPalProdStorePaySetting = EntityUtil.getFirst(payPalProdStorePaySettings);
-                    if (payPalProdStorePaySetting != null) {
-                        GenericValue gatewayConfig = payPalProdStorePaySetting.getRelatedOne("PaymentGatewayConfig");
-                        if (gatewayConfig != null && "PAYFLOWPRO".equals(gatewayConfig.getString("paymentGatewayConfigTypeId"))) {
-                            return "paypal";
-                        }
+        if ("EXT_PAYPAL".equals(paymentMethodTypeId) || cart.getPaymentMethodTypeIds().contains("EXT_PAYPAL")) {
+            List<GenericValue> payPalProdStorePaySettings = null;
+            try {
+                payPalProdStorePaySettings = delegator.findByAnd("ProductStorePaymentSetting", "productStoreId", productStore.getString("productStoreId"), "paymentMethodTypeId", "EXT_PAYPAL");
+                GenericValue payPalProdStorePaySetting = EntityUtil.getFirst(payPalProdStorePaySettings);
+                if (payPalProdStorePaySetting != null) {
+                    GenericValue gatewayConfig = payPalProdStorePaySetting.getRelatedOne("PaymentGatewayConfig");
+                    if (gatewayConfig != null && "PAYFLOWPRO".equals(gatewayConfig.getString("paymentGatewayConfigTypeId"))) {
+                        return "paypal";
                     }
-                } catch (GenericEntityException e) {
-                    Debug.logError(e, module);
                 }
+            } catch (GenericEntityException e) {
+                Debug.logError(e, module);
             }
         }
         return "success";