svn commit: r1817581 - /ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java

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

svn commit: r1817581 - /ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java

mbrohl
Author: mbrohl
Date: Fri Dec  8 22:01:44 2017
New Revision: 1817581

URL: http://svn.apache.org/viewvc?rev=1817581&view=rev
Log:
Improved: Fixing defects reported by FindBugs, package
org.apache.ofbiz.order.thirdparty.paypal.
(OFBIZ-9733)

Thanks Julian Leichert for reporting and providing the patch.

Modified:
    ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java?rev=1817581&r1=1817580&r2=1817581&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java Fri Dec  8 22:01:44 2017
@@ -91,9 +91,7 @@ public class ExpressCheckoutEvents {
             Debug.logError("No ExpressCheckout token found in cart, you must do a successful setExpressCheckout before redirecting.", module);
             return "error";
         }
-        if (cart != null) {
-            productStoreId = cart.getProductStoreId();
-        }
+        productStoreId = cart.getProductStoreId();
         if (productStoreId != null) {
             GenericValue payPalPaymentSetting = ProductStoreWorker.getProductStorePaymentSetting(delegator, productStoreId, "EXT_PAYPAL", null, true);
             if (payPalPaymentSetting != null) {
@@ -207,17 +205,19 @@ public class ExpressCheckoutEvents {
     }
 
     public static CheckoutType determineCheckoutType(Delegator delegator, String productStoreId) {
-        GenericValue payPalPaymentSetting = ProductStoreWorker.getProductStorePaymentSetting(delegator, productStoreId, "EXT_PAYPAL", null, true);
+        GenericValue payPalPaymentSetting = ProductStoreWorker.getProductStorePaymentSetting(delegator, productStoreId,
+                "EXT_PAYPAL", null, true);
         if (payPalPaymentSetting != null && payPalPaymentSetting.getString("paymentGatewayConfigId") != null) {
             try {
                 GenericValue paymentGatewayConfig = payPalPaymentSetting.getRelatedOne("PaymentGatewayConfig", false);
-                String paymentGatewayConfigTypeId = paymentGatewayConfig.getString("paymentGatewayConfigTypeId");
                 if (paymentGatewayConfig != null) {
+                    String paymentGatewayConfigTypeId = paymentGatewayConfig.getString("paymentGatewayConfigTypeId");
                     if ("PAY_GATWY_PAYFLOWPRO".equals(paymentGatewayConfigTypeId)) {
                         return CheckoutType.PAYFLOW;
                     } else if ("PAY_GATWY_PAYPAL".equals(paymentGatewayConfigTypeId)) {
                         GenericValue payPalConfig = paymentGatewayConfig.getRelatedOne("PaymentGatewayPayPal", false);
-                        // TODO: Probably better off with an indicator field to indicate Express Checkout use
+                        // TODO: Probably better off with an indicator field to indicate Express
+                        // Checkout use
                         if (UtilValidate.isNotEmpty(payPalConfig.get("apiUserName"))) {
                             return CheckoutType.STANDARD;
                         }