Author: deepak
Date: Wed Jun 8 14:36:56 2016
New Revision: 1747402
URL:
http://svn.apache.org/viewvc?rev=1747402&view=revLog:
(OFBIZ-7011) Applied patch from jira ticket
=======================================
Failure in Payment Capture process when ERROR is returned in referenceNum in paymentGatewayResponse=======================================
Thanks Avnindra for your contirbution.
Modified:
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
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?rev=1747402&r1=1747401&r2=1747402&view=diff==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Wed Jun 8 14:36:56 2016
@@ -44,8 +44,10 @@ import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.condition.EntityComparisonOperator;
import org.ofbiz.entity.condition.EntityCondition;
import org.ofbiz.entity.condition.EntityExpr;
+import org.ofbiz.entity.condition.EntityFunction;
import org.ofbiz.entity.condition.EntityJoinOperator;
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.model.ModelEntity;
@@ -2785,7 +2787,9 @@ public class PaymentGatewayServices {
try {
List<String> order = UtilMisc.toList("-transactionDate");
List<GenericValue> transactions = orderPaymentPreference.getRelated("PaymentGatewayResponse", null, order, false);
- List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("paymentServiceTypeEnumId", EntityOperator.EQUALS, CAPTURE_SERVICE_TYPE));
+ List<EntityExpr> exprs = UtilMisc.toList(
+ EntityCondition.makeCondition("paymentServiceTypeEnumId", EntityOperator.EQUALS, CAPTURE_SERVICE_TYPE) ,
+ EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("referenceNum"), EntityComparisonOperator.NOT_EQUAL, EntityFunction.UPPER("ERROR")));
List<GenericValue> capTransactions = EntityUtil.filterByAnd(transactions, exprs);
capTrans = EntityUtil.getFirst(capTransactions);
} catch (GenericEntityException e) {