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:13:16 UTC
svn commit: r517342 - in /ofbiz/trunk:
applications/accounting/src/org/ofbiz/accounting/payment/
applications/ecommerce/data/ applications/product/entitydef/
specialpurpose/pos/data/
Author: sichen
Date: Mon Mar 12 12:13:15 2007
New Revision: 517342
URL: http://svn.apache.org/viewvc?view=rev&rev=517342
Log:
OFBIZ-558: Support rollback of shipping on failed credit card capture
Modified:
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml
ofbiz/trunk/applications/ecommerce/data/DemoRentalProduct.xml
ofbiz/trunk/applications/product/entitydef/entitymodel.xml
ofbiz/trunk/specialpurpose/pos/data/DemoRetail.xml
Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?view=diff&rev=517342&r1=517341&r2=517342
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Mon Mar 12 12:13:15 2007
@@ -1000,8 +1000,6 @@
Double captureAmount = (Double) context.get("captureAmount");
BigDecimal captureAmountBd = new BigDecimal(captureAmount.doubleValue());
- Map result = new HashMap();
-
// get the order header and payment preferences
GenericValue orderHeader = null;
List paymentPrefs = null;
@@ -1015,9 +1013,7 @@
paymentPrefs = delegator.findByAnd("OrderPaymentPreference", lookupMap, orderList);
} catch (GenericEntityException gee) {
Debug.logError(gee, "Problems getting entity record(s), see stack trace", module);
- result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR);
- result.put(ModelService.ERROR_MESSAGE, "ERROR: Could not get order information (" + gee.toString() + ").");
- return result;
+ return ServiceUtil.returnError("ERROR: Could not get order information (" + gee.toString() + ").");
}
// error if no order was found
@@ -1069,7 +1065,7 @@
captureAmount = new Double(outstandingAmount.doubleValue());
} else {
Debug.logInfo("Amount to capture [" + captureAmount + "] was fully captured in Payment [" + tmpResult.get("paymentId") + "].", module);
- result = ServiceUtil.returnSuccess();
+ Map result = ServiceUtil.returnSuccess();
result.put("processResult", "COMPLETE");
return result;
}
@@ -1082,8 +1078,8 @@
// return complete if no payment prefs were found
if (paymentPrefs == null || paymentPrefs.size() == 0) {
Debug.logWarning("No orderPaymentPreferences available to capture", module);
+ Map result = ServiceUtil.returnSuccess();
result.put("processResult", "COMPLETE");
- result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
return result;
}
@@ -1243,11 +1239,18 @@
}
if (amountToCapture > 0.00) {
- result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
+ GenericValue productStore = orh.getProductStore();
+ if (! UtilValidate.isEmpty(productStore)) {
+ boolean shipIfCaptureFails = UtilValidate.isEmpty(productStore.get("shipIfCaptureFails")) || "Y".equalsIgnoreCase(productStore.getString("shipIfCaptureFails"));
+ if(! shipIfCaptureFails) {
+ return ServiceUtil.returnError("Cannot ship order because credit card captures were unsuccessful");
+ }
+ }
+ Map result = ServiceUtil.returnSuccess();
result.put("processResult", "FAILED");
return result;
} else {
- result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
+ Map result = ServiceUtil.returnSuccess();
result.put("processResult", "COMPLETE");
return result;
}
Modified: ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml?view=diff&rev=517342&r1=517341&r2=517342
==============================================================================
--- ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml (original)
+++ ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml Mon Mar 12 12:13:15 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"/>
+ styleSheet="/images/ecommain.css" headerLogo="/images/ofbiz_logo.jpg" autoApproveInvoice="Y" shipIfCaptureFails="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=517342&r1=517341&r2=517342
==============================================================================
--- ofbiz/trunk/applications/ecommerce/data/DemoRentalProduct.xml (original)
+++ ofbiz/trunk/applications/ecommerce/data/DemoRentalProduct.xml Mon Mar 12 12:13:15 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"/>
+ styleSheet="/images/ecommain.css" headerLogo="/images/opentravelsystem_logo.jpg" autoApproveInvoice="Y" shipIfCaptureFails="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/product/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel.xml?view=diff&rev=517342&r1=517341&r2=517342
==============================================================================
--- ofbiz/trunk/applications/product/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/product/entitydef/entitymodel.xml Mon Mar 12 12:13:15 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="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">
<key-map field-name="primaryStoreGroupId" rel-field-name="productStoreGroupId"/>
Modified: ofbiz/trunk/specialpurpose/pos/data/DemoRetail.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/data/DemoRetail.xml?view=diff&rev=517342&r1=517341&r2=517342
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/data/DemoRetail.xml (original)
+++ ofbiz/trunk/specialpurpose/pos/data/DemoRetail.xml Mon Mar 12 12:13:15 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"/>
+ styleSheet="" headerLogo="" autoApproveInvoice="Y" shipIfCaptureFails="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"/>