svn commit: r538680 - /ofbiz/trunk/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: r538680 - /ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java

jaz-3
Author: jaz
Date: Wed May 16 11:50:29 2007
New Revision: 538680

URL: http://svn.apache.org/viewvc?view=rev&rev=538680
Log:
error messages >255 characters where causing serious rollback issues; now trimming these messages to fit the field

Modified:
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?view=diff&rev=538680&r1=538679&r2=538680
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Wed May 16 11:50:29 2007
@@ -1505,6 +1505,10 @@
 
         String responseId = delegator.getNextSeqId("PaymentGatewayResponse");
         GenericValue response = delegator.makeValue("PaymentGatewayResponse", null);
+        String message = ServiceUtil.getErrorMessage(result);
+        if (message.length() > 255) {
+            message = message.substring(0, 255);
+        }
         response.set("paymentGatewayResponseId", responseId);
         response.set("paymentServiceTypeEnumId", serviceType);
         response.set("orderPaymentPreferenceId", paymentPref.get("orderPaymentPreferenceId"));
@@ -1512,7 +1516,7 @@
         response.set("paymentMethodId", paymentPref.get("paymentMethodId"));
         response.set("transCodeEnumId", transactionCode);
         response.set("referenceNum", "ERROR");
-        response.set("gatewayMessage", ServiceUtil.getErrorMessage(result));
+        response.set("gatewayMessage", message);
         response.set("transactionDate", UtilDateTime.nowTimestamp());
 
         try {
@@ -2513,6 +2517,10 @@
     public static Map savePaymentGatewayResponse(DispatchContext dctx, Map context) {
         GenericDelegator delegator = dctx.getDelegator();
         GenericValue pgr = (GenericValue) context.get("paymentGatewayResponse");
+        String message = pgr.getString("gatewayMessage");
+        if (message.length() > 255) {
+            pgr.set("gatewayMessage", message.substring(0, 255));
+        }
 
         try {
             delegator.create(pgr);