svn commit: r688227 - in /ofbiz/trunk/applications/ecommerce: script/org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy script/org/ofbiz/ecommerce/order/processPaymentSettings.bsh webapp/ecommerce/WEB-INF/controller.xml

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

svn commit: r688227 - in /ofbiz/trunk/applications/ecommerce: script/org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy script/org/ofbiz/ecommerce/order/processPaymentSettings.bsh webapp/ecommerce/WEB-INF/controller.xml

lektran
Author: lektran
Date: Fri Aug 22 16:45:45 2008
New Revision: 688227

URL: http://svn.apache.org/viewvc?rev=688227&view=rev
Log:
bsf event conversion from bsh to groovy

Added:
    ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy
      - copied, changed from r688198, ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/order/processPaymentSettings.bsh
Removed:
    ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/order/processPaymentSettings.bsh
Modified:
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml

Copied: ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy (from r688198, ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/order/processPaymentSettings.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy?p2=ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy&p1=ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/order/processPaymentSettings.bsh&r1=688198&r2=688227&rev=688227&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/order/processPaymentSettings.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy Fri Aug 22 16:45:45 2008
@@ -34,42 +34,41 @@
 import org.ofbiz.service.ServiceUtil;
 
 cart = ShoppingCartEvents.getCartObject(request);
-LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
-GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
-CheckOutHelper checkOutHelper = new CheckOutHelper(dispatcher, delegator, cart);
+dispatcher = request.getAttribute("dispatcher");
+delegator = request.getAttribute("delegator");
+checkOutHelper = new CheckOutHelper(dispatcher, delegator, cart);
+paramMap = UtilHttp.getParameterMap(request);
 
-paymentMethodTypeId = request.getParameter("paymentMethodTypeId");
-Map callResult = ServiceUtil.returnSuccess();
-List errorMessages = new ArrayList();
-Map errorMaps = new HashMap();
+paymentMethodTypeId = paramMap.paymentMethodTypeId;
+errorMessages = [];
+errorMaps = [:];
 
-if(paymentMethodTypeId != null){
-    paymentMethodId = (String) request.getAttribute("paymentMethodId");
+if(paymentMethodTypeId){
+    paymentMethodId = request.getAttribute("paymentMethodId");
     if ("EXT_OFFLINE".equals(paymentMethodTypeId)) {
         paymentMethodId = "EXT_OFFLINE";            
     }
-    singleUsePayment = request.getParameter("singleUsePayment");
-    appendPayment = request.getParameter("appendPayment");
-    boolean isSingleUsePayment = singleUsePayment != null && "Y".equalsIgnoreCase(singleUsePayment) ? true : false;
-    boolean doAppendPayment = appendPayment != null && "Y".equalsIgnoreCase(appendPayment) ? true : false;
+    singleUsePayment = paramMap.singleUsePayment;
+    appendPayment = paramMap.appendPayment;
+    isSingleUsePayment = "Y".equalsIgnoreCase(singleUsePayment) ?: false;
+    doAppendPayment = "Y".equalsIgnoreCase(appendPayment) ?: false;
     callResult = checkOutHelper.finalizeOrderEntryPayment(paymentMethodId, null, isSingleUsePayment, doAppendPayment);
-    ShoppingCart.CartPaymentInfo cpi = cart.getPaymentInfo(paymentMethodId, null, null, null, true);
-    cpi.securityCode = (String) request.getParameter("cardSecurityCode");
+    cpi = cart.getPaymentInfo(paymentMethodId, null, null, null, true);
+    cpi.securityCode = paramMap.cardSecurityCode;
     ServiceUtil.addErrors(errorMessages, errorMaps, callResult);
 }
 
-if (errorMessages.size() == 0 && errorMaps.size() == 0) {
-    Map selPaymentMethods = null;  
-    Map paramMap = UtilHttp.getParameterMap(request);
-    addGiftCard = request.getParameter("addGiftCard");
+if (!errorMessages && !errorMaps) {
+    selPaymentMethods = null;  
+    addGiftCard = paramMap.addGiftCard;
     if("Y".equalsIgnoreCase(addGiftCard)){
-        selPaymentMethods = UtilMisc.toMap(paymentMethodTypeId, null);
+        selPaymentMethods = [paymentMethodTypeId : null];
         callResult = checkOutHelper.checkGiftCard(paramMap, selPaymentMethods);
         ServiceUtil.addErrors(errorMessages, errorMaps, callResult);
-        if (errorMessages.size() == 0 && errorMaps.size() == 0) {
-           String gcPaymentMethodId = (String) callResult.get("paymentMethodId");
-            Double giftCardAmount = (Double) callResult.get("amount");
-            Map gcCallRes = checkOutHelper.finalizeOrderEntryPayment(gcPaymentMethodId, giftCardAmount, true, true);
+        if (!errorMessages && !errorMaps) {
+            gcPaymentMethodId = callResult.paymentMethodId;
+            giftCardAmount = callResult.amount;
+            gcCallRes = checkOutHelper.finalizeOrderEntryPayment(gcPaymentMethodId, giftCardAmount, true, true);
             ServiceUtil.addErrors(errorMessages, errorMaps, gcCallRes);
         }
     }
@@ -77,7 +76,7 @@
 
 //See whether we need to return an error or not
 callResult = ServiceUtil.returnSuccess();
-if (errorMessages.size() > 0 || errorMaps.size() > 0) {
+if (errorMessages || errorMaps) {
     request.setAttribute(ModelService.ERROR_MESSAGE_LIST, errorMessages);
     request.setAttribute(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR);
     return "error";

Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml?rev=688227&r1=688226&r2=688227&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml Fri Aug 22 16:45:45 2008
@@ -415,7 +415,7 @@
 
     <request-map uri="processPaymentSettings">
        <security https="true" auth="false"/>
-       <event type="bsf" path="" invoke="org/ofbiz/ecommerce/order/processPaymentSettings.bsh"/>        
+       <event type="bsf" path="" invoke="org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy"/>        
        <response name="success" type="request" value="reviewOrder"/>
        <response name="error" type="view" value="paymentinformation"/>
    </request-map>
@@ -501,7 +501,7 @@
     
     <request-map uri="quickAnonAddCreditCardToCart">
        <security https="true" auth="false"/>
-       <event type="bsf" path="" invoke="org/ofbiz/ecommerce/order/processPaymentSettings.bsh"/>        
+       <event type="bsf" path="" invoke="org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy"/>        
        <response name="success" type="view" value="quickAnonCcInfo"/>
        <response name="error" type="view" value="quickAnonCcInfo"/>
    </request-map>
@@ -515,21 +515,21 @@
     
    <request-map uri="quickAnonAddEftAccountToCart">
        <security https="true" auth="false"/>
-       <event type="bsf" path="" invoke="org/ofbiz/ecommerce/order/processPaymentSettings.bsh"/>        
+       <event type="bsf" path="" invoke="org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy"/>        
        <response name="success" type="view" value="quickAnonEftInfo"/>
        <response name="error" type="view" value="quickAnonEftInfo"/>
    </request-map>
     
    <request-map uri="quickAnonEnterExtOffline">
         <security https="true" auth="false"/>
-        <event type="bsf" path="" invoke="org/ofbiz/ecommerce/order/processPaymentSettings.bsh"/>        
+        <event type="bsf" path="" invoke="org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy"/>        
         <response name="success" type="view" value="quickAnonOrderReview"/>
         <response name="error" type="view" value="quickAnonOrderReview"/>
    </request-map>
     
    <request-map uri="quickAnonAddGiftCardToCart">
        <security https="true" auth="false"/>
-       <event type="bsf" path="" invoke="org/ofbiz/ecommerce/order/processPaymentSettings.bsh"/>        
+       <event type="bsf" path="" invoke="org/ofbiz/ecommerce/order/ProcessPaymentSettings.groovy"/>        
        <response name="success" type="request" value="quickAnonGcInfo"/>
        <response name="error" type="view" value="quickAnonGcInfo"/>
    </request-map>