svn commit: r1849688 - /ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java

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

svn commit: r1849688 - /ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java

adityasharma
Author: adityasharma
Date: Mon Dec 24 13:25:59 2018
New Revision: 1849688

URL: http://svn.apache.org/viewvc?rev=1849688&view=rev
Log:
Improved: Refactor boolean returns for ShoppingCart methods
(OFBIZ-10745)
Improves code in isPaymentMethodType() and isValidateGCFinAccount().
Improved boolean returns with single statement, replacing if blocks with explicit boolean return.

Modified:
    ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1849688&r1=1849687&r2=1849688&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java Mon Dec 24 13:25:59 2018
@@ -1929,10 +1929,7 @@ public class ShoppingCart implements Ite
         } catch (GenericEntityException e) {
             Debug.logInfo(e, "Problems getting PaymentMethodType", module);
         }
-        if (paymentMethodType == null) {
-            return false;
-        }
-        return true;
+        return paymentMethodType != null;
     }
 
     public GenericValue getBillingAddress() {
@@ -1985,10 +1982,7 @@ public class ShoppingCart implements Ite
         try {
             GenericValue giftCertSettings = getGiftCertSettingFromStore(delegator);
             if (giftCertSettings != null) {
-                if ("Y".equals(giftCertSettings.getString("validateGCFinAcct"))) {
-                    return true;
-                }
-                return false;
+                return "Y".equals(giftCertSettings.getString("validateGCFinAcct"));
             }
             Debug.logWarning("No product store gift certificate settings found for store [" + getProductStoreId() + "]",
                     module);