svn commit: r612793 - in /ofbiz/branches/release4.0/applications/order: src/org/ofbiz/order/shoppingcart/CheckOutEvents.java src/org/ofbiz/order/shoppingcart/CheckOutHelper.java webapp/ordermgr/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: r612793 - in /ofbiz/branches/release4.0/applications/order: src/org/ofbiz/order/shoppingcart/CheckOutEvents.java src/org/ofbiz/order/shoppingcart/CheckOutHelper.java webapp/ordermgr/WEB-INF/controller.xml

bibryam
Author: bibryam
Date: Thu Jan 17 02:58:48 2008
New Revision: 612793

URL: http://svn.apache.org/viewvc?rev=612793&view=rev
Log:
Applied fix from trunk for revision: 612767

Modified:
    ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java
    ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
    ofbiz/branches/release4.0/applications/order/webapp/ordermgr/WEB-INF/controller.xml

Modified: ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java?rev=612793&r1=612792&r2=612793&view=diff
==============================================================================
--- ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java (original)
+++ ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Thu Jan 17 02:58:48 2008
@@ -35,6 +35,7 @@
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.marketing.tracking.TrackingCodeEvents;
+import org.ofbiz.party.party.PartyWorker;
 import org.ofbiz.product.catalog.CatalogWorker;
 import org.ofbiz.product.store.ProductStoreWorker;
 import org.ofbiz.service.GenericServiceException;
@@ -526,7 +527,11 @@
 
         Map callResult = checkOutHelper.checkOrderBlacklist(userLogin);
         if (callResult.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_ERROR)) {
-            result = (String) callResult.get(ModelService.ERROR_MESSAGE);
+            request.setAttribute("_ERROR_MESSAGE_", callResult.get(ModelService.ERROR_MESSAGE));
+            result = "error";
+        } else if (callResult.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_FAIL)) {
+            request.setAttribute("_ERROR_MESSAGE_", callResult.get(ModelService.ERROR_MESSAGE));
+            result = "failed";
         } else {
             result = (String) callResult.get(ModelService.SUCCESS_MESSAGE);
         }
@@ -539,7 +544,9 @@
         ShoppingCart cart = (ShoppingCart) session.getAttribute("shoppingCart");
         GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
-        GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");
+        String orderPartyId = cart.getOrderPartyId();
+        GenericValue userLogin = PartyWorker.findPartyLatestUserLogin(orderPartyId, delegator);
+        GenericValue currentUser = (GenericValue) session.getAttribute("userLogin");
         String result;
 
         // Load the properties store
@@ -551,8 +558,9 @@
         ServiceUtil.getMessages(request, callResult, null);
 
         // wipe the session
-        session.invalidate();
-
+        if (("anonymous".equals(currentUser.getString("userLoginId"))) || (currentUser.getString("userLoginId")).equals(userLogin.getString("userLoginId"))) {
+            session.invalidate();
+        }
         //Determine whether it was a success or not
         if (callResult.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_ERROR)) {
             result = (String) callResult.get(ModelService.ERROR_MESSAGE);

Modified: ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=612793&r1=612792&r2=612793&view=diff
==============================================================================
--- ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
+++ ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Thu Jan 17 02:58:48 2008
@@ -1186,7 +1186,7 @@
         }
 
         if (blacklistFound != null && blacklistFound.size() > 0) {
-            return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderFailed", (cart != null ? cart.getLocale() : Locale.getDefault())));
+            return ServiceUtil.returnFailure(UtilProperties.getMessage(resource_error,"OrderFailed", (cart != null ? cart.getLocale() : Locale.getDefault())));
         } else {
             return ServiceUtil.returnSuccess("success");
         }
@@ -1195,25 +1195,26 @@
     public Map failedBlacklistCheck(GenericValue userLogin, GenericValue productStore) {
         Map result;
         String errMsg=null;
-
         String REJECT_MESSAGE = productStore.getString("authFraudMessage");
-
-        // Get the orderId from the cart.
         String orderId = this.cart.getOrderId();
-
-        // set the order/item status - reverse inv
-        OrderChangeHelper.rejectOrder(dispatcher, userLogin, orderId);
-
-        // nuke the userlogin
-        userLogin.set("enabled", "N");
+        
         try {
-            userLogin.store();
+            if (userLogin != null) {
+                // nuke the userlogin
+                userLogin.set("enabled", "N");
+                userLogin.store();
+            } else {
+                userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "system"));
+            }
         } catch (GenericEntityException e) {
-            Debug.logError(e, "Problems de-activating userLogin.", module);
+            Debug.logError(e, module);
             errMsg = UtilProperties.getMessage(resource,"checkhelper.database_error", (cart != null ? cart.getLocale() : Locale.getDefault()));
             result = ServiceUtil.returnError(errMsg);
             return result;
         }
+
+        // set the order/item status - reverse inv
+        OrderChangeHelper.rejectOrder(dispatcher, userLogin, orderId);
         result = ServiceUtil.returnSuccess();
         result.put(ModelService.ERROR_MESSAGE, REJECT_MESSAGE);
 

Modified: ofbiz/branches/release4.0/applications/order/webapp/ordermgr/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/order/webapp/ordermgr/WEB-INF/controller.xml?rev=612793&r1=612792&r2=612793&view=diff
==============================================================================
--- ofbiz/branches/release4.0/applications/order/webapp/ordermgr/WEB-INF/controller.xml (original)
+++ ofbiz/branches/release4.0/applications/order/webapp/ordermgr/WEB-INF/controller.xml Thu Jan 17 02:58:48 2008
@@ -856,9 +856,15 @@
         <security direct-request="false"/>
         <event type="java" path="org.ofbiz.order.shoppingcart.CheckOutEvents" invoke="checkOrderBlacklist"/>
         <response name="success" type="request" value="processpayment"/>
-        <response name="failed" type="view" value="confirm"/>
+        <response name="failed" type="request" value="failedBlacklist"/>
         <response name="error" type="view" value="confirm"/>
     </request-map>
+    <request-map uri="failedBlacklist">
+        <security direct-request="false"/>
+        <event type="java" path="org.ofbiz.order.shoppingcart.CheckOutEvents" invoke="failedBlacklistCheck"/>
+        <response name="success" type="view" value="main"/>
+        <response name="error" type="view" value="main"/>
+    </request-map>    
     <request-map uri="processpayment">
         <security direct-request="false"/>
         <event type="java" path="org.ofbiz.order.shoppingcart.CheckOutEvents" invoke="processPayment"/>