OFBIZ-558: Support rollback of shipping on failed credit card capture
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@517342 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
+12
-9
@@ -1000,8 +1000,6 @@ public class PaymentGatewayServices {
|
||||
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 @@ public class PaymentGatewayServices {
|
||||
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 @@ public class PaymentGatewayServices {
|
||||
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 @@ public class PaymentGatewayServices {
|
||||
// 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 @@ public class PaymentGatewayServices {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ under the License.
|
||||
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"/>
|
||||
|
||||
@@ -28,7 +28,7 @@ under the License.
|
||||
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"/>
|
||||
|
||||
@@ -3149,6 +3149,7 @@ under the License.
|
||||
<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"/>
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
Reference in New Issue
Block a user