svn commit: r523517 - in /ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount: FinAccountPaymentServices.java FinAccountServices.java

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

svn commit: r523517 - in /ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount: FinAccountPaymentServices.java FinAccountServices.java

jaz-3
Author: jaz
Date: Wed Mar 28 17:28:40 2007
New Revision: 523517

URL: http://svn.apache.org/viewvc?view=rev&rev=523517
Log:
added call to replenish from auth service; used when account is frozen; note replenish service will not run if not configured, regardless of how it is called

Modified:
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java?view=diff&rev=523517&r1=523516&r2=523517
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java Wed Mar 28 17:28:40 2007
@@ -132,15 +132,29 @@
             // check for account being frozen
             String isFrozen = finAccount.getString("isFrozen");
             if (isFrozen != null && "Y".equals(isFrozen)) {
-                Map result = ServiceUtil.returnSuccess();
-                result.put("authMessage", "Account is currently frozen");
-                result.put("authResult", Boolean.FALSE);
-                result.put("processAmount", amount);
-                result.put("authFlag", "0");
-                result.put("authCode", "A");
-                result.put("authRefNum", "0");
-                Debug.logError("Unable to auth FinAccount: " + result, module);
-                return result;
+                // try to call replenish
+                try {
+                    dispatcher.runSync("finAccountReplenish", UtilMisc.toMap("finAccountId",
+                            finAccountId, "productStoreId", productStoreId, "userLogin", userLogin));
+                } catch (GenericServiceException e) {
+                    Debug.logWarning(e.getMessage(), module);
+                }
+
+                // refresh the finaccount
+                finAccount.refresh();
+                isFrozen = finAccount.getString("isFrozen");
+
+                if (isFrozen != null && "Y".equals(isFrozen)) {
+                    Map result = ServiceUtil.returnSuccess();
+                    result.put("authMessage", "Account is currently frozen");
+                    result.put("authResult", Boolean.FALSE);
+                    result.put("processAmount", amount);
+                    result.put("authFlag", "0");
+                    result.put("authCode", "A");
+                    result.put("authRefNum", "0");
+                    Debug.logError("Unable to auth FinAccount: " + result, module);
+                    return result;
+                }
             }
 
             // check for expiration date

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java?view=diff&rev=523517&r1=523516&r2=523517
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java Wed Mar 28 17:28:40 2007
@@ -186,5 +186,5 @@
         }
 
         return ServiceUtil.returnSuccess();
-    }
+    }        
 }