[OFBiz] SVN: r7486 - trunk/applications/accounting/src/org/ofbiz/accounting/payment

sichen@svn.ofbiz.org sichen at svn.ofbiz.org
Tue May 2 11:27:34 CDT 2006


Author: sichen
Date: 2006-05-02 11:27:31 -0500 (Tue, 02 May 2006)
New Revision: 7486

Modified:
   trunk/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java
Log:
Improve error message and prevent fulfillment record from being created when gift card purchase fails

Modified: trunk/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java
===================================================================
--- trunk/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java	2006-05-02 15:47:32 UTC (rev 7485)
+++ trunk/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java	2006-05-02 16:27:31 UTC (rev 7486)
@@ -770,8 +770,11 @@
                 createGcResult = dispatcher.runSync("createGiftCertificate", createGcCtx);
             } catch (GenericServiceException e) {
                 Debug.logError(e, module);
-                return ServiceUtil.returnError("Unable to create gift certificate!");
+                return ServiceUtil.returnError("Unable to create gift certificate: " + e.getMessage());
             }
+            if (ServiceUtil.isError(createGcResult)) {
+                return ServiceUtil.returnError("Create Gift Certificate Failed: " + ServiceUtil.getErrorMessage(createGcResult));
+            }
 
             // create the fulfillment record
             Map gcFulFill = new HashMap();
@@ -790,13 +793,9 @@
                 dispatcher.runAsync("createGcFulFillmentRecord", gcFulFill, true);
             } catch (GenericServiceException e) {
                 Debug.logError(e, module);
-                return ServiceUtil.returnError("Unable to store fulfillment info");
+                return ServiceUtil.returnError("Unable to store fulfillment info: " + e.getMessage());
             }
 
-            if (ServiceUtil.isError(createGcResult)) {
-                return ServiceUtil.returnError("Create Gift Certificate Failed!");
-            }
-
             // add some information to the answerMap for the email
             answerMap.put("cardNumber", createGcResult.get("cardNumber"));
             answerMap.put("pinNumber", createGcResult.get("pinNumber"));



More information about the Svn mailing list