svn commit: r554544 - /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: r554544 - /ofbiz/branches/release4.0/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java

lektran
Author: lektran
Date: Mon Jul  9 00:22:34 2007
New Revision: 554544

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

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=554544&r1=554543&r2=554544
==============================================================================
--- 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 Jul  9 00:22:34 2007
@@ -1063,11 +1063,6 @@
                 // If we have an invoice, we find unapplied payments associated
                 // to the billing account and we apply them to the invoice
                 if (UtilValidate.isNotEmpty(invoiceId)) {
-                    // TODO: jacopo continue from here...
-                    // cercare le paymentapplication non applicate e associate al billing account e il cui
-                    // pagamento non abbia una orderPaymentPreferenceId
-                    // creare nuova payment application fino a raggiungere l'importo necessario o fino ad esaurimento
-                    // e associarle alla fattura; se la fattura non esiste, non fare nulla
                     Map captureResult = null;
                     try {
                         captureResult = dispatcher.runSync("captureBillingAccountPayments", UtilMisc.toMap("invoiceId", invoiceId,
@@ -1856,25 +1851,23 @@
         BigDecimal amtBd = new BigDecimal(amount.doubleValue());
         amtBd = amtBd.setScale(decimals, rounding);
 
-        if (captureResult.booleanValue()) {
-            // capture returned true (passed)
-            result.put("orderPaymentPreference", paymentPreference);
-            result.put("userLogin", userLogin);
-            result.put("serviceTypeEnum", authServiceType);
-
-            ModelService model = dctx.getModelService("processCaptureResult");
-            Map context = model.makeValid(result, ModelService.IN_PARAM);
-            Map capRes;
-            try {
-                capRes = dispatcher.runSync("processCaptureResult", context);
-            } catch (GenericServiceException e) {
-                Debug.logError(e, module);
-                throw e;
-            }
-            if (capRes != null && ServiceUtil.isError(capRes)) {
-                throw new GeneralException(ServiceUtil.getErrorMessage(capRes));
-            }
-        } else {
+        result.put("orderPaymentPreference", paymentPreference);
+        result.put("userLogin", userLogin);
+        result.put("serviceTypeEnum", authServiceType);
+
+        ModelService model = dctx.getModelService("processCaptureResult");
+        Map context = model.makeValid(result, ModelService.IN_PARAM);
+        Map capRes;
+        try {
+            capRes = dispatcher.runSync("processCaptureResult", context);
+        } catch (GenericServiceException e) {
+            Debug.logError(e, module);
+            throw e;
+        }
+        if (capRes != null && ServiceUtil.isError(capRes)) {
+            throw new GeneralException(ServiceUtil.getErrorMessage(capRes));
+        }
+        if (!captureResult.booleanValue()) {
             // capture returned false (error)
             try {
                 processReAuthFromCaptureFailure(dctx, result, amtBd, userLogin, paymentPreference);
@@ -2735,7 +2728,7 @@
 
 
     /**
-     * Simple test processor; declines all orders < 100.00; approves all orders > 100.00
+     * Simple test processor; declines all orders < 100.00; approves all orders >= 100.00
      */
     public static Map testProcessor(DispatchContext dctx, Map context) {
         Map result = new HashMap();