Author: sichen
Date: Wed Nov 14 17:39:56 2007
New Revision: 595179
URL: http://svn.apache.org/viewvc?rev=595179&view=rev
Log:
Fix problem in refund processing where the actual refund amount as specified by
the gateway services might be different than what the system asks for. As an
example, consider where the refund has to void the entire original auth amount,
then re-authorize the new order total.
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=595179&r1=595178&r2=595179&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 Nov 14 17:39:56 2007
@@ -2233,8 +2233,15 @@
refundResCtx.put("payFromPartyId", payFromPartyId);
refundResCtx.put("refundRefNum",
refundResponse.get("refundRefNum"));
refundResCtx.put("refundResult",
refundResponse.get("refundResult"));
- // TODO: should we uncomment the following line?
- //refundResCtx.put("refundAmount",
(Double)refundResponse.get("refundAmount"));
+
+ // The refund amount could be different from what we tell
the payment gateway due to issues
+ // such as having to void the entire original auth amount
and re-authorize the new order total.
+ // However, since some legacy services might be
non-compliant, so as a safety measure we will
+ // override the original refund amount if the refund
response has a positive value
+ Double actualRefundAmount = (Double)
refundResponse.get("refundAmount");
+ if (actualRefundAmount != null &&
actualRefundAmount.doubleValue() > 0) {
+ refundResCtx.put("refundAmount",
refundResponse.get("refundAmount"));
+ }
refundResRes = dispatcher.runSync(model.name,
refundResCtx);
} catch (GenericServiceException e) {
Debug.logError(e, module);