From e1f4e6777ee974c49f24f93d89a3c55d85b3ce4e Mon Sep 17 00:00:00 2001 From: Suraj Khurana Date: Sat, 9 Mar 2019 05:22:19 +0000 Subject: [PATCH] Fixed: Service failed to mark expired authorized payments of Authorize.net as void. (OFBIZ-10727) Thanks Amit Gadaley for reporting the issue and providing the patch, thanks Jacopo for discussion and feedback. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1855078 13f79535-47bb-0310-9956-ffa450edef68 --- .../thirdparty/authorizedotnet/AIMPaymentServices.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java index 8fcd55f6db..5b91db8909 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java @@ -338,6 +338,12 @@ public class AIMPaymentServices { AuthorizeResponse ar = new AuthorizeResponse(httpResponse, apiType); if (ar.isApproved()) { result.put("authResult", Boolean.TRUE); + } + //When the transaction is already expired in Authorize.net, then the response is an error message with reason code 16 (i.e. "The transaction cannot be found"); + // in this case we proceed without generating an error in order to void/cancel the transaction record in OFBiz as well. + //This else if block takes care of the expired transaction. + else if ("VOID".equals(props.get("transType")) && "16".equals(ar.getReasonCode())) { + result.put("authResult", Boolean.TRUE); } else { result.put("authResult", Boolean.FALSE); if (Debug.infoOn()) {