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/04/26 19:02:14 UTC

svn commit: r532804 - in /ofbiz/trunk/applications: accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java order/src/org/ofbiz/order/order/OrderReturnServices.java

Author: sichen
Date: Thu Apr 26 10:02:13 2007
New Revision: 532804

URL: http://svn.apache.org/viewvc?view=rev&rev=532804
Log:
Returning failure instead of error from the refundPayment service to support extensions to OFBIZ-459 - a failed CC refund will not cause the entire refund process to return an error, but instead cascade to the 'filler' payment correctly.

Modified:
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.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?view=diff&rev=532804&r1=532803&r2=532804
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Thu Apr 26 10:02:13 2007
@@ -2115,7 +2115,7 @@
                     result.put("paymentId", paymentId);
                     return result;
                 } else {
-                    return ServiceUtil.returnError("The refund failed");
+                    return ServiceUtil.returnFailure("The refund failed");
                 }
             } else {
                 return ServiceUtil.returnError("No refund service defined");

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?view=diff&rev=532804&r1=532803&r2=532804
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Thu Apr 26 10:02:13 2007
@@ -959,8 +959,9 @@
                                 try {
                                     // for electronic types such as CREDIT_CARD and EFT_ACCOUNT, use refundPayment service
                                     serviceResult = dispatcher.runSync("refundPayment", UtilMisc.toMap("orderPaymentPreference", orderPaymentPreference, "refundAmount", new Double(amountToRefund.setScale(decimals, rounding).doubleValue()), "userLogin", userLogin));
-                                    if (ServiceUtil.isError(serviceResult)) {
-                                        return ServiceUtil.returnError("Error in refund payment", null, null, serviceResult);
+                                    if (ServiceUtil.isError(serviceResult) || ServiceUtil.isFailure(serviceResult)) {
+                                        Debug.logError("Error in refund payment: " + ServiceUtil.getErrorMessage(serviceResult), module);
+                                        continue;
                                     }
                                     paymentId = (String) serviceResult.get("paymentId");
                                 } catch (GenericServiceException e) {
@@ -971,8 +972,9 @@
                                 try {
                                     // for Billing Account refunds
                                     serviceResult = dispatcher.runSync("refundBillingAccountPayment", UtilMisc.toMap("orderPaymentPreference", orderPaymentPreference, "refundAmount", new Double(amountToRefund.setScale(decimals, rounding).doubleValue()), "userLogin", userLogin));
-                                    if (ServiceUtil.isError(serviceResult)) {
-                                        return ServiceUtil.returnError("Error in refund payment", null, null, serviceResult);
+                                    if (ServiceUtil.isError(serviceResult) || ServiceUtil.isFailure(serviceResult)) {
+                                        Debug.logError("Error in refund payment: " + ServiceUtil.getErrorMessage(serviceResult), module);
+                                        continue;
                                     }
                                     paymentId = (String) serviceResult.get("paymentId");
                                 } catch (GenericServiceException e) {