You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by si...@apache.org on 2007/03/12 20:23:03 UTC

svn commit: r517347 - in /ofbiz/trunk: applications/ecommerce/data/ applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/entitydef/ specialpurpose/pos/data/

Author: sichen
Date: Mon Mar 12 12:23:02 2007
New Revision: 517347

URL: http://svn.apache.org/viewvc?view=rev&rev=517347
Log:
Implementing ProductStore.autoApproveOrder (indicator) to govern whether orders are automatically approved during processPayment execution when payment is authorized. If empty or Y, orders will be approved.

Modified:
    ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml
    ofbiz/trunk/applications/ecommerce/data/DemoRentalProduct.xml
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
    ofbiz/trunk/applications/product/entitydef/entitymodel.xml
    ofbiz/trunk/specialpurpose/pos/data/DemoRetail.xml

Modified: ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml?view=diff&rev=517347&r1=517346&r2=517347
==============================================================================
--- ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml (original)
+++ ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml Mon Mar 12 12:23:02 2007
@@ -49,7 +49,7 @@
         authFraudMessage="Your order has been rejected and your account has been disabled due to fraud."
         authErrorMessage="Problem connecting to payment processor; we will continue to retry and notify you by email."
         storeCreditValidDays="90"
-        styleSheet="/images/ecommain.css" headerLogo="/images/ofbiz_logo.jpg" autoApproveInvoice="Y" shipIfCaptureFails="Y"/>
+        styleSheet="/images/ecommain.css" headerLogo="/images/ofbiz_logo.jpg" autoApproveInvoice="Y" shipIfCaptureFails="Y" autoApproveOrder="Y"/>
     <ProductStorePaymentSetting productStoreId="9000" paymentMethodTypeId="CREDIT_CARD" paymentServiceTypeEnumId="PRDS_PAY_AUTH" paymentService="alwaysApproveCCProcessor"/>
     <ProductStorePaymentSetting productStoreId="9000" paymentMethodTypeId="CREDIT_CARD" paymentServiceTypeEnumId="PRDS_PAY_RELEASE" paymentService="testCCRelease"/>
     <ProductStorePaymentSetting productStoreId="9000" paymentMethodTypeId="CREDIT_CARD" paymentServiceTypeEnumId="PRDS_PAY_CAPTURE" paymentService="testCCCapture"/>

Modified: ofbiz/trunk/applications/ecommerce/data/DemoRentalProduct.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/data/DemoRentalProduct.xml?view=diff&rev=517347&r1=517346&r2=517347
==============================================================================
--- ofbiz/trunk/applications/ecommerce/data/DemoRentalProduct.xml (original)
+++ ofbiz/trunk/applications/ecommerce/data/DemoRentalProduct.xml Mon Mar 12 12:23:02 2007
@@ -28,7 +28,7 @@
         authDeclinedMessage="There has been a problem with your method of payment. Please try a different method or call customer service."
         authFraudMessage="Your order has been rejected and your account has been disabled due to fraud."
         authErrorMessage="Problem connecting to payment processor; we will continue to retry and notify you by email."
-        styleSheet="/images/ecommain.css" headerLogo="/images/opentravelsystem_logo.jpg" autoApproveInvoice="Y" shipIfCaptureFails="Y"/>
+        styleSheet="/images/ecommain.css" headerLogo="/images/opentravelsystem_logo.jpg" autoApproveInvoice="Y" shipIfCaptureFails="Y" autoApproveOrder="Y"/>
     <ProductStorePaymentSetting productStoreId="RentalStore" paymentMethodTypeId="CREDIT_CARD" paymentServiceTypeEnumId="PRDS_PAY_AUTH" paymentService="alwaysApproveCCProcessor"/>
     <ProductStorePaymentSetting productStoreId="RentalStore" paymentMethodTypeId="CREDIT_CARD" paymentServiceTypeEnumId="PRDS_PAY_RELEASE" paymentService="testCCRelease"/>
     <ProductStorePaymentSetting productStoreId="RentalStore" paymentMethodTypeId="CREDIT_CARD" paymentServiceTypeEnumId="PRDS_PAY_CAPTURE" paymentService="testCCCapture"/>

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?view=diff&rev=517347&r1=517346&r2=517347
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Mon Mar 12 12:23:02 2007
@@ -907,7 +907,8 @@
 
         // Invoke payment processing.
         if (requireAuth) {
-            if (orderTotal == 0) {
+            boolean autoApproveOrder = UtilValidate.isEmpty(productStore.get("autoApproveOrder")) || "Y".equalsIgnoreCase(productStore.getString("autoApproveOrder"));
+            if (orderTotal == 0 && autoApproveOrder) {
                 // if there is nothing to authorize; don't bother
                 boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
                 if (!ok) {
@@ -961,9 +962,11 @@
                     if (Debug.verboseOn()) Debug.logVerbose("Payment auth was a success!", module);
 
                     // set the order and item status to approved
-                    boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
-                    if (!ok) {
-                        throw new GeneralException("Problem with order change; see above error");
+                    if (autoApproveOrder) {
+                        boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
+                        if (!ok) {
+                            throw new GeneralException("Problem with order change; see above error");
+                        }
                     }
                 } else if (authResp.equals("ERROR")) {
                     // service failed

Modified: ofbiz/trunk/applications/product/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel.xml?view=diff&rev=517347&r1=517346&r2=517347
==============================================================================
--- ofbiz/trunk/applications/product/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/product/entitydef/entitymodel.xml Mon Mar 12 12:23:02 2007
@@ -3149,6 +3149,7 @@
       <field name="autoOrderCcTryLaterMax" type="numeric"><description>For auto-orders if Credit Cards fails for NSF try again how many times?</description></field>
       <field name="storeCreditValidDays" type="numeric"><description>How many days that store credit is valid for. Null value implies no expiration.</description></field>
       <field name="autoApproveInvoice" type="indicator"><description>If Y or empty, sales invoices created from orders will be marked ready.</description></field>
+      <field name="autoApproveOrder" type="indicator"><description>If N, orders will not be automatically approved when payment is authorized.</description></field>
       <field name="shipIfCaptureFails" type="indicator"><description>If N, the captureOrderPayments will cause a service error if credit card capture fails.</description></field>
       <prim-key field="productStoreId"/>
       <relation type="one" fk-name="PROD_STR_PRSTRGP" title="Primary" rel-entity-name="ProductStoreGroup">

Modified: ofbiz/trunk/specialpurpose/pos/data/DemoRetail.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/data/DemoRetail.xml?view=diff&rev=517347&r1=517346&r2=517347
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/data/DemoRetail.xml (original)
+++ ofbiz/trunk/specialpurpose/pos/data/DemoRetail.xml Mon Mar 12 12:23:02 2007
@@ -53,7 +53,7 @@
         authDeclinedMessage="There has been a problem with your method of payment. Please try a different method or call customer service."
         authFraudMessage="Your order has been rejected and your account has been disabled due to fraud."
         authErrorMessage="Problem connecting to payment processor; we will continue to retry and notify you by email."
-        styleSheet="" headerLogo="" autoApproveInvoice="Y" shipIfCaptureFails="Y"/>
+        styleSheet="" headerLogo="" autoApproveInvoice="Y" shipIfCaptureFails="Y" autoApproveOrder="Y"/>
 
     <ProductStorePaymentSetting productStoreId="9100" paymentMethodTypeId="CREDIT_CARD" paymentServiceTypeEnumId="PRDS_PAY_AUTH" paymentService="alwaysApproveWithCaptureCCProcessor"/>
     <ProductStorePaymentSetting productStoreId="9100" paymentMethodTypeId="CREDIT_CARD" paymentServiceTypeEnumId="PRDS_PAY_RELEASE" paymentService="testCCRelease"/>