svn commit: r540051 - /ofbiz/branches/release4.0/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r540051 - /ofbiz/branches/release4.0/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java

lektran
Author: lektran
Date: Mon May 21 00:49:16 2007
New Revision: 540051

URL: http://svn.apache.org/viewvc?view=rev&rev=540051
Log:
Applied fix from trunk for revision: 536137

Modified:
    ofbiz/branches/release4.0/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java

Modified: ofbiz/branches/release4.0/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?view=diff&rev=540051&r1=540050&r2=540051
==============================================================================
--- ofbiz/branches/release4.0/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
+++ ofbiz/branches/release4.0/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Mon May 21 00:49:16 2007
@@ -807,7 +807,9 @@
             Map releaseResRes;
             try {
                 ModelService model = dctx.getModelService("processReleaseResult");
-                Map resCtx = model.makeValid(result, ModelService.IN_PARAM);
+                releaseResult.put("orderPaymentPreference", paymentPref);
+                releaseResult.put("userLogin", userLogin);
+                Map resCtx = model.makeValid(releaseResult, ModelService.IN_PARAM);
                 releaseResRes = dispatcher.runSync(model.name,  resCtx);
             } catch (GenericServiceException e) {
                 Debug.logError(e, module);
@@ -1018,7 +1020,16 @@
         }
 
         OrderReadHelper orh = new OrderReadHelper(orderHeader);
-        
+
+        BigDecimal orderGrandTotal = orh.getOrderGrandTotalBd();
+        orderGrandTotal = orderGrandTotal.setScale(2, BigDecimal.ROUND_HALF_UP);
+
+        BigDecimal totalPayments = PaymentWorker.getPaymentsTotal(orh.getOrderPayments());
+        totalPayments = totalPayments.setScale(2, BigDecimal.ROUND_HALF_UP);
+
+        BigDecimal remainingTotalBd = orderGrandTotal.subtract(totalPayments);
+        if (Debug.infoOn()) Debug.logInfo("Capture Remaining Total: " + remainingTotalBd, module);
+
         // See if there is a billing account first.  If so, just charge the captureAmount to the billing account via PaymentApplication
         GenericValue billingAccount = null;
         BigDecimal billingAccountAvail = null;
@@ -1079,15 +1090,6 @@
             return result;
         }
 
-        BigDecimal orderGrandTotal = orh.getOrderGrandTotalBd();
-        orderGrandTotal = orderGrandTotal.setScale(2, BigDecimal.ROUND_HALF_UP);
-
-        BigDecimal totalPayments = PaymentWorker.getPaymentsTotal(orh.getOrderPayments());
-        totalPayments = totalPayments.setScale(2, BigDecimal.ROUND_HALF_UP);
-
-        BigDecimal remainingTotalBd = orderGrandTotal.subtract(totalPayments);
-        if (Debug.infoOn()) Debug.logInfo("Capture Remaining Total: " + remainingTotalBd, module);
-
         BigDecimal amountToCapture = ZERO;
         if (captureAmountBd == null) {
             amountToCapture = remainingTotalBd;
@@ -2117,6 +2119,10 @@
                     refundResCtx.put("currencyUomId", orh.getCurrency());
                     refundResCtx.put("payToPartyId", payToPartyId);
                     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"));
                     refundResRes = dispatcher.runSync(model.name, refundResCtx);
                 } catch (GenericServiceException e) {
                     Debug.logError(e, module);