update to cybersource payment gateway: added a properties setting that orders are still accepted but put into the created stage when a credit card fails authorisation. The default is the current setting: order is not created
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1071517 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -118,6 +118,12 @@ payment.cybersource.ignoreAvs=false
|
||||
# AVS Decline Codes -- May not be supported any longer
|
||||
#payment.cybersource.avsDeclineCodes=
|
||||
|
||||
# Ignore status of cybersource transaction reply (Y|N) (if cybersource response transaction status not equals "ACCEPT" then OFBiz will still create the order but in status 'created'.
|
||||
# default N = Don't create order if cybersource reported transaction status not equals "ACCEPT".
|
||||
payment.cybersource.ignoreStatus=N
|
||||
# It happens pretty often that a creditcard is rejected for not valid reasons, one can check to Cybersource fraud queue and after that the order can still be rejected or approved.
|
||||
|
||||
|
||||
############################################
|
||||
# ClearCommerce Configuration
|
||||
############################################
|
||||
|
||||
@@ -267,6 +267,7 @@ under the License.
|
||||
<attribute name="errors" type="Boolean" mode="OUT" optional="false"/>
|
||||
<attribute name="messages" type="List" mode="OUT" optional="true"/>
|
||||
<attribute name="processAmount" type="BigDecimal" mode="OUT" optional="true"/>
|
||||
<attribute name="authCode" type="String" mode="OUT" optional="true"/>
|
||||
</service>
|
||||
|
||||
<service name="authOrderPayments" engine="java"
|
||||
@@ -276,6 +277,7 @@ under the License.
|
||||
<attribute name="processResult" type="String" mode="OUT" optional="false"/>
|
||||
<attribute name="authResultMsgs" type="List" mode="OUT" optional="true"/>
|
||||
<attribute name="reAuth" type="Boolean" mode="IN" optional="true"/>
|
||||
<attribute name="authCode" type="String" mode="OUT" optional="true"/>
|
||||
</service>
|
||||
|
||||
<service name="releaseOrderPayments" engine="java"
|
||||
|
||||
@@ -201,6 +201,7 @@ public class PaymentGatewayServices {
|
||||
results.put("processAmount", thisAmount);
|
||||
results.put("finished", Boolean.TRUE);
|
||||
results.put("errors", Boolean.FALSE);
|
||||
results.put("authCode", authPaymentResult.get("authCode"));
|
||||
return results;
|
||||
} else {
|
||||
boolean needsNsfRetry = needsNsfRetry(orderPaymentPreference, authPaymentResult, delegator);
|
||||
@@ -399,6 +400,9 @@ public class PaymentGatewayServices {
|
||||
continue;
|
||||
}
|
||||
|
||||
// add authorization code to the result
|
||||
result.put("authCode", results.get("authCode"));
|
||||
|
||||
if (ServiceUtil.isError(results)) {
|
||||
hadError += 1;
|
||||
messages.add("Could not authorize OrderPaymentPreference [" + paymentPref.getString("orderPaymentPreferenceId") + "] for order [" + orderId + "]: " + results.get(ModelService.ERROR_MESSAGE));
|
||||
|
||||
Vendored
+6
-1
@@ -536,12 +536,17 @@ public class IcsPaymentServices {
|
||||
|
||||
private static void processAuthResult(Map<String, Object> reply, Map<String, Object> result) {
|
||||
String decision = getDecision(reply);
|
||||
String checkModeStatus = UtilProperties.getPropertyValue("payment.properties", "payment.cybersource.ignoreStatus");
|
||||
if ("ACCEPT".equalsIgnoreCase(decision)) {
|
||||
result.put("authCode", reply.get("ccAuthReply_authorizationCode"));
|
||||
result.put("authResult", Boolean.TRUE);
|
||||
} else {
|
||||
result.put("authCode", decision);
|
||||
result.put("authResult", Boolean.FALSE);
|
||||
if ("N".equals(checkModeStatus)) {
|
||||
result.put("authResult", Boolean.FALSE);
|
||||
} else {
|
||||
result.put("authResult", Boolean.TRUE);
|
||||
}
|
||||
// TODO: based on reasonCode populate the following flags as applicable: resultDeclined, resultNsf, resultBadExpire, resultBadCardNumber
|
||||
}
|
||||
|
||||
|
||||
@@ -1067,9 +1067,27 @@ public class CheckOutHelper {
|
||||
|
||||
// set the order and item status to approved
|
||||
if (autoApproveOrder) {
|
||||
boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
|
||||
if (!ok) {
|
||||
throw new GeneralException("Problem with order change; see above error");
|
||||
List<GenericValue> productStorePaymentSettingList = delegator.findByAnd("ProductStorePaymentSetting", UtilMisc.toMap("productStoreId", productStore.getString("productStoreId"), "paymentMethodTypeId", "CREDIT_CARD", "paymentService", "cyberSourceCCAuth"));
|
||||
if (productStorePaymentSettingList.size() > 0) {
|
||||
String decision = (String) paymentResult.get("authCode");
|
||||
if (UtilValidate.isNotEmpty(decision)) {
|
||||
if ("ACCEPT".equalsIgnoreCase(decision)) {
|
||||
boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
|
||||
if (!ok) {
|
||||
throw new GeneralException("Problem with order change; see above error");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
|
||||
if (!ok) {
|
||||
throw new GeneralException("Problem with order change; see above error");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
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")) {
|
||||
|
||||
Reference in New Issue
Block a user