svn commit: r1588858 - in /ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23: ./ applications/accounting/config/ applications/accounting/src/org/ofbiz/accounting/invoice/ applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotne...

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

svn commit: r1588858 - in /ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23: ./ applications/accounting/config/ applications/accounting/src/org/ofbiz/accounting/invoice/ applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotne...

jleroux@apache.org
Author: jleroux
Date: Mon Apr 21 08:33:26 2014
New Revision: 1588858

URL: http://svn.apache.org/r1588858
Log:
Merges trunk HEAD in SEO branch

Added:
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/lib/commons/commons-pool-1.5.7.jar
      - copied unchanged from r1588857, ofbiz/trunk/framework/base/lib/commons/commons-pool-1.5.7.jar
Removed:
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/lib/commons/commons-pool-1.3.jar
Modified:
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/   (props changed)
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/.classpath
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/LICENSE
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/config/AccountingUiLabels.xml
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/runtime/patches/   (props changed)

Propchange: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1587168-1588857

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/.classpath
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/.classpath?rev=1588858&r1=1588857&r2=1588858&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/.classpath (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/.classpath Mon Apr 21 08:33:26 2014
@@ -74,7 +74,7 @@
     <classpathentry kind="lib" path="framework/base/lib/commons/commons-logging-1.1.2.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/commons/commons-modeler-2.0.1.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/commons/commons-net-3.1.jar"/>
-    <classpathentry kind="lib" path="framework/base/lib/commons/commons-pool-1.3.jar"/>
+    <classpathentry kind="lib" path="framework/base/lib/commons/commons-pool-1.5.7.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/commons/commons-primitives-1.0.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/commons/commons-validator-1.4.0.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/commons/commons-csv-1.0.jar"/>

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/LICENSE
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/LICENSE?rev=1588858&r1=1588857&r2=1588858&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/LICENSE (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/LICENSE Mon Apr 21 08:33:26 2014
@@ -55,7 +55,7 @@ framework/base/lib/commons/commons-lang-
 framework/base/lib/commons/commons-logging-1.1.2.jar
 framework/base/lib/commons/commons-modeler-2.0.1.jar
 framework/base/lib/commons/commons-net-3.1.jar
-framework/base/lib/commons/commons-pool-1.3.jar
+framework/base/lib/commons/commons-pool-1.5.7.jar
 framework/base/lib/commons/commons-primitives-1.0.jar
 framework/base/lib/commons/commons-validator-1.4.0.jar
 framework/base/lib/j2eespecs/geronimo-activation_1.0.2_spec-1.0.jar

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/config/AccountingUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/config/AccountingUiLabels.xml?rev=1588858&r1=1588857&r2=1588858&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/config/AccountingUiLabels.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/config/AccountingUiLabels.xml Mon Apr 21 08:33:26 2014
@@ -4843,7 +4843,7 @@
         <value xml:lang="de">Problem bei der Erstellung einer Rechnung aus Auftragspositionen: ${reason} </value>
         <value xml:lang="en">Entity/data problem creating invoice from order items: ${reason} </value>
         <value xml:lang="es">Problema Entidad/datos creando factura desde orden de elmentos: ${reason}</value>
-        <value xml:lang="fr">Problème d'entité/données en créant une facture à partir des lignes de la commande: ${reason} </value>
+        <value xml:lang="fr">Problème d'entité/données lors de la création d'une facture à partir des lignes de la commande: ${reason} </value>
         <value xml:lang="hi_IN">आदेश मदो से चालान बनाने में इकाई/डाटा समस्या :${reason}</value>
         <value xml:lang="it">Entità/data problemi creazione fattura da righe ordine: ${reason} </value>
         <value xml:lang="ja">注文アイテムから請求書を作成中に、エンティティ/データの問題があります: ${reason}</value>

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=1588858&r1=1588857&r2=1588858&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Mon Apr 21 08:33:26 2014
@@ -18,10 +18,6 @@
  *******************************************************************************/
 package org.ofbiz.accounting.invoice;
 
-import org.apache.commons.csv.CSVFormat;
-import org.apache.commons.csv.CSVFormat.CSVFormatBuilder;
-import org.apache.commons.csv.CSVRecord;
-
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.StringReader;
@@ -40,6 +36,9 @@ import javolution.util.FastList;
 import javolution.util.FastMap;
 
 import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.csv.CSVFormat;
+import org.apache.commons.csv.CSVFormat.CSVFormatBuilder;
+import org.apache.commons.csv.CSVRecord;
 import org.ofbiz.accounting.payment.PaymentGatewayServices;
 import org.ofbiz.accounting.payment.PaymentWorker;
 import org.ofbiz.accounting.util.UtilAccounting;
@@ -3356,147 +3355,149 @@ public class InvoiceServices {
         final CSVFormatBuilder builder = CSVFormat.newBuilder(',').withQuoteChar('"').withHeader();
         CSVFormat fmt = builder.build();
         List<String> errMsgs = FastList.newInstance();
-     List<String> newErrMsgs = FastList.newInstance();
+        List<String> newErrMsgs = FastList.newInstance();
         String lastInvoiceId = null;
         String currentInvoiceId = null;
         String newInvoiceId = null;
         int invoicesCreated = 0;
-        
+
         if (fileBytes == null) {
-         return ServiceUtil.returnError("Uploaded file data not found");
+            return ServiceUtil.returnError("Uploaded file data not found");
         }
-        
+
         try {
-         for (final CSVRecord rec : fmt.parse(csvReader)) {
-         currentInvoiceId =  rec.get("invoiceId");
-         if (lastInvoiceId == null || !currentInvoiceId.equals(lastInvoiceId)) {
-         newInvoiceId = null;
-         Map<String, Object> invoice = UtilMisc.toMap(
-         "invoiceTypeId", rec.get("invoiceTypeId"),
-         "partyIdFrom", rec.get("partyIdFrom"),
-         "partyId", rec.get("partyId"),
-         "invoiceDate", rec.get("invoiceDate"),
-         "dueDate", rec.get("dueDate"),
-         "currencyUomId", rec.get("currencyUomId"),
-         "description", rec.get("description"),
-         "referenceNumber", rec.get("referenceNumber") + "   Imported: orginal InvoiceId: " + currentInvoiceId,
-                 "userLogin", userLogin
-                 );
-
-         // replace values if required
-         if (UtilValidate.isNotEmpty(rec.get("partyIdFromTrans"))) {
-         invoice.put("partyIdFrom", rec.get("partyIdFromTrans"));
-         }
-         if (UtilValidate.isNotEmpty(rec.get("partyIdTrans"))) {
-         invoice.put("partyId", rec.get("partyIdTrans"));
-         }
+            for (final CSVRecord rec : fmt.parse(csvReader)) {
+                currentInvoiceId =  rec.get("invoiceId");
+                if (lastInvoiceId == null || !currentInvoiceId.equals(lastInvoiceId)) {
+                    newInvoiceId = null;
+                    Map<String, Object> invoice = UtilMisc.toMap(
+                            "invoiceTypeId", rec.get("invoiceTypeId"),
+                            "partyIdFrom", rec.get("partyIdFrom"),
+                            "partyId", rec.get("partyId"),
+                            "invoiceDate", rec.get("invoiceDate"),
+                            "dueDate", rec.get("dueDate"),
+                            "currencyUomId", rec.get("currencyUomId"),
+                            "description", rec.get("description"),
+                            "referenceNumber", rec.get("referenceNumber") + "   Imported: orginal InvoiceId: " + currentInvoiceId,
+                            "userLogin", userLogin
+                            );
+
+                    // replace values if required
+                    if (UtilValidate.isNotEmpty(rec.get("partyIdFromTrans"))) {
+                        invoice.put("partyIdFrom", rec.get("partyIdFromTrans"));
+                    }
+                    if (UtilValidate.isNotEmpty(rec.get("partyIdTrans"))) {
+                        invoice.put("partyId", rec.get("partyIdTrans"));
+                    }
 
-         // invoice validation
+                    // invoice validation
                     try {
-                 newErrMsgs = FastList.newInstance();
+                        newErrMsgs = FastList.newInstance();
                         if (UtilValidate.isEmpty(invoice.get("partyIdFrom"))) {
-                         newErrMsgs.add("Line number " + rec.getRecordNumber() + ": Mandatory Party Id From and Party Id From Trans missing for invoice: " + currentInvoiceId);
+                            newErrMsgs.add("Line number " + rec.getRecordNumber() + ": Mandatory Party Id From and Party Id From Trans missing for invoice: " + currentInvoiceId);
                         } else if (delegator.findOne("Party", UtilMisc.<String, Object>toMap("partyId", invoice.get("partyIdFrom")), false) == null) {
-                         newErrMsgs.add("Line number " + rec.getRecordNumber() + ": partyIdFrom: " + invoice.get("partyIdFrom") + " not found for invoice: " + currentInvoiceId);
+                            newErrMsgs.add("Line number " + rec.getRecordNumber() + ": partyIdFrom: " + invoice.get("partyIdFrom") + " not found for invoice: " + currentInvoiceId);
                         }
                         if (UtilValidate.isEmpty(invoice.get("partyId"))) {
-                         newErrMsgs.add("Line number " + rec.getRecordNumber() + ": Mandatory Party Id and Party Id Trans missing for invoice: " + currentInvoiceId);
+                            newErrMsgs.add("Line number " + rec.getRecordNumber() + ": Mandatory Party Id and Party Id Trans missing for invoice: " + currentInvoiceId);
                         } else if (delegator.findOne("Party", UtilMisc.<String, Object>toMap("partyId", invoice.get("partyId")), false) == null) {
-                         newErrMsgs.add("Line number " + rec.getRecordNumber() + ": partyId: " + invoice.get("partyId") + " not found for invoice: " + currentInvoiceId);
+                            newErrMsgs.add("Line number " + rec.getRecordNumber() + ": partyId: " + invoice.get("partyId") + " not found for invoice: " + currentInvoiceId);
                         }
                         if (UtilValidate.isEmpty(invoice.get("invoiceTypeId"))) {
-                         newErrMsgs.add("Line number " + rec.getRecordNumber() + ": Mandatory Invoice Type missing for invoice: " + currentInvoiceId);
+                            newErrMsgs.add("Line number " + rec.getRecordNumber() + ": Mandatory Invoice Type missing for invoice: " + currentInvoiceId);
                         } else if (delegator.findOne("InvoiceType", UtilMisc.<String, Object>toMap("invoiceTypeId", invoice.get("invoiceTypeId")), false) == null) {
-                         newErrMsgs.add("Line number " + rec.getRecordNumber() + ": InvoiceItem type id: " + invoice.get("invoiceTypeId") + " not found for invoice: " + currentInvoiceId);
+                            newErrMsgs.add("Line number " + rec.getRecordNumber() + ": InvoiceItem type id: " + invoice.get("invoiceTypeId") + " not found for invoice: " + currentInvoiceId);
                         }
                         GenericValue invoiceType = delegator.findOne("InvoiceType", UtilMisc.<String, Object>toMap("invoiceTypeId", invoice.get("invoiceTypeId")), false);
                         if ("PURCHASE_INVOICE".equals(invoiceType.getString("parentTypeId")) && !invoice.get("partyId").equals(organizationPartyId)) {
-                         newErrMsgs.add("Line number " + rec.getRecordNumber() + ": A purchase type invoice should have the partyId 'To' being the organizationPartyId(=" + organizationPartyId + ")! however is " + invoice.get("partyId") +"! invoice: " + currentInvoiceId);
+                            newErrMsgs.add("Line number " + rec.getRecordNumber() + ": A purchase type invoice should have the partyId 'To' being the organizationPartyId(=" + organizationPartyId + ")! however is " + invoice.get("partyId") +"! invoice: " + currentInvoiceId);
                         }
                         if ("SALES_INVOICE".equals(invoiceType.getString("parentTypeId")) && !invoice.get("partyIdFrom").equals(organizationPartyId)) {
-                         newErrMsgs.add("Line number " + rec.getRecordNumber() + ": A sales type invoice should have the partyId 'from' being the organizationPartyId(=" + organizationPartyId + ")! however is " + invoice.get("partyIdFrom") +"! invoice: " + currentInvoiceId);
+                            newErrMsgs.add("Line number " + rec.getRecordNumber() + ": A sales type invoice should have the partyId 'from' being the organizationPartyId(=" + organizationPartyId + ")! however is " + invoice.get("partyIdFrom") +"! invoice: " + currentInvoiceId);
                         }
-                        
-                    
+
+
                     } catch (GenericEntityException e) {
                         Debug.logError("Valication checking problem against database. due to " + e.getMessage(), module);
                     }
 
                     if (newErrMsgs.size() > 0) {
-         errMsgs.addAll(newErrMsgs);
+                        errMsgs.addAll(newErrMsgs);
                     } else {
                         Map<String, Object> invoiceResult = null;
-                     try {
+                        try {
                             invoiceResult = dispatcher.runSync("createInvoice", invoice);
-                     } catch (GenericServiceException e) {
-                     Debug.logError(e, module);
-                     return ServiceUtil.returnError(e.getMessage());
-                     }
+                        } catch (GenericServiceException e) {
+                            csvReader.close();
+                            Debug.logError(e, module);
+                            return ServiceUtil.returnError(e.getMessage());
+                        }
                         newInvoiceId = (String) invoiceResult.get("invoiceId");
                         invoicesCreated++;
-         }
+                    }
                     lastInvoiceId = currentInvoiceId;
-         }
+                }
+
 
-        
-         if (newInvoiceId != null) {
-         Map<String, Object> invoiceItem = UtilMisc.toMap(
-                     "invoiceId", newInvoiceId,
-                     "invoiceItemSeqId", rec.get("invoiceItemSeqId"),
-                     "invoiceItemTypeId", rec.get("invoiceItemTypeId"),
-                     "productId", rec.get("productId"),
-                     "description", rec.get("itemDescription"),
-                     "amount", rec.get("amount"),
-                     "quantity", rec.get("quantity"),
-                     "userLogin", userLogin
-                     );
-
-         if (UtilValidate.isNotEmpty(rec.get("productIdTrans"))) {
-         invoiceItem.put("productId", rec.get("productIdTrans"));
-         }
-         // invoice item validation
+                if (newInvoiceId != null) {
+                    Map<String, Object> invoiceItem = UtilMisc.toMap(
+                            "invoiceId", newInvoiceId,
+                            "invoiceItemSeqId", rec.get("invoiceItemSeqId"),
+                            "invoiceItemTypeId", rec.get("invoiceItemTypeId"),
+                            "productId", rec.get("productId"),
+                            "description", rec.get("itemDescription"),
+                            "amount", rec.get("amount"),
+                            "quantity", rec.get("quantity"),
+                            "userLogin", userLogin
+                            );
+
+                    if (UtilValidate.isNotEmpty(rec.get("productIdTrans"))) {
+                        invoiceItem.put("productId", rec.get("productIdTrans"));
+                    }
+                    // invoice item validation
                     try {
-                 newErrMsgs = FastList.newInstance();
+                        newErrMsgs = FastList.newInstance();
                         if (UtilValidate.isEmpty(invoiceItem.get("invoiceItemSeqId"))) {
-                         newErrMsgs.add("Line number " + rec.getRecordNumber() + ": Mandatory item sequence Id missing for invoice: " + currentInvoiceId);
+                            newErrMsgs.add("Line number " + rec.getRecordNumber() + ": Mandatory item sequence Id missing for invoice: " + currentInvoiceId);
                         }
                         if (UtilValidate.isEmpty(invoiceItem.get("invoiceItemTypeId"))) {
-                         newErrMsgs.add("Line number " + rec.getRecordNumber() + ": Mandatory invoice item type missing for invoice: " + currentInvoiceId);
+                            newErrMsgs.add("Line number " + rec.getRecordNumber() + ": Mandatory invoice item type missing for invoice: " + currentInvoiceId);
                         } else if (delegator.findOne("InvoiceItemType", UtilMisc.<String, Object>toMap("invoiceItemTypeId", invoiceItem.get("invoiceItemTypeId")), false) == null) {
-                         newErrMsgs.add("Line number " + rec.getRecordNumber() + ": InvoiceItem Item type id: " + invoiceItem.get("invoiceItemTypeId") + " not found for invoice: " + currentInvoiceId + " Item seqId:" + invoiceItem.get("invoiceItemSeqId"));
+                            newErrMsgs.add("Line number " + rec.getRecordNumber() + ": InvoiceItem Item type id: " + invoiceItem.get("invoiceItemTypeId") + " not found for invoice: " + currentInvoiceId + " Item seqId:" + invoiceItem.get("invoiceItemSeqId"));
                         }
                         if (UtilValidate.isEmpty(invoiceItem.get("productId")) && UtilValidate.isEmpty(invoiceItem.get("description"))) {
                         }                    
                         if (UtilValidate.isNotEmpty(invoiceItem.get("productId")) && delegator.findOne("Product", UtilMisc.<String, Object>toMap("productId", invoiceItem.get("productId")), false) == null) {
-                         newErrMsgs.add("Line number " + rec.getRecordNumber() + ": Product Id: " + invoiceItem.get("productId") + " not found for invoice: " + currentInvoiceId + " Item seqId:" + invoiceItem.get("invoiceItemSeqId"));
+                            newErrMsgs.add("Line number " + rec.getRecordNumber() + ": Product Id: " + invoiceItem.get("productId") + " not found for invoice: " + currentInvoiceId + " Item seqId:" + invoiceItem.get("invoiceItemSeqId"));
                         }
                         if (UtilValidate.isEmpty(invoiceItem.get("amount")) && UtilValidate.isEmpty(invoiceItem.get("quantity"))) {
-                         newErrMsgs.add("Line number " + rec.getRecordNumber() + ": Either or both quantity and amount is required for invoice: " + currentInvoiceId + " Item seqId:" + invoiceItem.get("invoiceItemSeqId"));
+                            newErrMsgs.add("Line number " + rec.getRecordNumber() + ": Either or both quantity and amount is required for invoice: " + currentInvoiceId + " Item seqId:" + invoiceItem.get("invoiceItemSeqId"));
                         }                    
                     } catch (GenericEntityException e) {
                         Debug.logError("Validation checking problem against database. due to " + e.getMessage(), module);
                     }
 
                     if (newErrMsgs.size() > 0) {
-         errMsgs.addAll(newErrMsgs);
+                        errMsgs.addAll(newErrMsgs);
                     } else {
-             try {
-             dispatcher.runSync("createInvoiceItem", invoiceItem);
-             } catch (GenericServiceException e) {
-             Debug.logError(e, module);
-             return ServiceUtil.returnError(e.getMessage());
-             }
-         }
-         }
-         }
-            
+                        try {
+                            dispatcher.runSync("createInvoiceItem", invoiceItem);
+                        } catch (GenericServiceException e) {
+                            csvReader.close();
+                            Debug.logError(e, module);
+                            return ServiceUtil.returnError(e.getMessage());
+                        }
+                    }
+                }
+            }
+
         } catch (IOException e) {
             Debug.logError(e, module);
             return ServiceUtil.returnError(e.getMessage());
         }
-        
+
         if (errMsgs.size() > 0) {
-         return ServiceUtil.returnError(errMsgs);
+            return ServiceUtil.returnError(errMsgs);
         }
 
         Map<String, Object> result = ServiceUtil.returnSuccess(invoicesCreated + " new invoice(s) created");

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java?rev=1588858&r1=1588857&r2=1588858&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java Mon Apr 21 08:33:26 2014
@@ -642,21 +642,28 @@ public class AIMPaymentServices {
 
     private static void processAuthTransResult(Map<String, Object> request, Map<String, Object> reply, Map<String, Object> results) {
         AuthorizeResponse ar = (AuthorizeResponse) reply.get("authorizeResponse");
-        Boolean authResult = (Boolean) reply.get("authResult");
-        results.put("authResult", new Boolean(authResult.booleanValue()));
-        results.put("authFlag", ar.getReasonCode());
-        results.put("authMessage", ar.getReasonText());
-        if (authResult.booleanValue()) { //passed
-            results.put("authCode", ar.getAuthorizationCode());
-            results.put("authRefNum", ar.getTransactionId());
-            results.put("cvCode", ar.getCvResult());
-            results.put("avsCode", ar.getAvsResult());
-            if (BigDecimal.ZERO.compareTo(ar.getAmount()) == 0) {
-                results.put("processAmount", getXAmount(request));
+        try {
+            Boolean authResult = (Boolean) reply.get("authResult");
+            results.put("authResult", new Boolean(authResult.booleanValue()));
+            results.put("authFlag", ar.getReasonCode());
+            results.put("authMessage", ar.getReasonText());
+            if (authResult.booleanValue()) { //passed
+                results.put("authCode", ar.getAuthorizationCode());
+                results.put("authRefNum", ar.getTransactionId());
+                results.put("cvCode", ar.getCvResult());
+                results.put("avsCode", ar.getAvsResult());
+                if (BigDecimal.ZERO.compareTo(ar.getAmount()) == 0) {
+                    results.put("processAmount", getXAmount(request));
+                } else {
+                    results.put("processAmount", ar.getAmount());
+                }
             } else {
-                results.put("processAmount", ar.getAmount());
+                results.put("authCode", ar.getResponseCode());
+                results.put("processAmount", BigDecimal.ZERO);
+                results.put("authRefNum", AuthorizeResponse.ERROR);
             }
-        } else {
+        } catch (Exception ex) {
+            Debug.logError(ex, module);
             results.put("authCode", ar.getResponseCode());
             results.put("processAmount", BigDecimal.ZERO);
             results.put("authRefNum", AuthorizeResponse.ERROR);
@@ -666,40 +673,50 @@ public class AIMPaymentServices {
 
     private static void processCaptureTransResult(Map<String, Object> request, Map<String, Object> reply, Map<String, Object> results) {
         AuthorizeResponse ar = (AuthorizeResponse) reply.get("authorizeResponse");
-        Boolean captureResult = (Boolean) reply.get("authResult");
-        results.put("captureResult", new Boolean(captureResult.booleanValue()));
-        results.put("captureFlag", ar.getReasonCode());
-        results.put("captureMessage", ar.getReasonText());
-        results.put("captureRefNum", ar.getTransactionId());
-        if (captureResult.booleanValue()) { //passed
-            results.put("captureCode", ar.getAuthorizationCode());
-            if (BigDecimal.ZERO.compareTo(ar.getAmount()) == 0) {
-                results.put("captureAmount", getXAmount(request));
+        try {
+            Boolean captureResult = (Boolean) reply.get("authResult");
+            results.put("captureResult", new Boolean(captureResult.booleanValue()));
+            results.put("captureFlag", ar.getReasonCode());
+            results.put("captureMessage", ar.getReasonText());
+            results.put("captureRefNum", ar.getTransactionId());
+            if (captureResult.booleanValue()) { //passed
+                results.put("captureCode", ar.getAuthorizationCode());
+                if (BigDecimal.ZERO.compareTo(ar.getAmount()) == 0) {
+                    results.put("captureAmount", getXAmount(request));
+                } else {
+                    results.put("captureAmount", ar.getAmount());
+                }
             } else {
-                results.put("captureAmount", ar.getAmount());
+                results.put("captureAmount", BigDecimal.ZERO);
             }
-        } else {
+        } catch (Exception ex) {
+            Debug.logError(ex, module);
             results.put("captureAmount", BigDecimal.ZERO);
         }
-        Debug.logInfo("processCaptureTransResult: " + results.toString(),module);
+        Debug.logInfo("captureRefNum: " + results.toString(),module);
     }
 
     private static Map<String, Object> processRefundTransResult(Map<String, Object> request, Map<String, Object> reply) {
         Map<String, Object> results = FastMap.newInstance();
         AuthorizeResponse ar = (AuthorizeResponse) reply.get("authorizeResponse");
-        Boolean captureResult = (Boolean) reply.get("authResult");
-        results.put("refundResult", new Boolean(captureResult.booleanValue()));
-        results.put("refundFlag", ar.getReasonCode());
-        results.put("refundMessage", ar.getReasonText());
-        results.put("refundRefNum", ar.getTransactionId());
-        if (captureResult.booleanValue()) { //passed
-            results.put("refundCode", ar.getAuthorizationCode());
-            if (BigDecimal.ZERO.compareTo(ar.getAmount()) == 0) {
-                results.put("refundAmount", getXAmount(request));
+        try {
+            Boolean captureResult = (Boolean) reply.get("authResult");
+            results.put("refundResult", new Boolean(captureResult.booleanValue()));
+            results.put("refundFlag", ar.getReasonCode());
+            results.put("refundMessage", ar.getReasonText());
+            results.put("refundRefNum", ar.getTransactionId());
+            if (captureResult.booleanValue()) { //passed
+                results.put("refundCode", ar.getAuthorizationCode());
+                if (BigDecimal.ZERO.compareTo(ar.getAmount()) == 0) {
+                    results.put("refundAmount", getXAmount(request));
+                } else {
+                    results.put("refundAmount", ar.getAmount());
+                }
             } else {
-                results.put("refundAmount", ar.getAmount());
+                results.put("refundAmount", BigDecimal.ZERO);
             }
-        } else {
+        } catch (Exception ex) {
+            Debug.logError(ex, module);
             results.put("refundAmount", BigDecimal.ZERO);
         }
         Debug.logInfo("processRefundTransResult: " + results.toString(),module);
@@ -709,19 +726,24 @@ public class AIMPaymentServices {
     private static Map<String, Object> processReleaseTransResult(Map<String, Object> request, Map<String, Object> reply) {
         Map<String, Object> results = FastMap.newInstance();
         AuthorizeResponse ar = (AuthorizeResponse) reply.get("authorizeResponse");
-        Boolean captureResult = (Boolean) reply.get("authResult");
-        results.put("releaseResult", new Boolean(captureResult.booleanValue()));
-        results.put("releaseFlag", ar.getReasonCode());
-        results.put("releaseMessage", ar.getReasonText());
-        results.put("releaseRefNum", ar.getTransactionId());
-        if (captureResult.booleanValue()) { //passed
-            results.put("releaseCode", ar.getAuthorizationCode());
-            if (BigDecimal.ZERO.compareTo(ar.getAmount()) == 0) {
-                results.put("releaseAmount", getXAmount(request));
+        try {
+            Boolean captureResult = (Boolean) reply.get("authResult");
+            results.put("releaseResult", new Boolean(captureResult.booleanValue()));
+            results.put("releaseFlag", ar.getReasonCode());
+            results.put("releaseMessage", ar.getReasonText());
+            results.put("releaseRefNum", ar.getTransactionId());
+            if (captureResult.booleanValue()) { //passed
+                results.put("releaseCode", ar.getAuthorizationCode());
+                if (BigDecimal.ZERO.compareTo(ar.getAmount()) == 0) {
+                    results.put("releaseAmount", getXAmount(request));
+                } else {
+                    results.put("releaseAmount", ar.getAmount());
+                }
             } else {
-                results.put("releaseAmount", ar.getAmount());
+                results.put("releaseAmount", BigDecimal.ZERO);
             }
-        } else {
+        } catch (Exception ex) {
+            Debug.logError(ex, module);
             results.put("releaseAmount", BigDecimal.ZERO);
         }
         Debug.logInfo("processReleaseTransResult: " + results.toString(),module);
@@ -730,6 +752,7 @@ public class AIMPaymentServices {
 
     private static void processAuthCaptureTransResult(Map<String, Object> request, Map<String, Object> reply, Map<String, Object> results) {
         AuthorizeResponse ar = (AuthorizeResponse) reply.get("authorizeResponse");
+        try {
         Boolean authResult = (Boolean) reply.get("authResult");
         results.put("authResult", new Boolean(authResult.booleanValue()));
         results.put("authFlag", ar.getReasonCode());
@@ -753,6 +776,12 @@ public class AIMPaymentServices {
             results.put("processAmount", BigDecimal.ZERO);
             results.put("authRefNum", AuthorizeResponse.ERROR);
         }
+        } catch (Exception ex) {
+            Debug.logError(ex, module);
+            results.put("authCode", ar.getResponseCode());
+            results.put("processAmount", BigDecimal.ZERO);
+            results.put("authRefNum", AuthorizeResponse.ERROR);
+        }
         Debug.logInfo("processAuthTransResult: " + results.toString(),module);
     }
 

Propchange: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/runtime/patches/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Apr 21 08:33:26 2014
@@ -0,0 +1 @@
+*