svn commit: r591283 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java

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

svn commit: r591283 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java

lektran
Author: lektran
Date: Fri Nov  2 02:43:56 2007
New Revision: 591283

URL: http://svn.apache.org/viewvc?rev=591283&view=rev
Log:
Order manager's quick checkout wasn't recalculating shipping and tax costs before setting the payment details, I'm not sure if I've handled it the best way but it works now.

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

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=591283&r1=591282&r2=591283&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Fri Nov  2 02:43:56 2007
@@ -42,6 +42,7 @@
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.order.finaccount.FinAccountHelper;
 import org.ofbiz.order.order.OrderChangeHelper;
+import org.ofbiz.order.shoppingcart.shipping.ShippingEvents;
 import org.ofbiz.party.contact.ContactHelper;
 import org.ofbiz.product.store.ProductStoreWorker;
 import org.ofbiz.service.GenericServiceException;
@@ -384,7 +385,21 @@
 
             // set the shipping address
             errorMessages.addAll(setCheckOutShippingAddressInternal(shippingContactMechId));
+            
+            // Recalc shipping costs before setting payment
+            Map shipEstimateMap = ShippingEvents.getShipGroupEstimate(dispatcher, delegator, cart, 0);
+            Double shippingTotal = (Double) shipEstimateMap.get("shippingTotal");
+            if (shippingTotal == null) {
+                shippingTotal = new Double(0.00);
+            }
+            cart.setItemShipGroupEstimate(shippingTotal.doubleValue(), 0);
 
+            //Recalc tax before setting payment
+            try {
+                this.calcAndAddTax();
+            } catch (GeneralException e) {
+                Debug.logError(e, module);
+            }
             // set the payment method(s) option
             errorMessages.addAll(setCheckOutPaymentInternal(selectedPaymentMethods, singleUsePayments, billingAccountId));