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

sichen
Author: sichen
Date: Wed Dec 12 17:01:46 2007
New Revision: 603794

URL: http://svn.apache.org/viewvc?rev=603794&view=rev
Log:
Cosmetic fix for OrderPaymentPreference:  When captures are deeclined, set the status to PAYMENT_DECLINED.  This makes more sense when looking at the results on orderview.  Previously, it wasn't even checking if the capture was declined or not and always setting them to Settled or Received, which is erroneous.

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?rev=603794&r1=603793&r2=603794&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Wed Dec 12 17:01:46 2007
@@ -1989,7 +1989,8 @@
         Double amount = (Double) context.get("captureAmount");
         String serviceType = (String) context.get("serviceTypeEnum");
         String currencyUomId = (String) context.get("currencyUomId");
-        
+        boolean captureSuccessful = ((Boolean) context.get("captureResult")).booleanValue();
+
         String paymentMethodTypeId = paymentPreference.getString("paymentMethodTypeId");
 
         if (UtilValidate.isEmpty(serviceType)) {
@@ -2005,7 +2006,13 @@
         }
 
         // update the status and maxAmount
-        paymentPreference.set("statusId", ("EXT_BILLACT".equals(paymentMethodTypeId)? "PAYMENT_RECEIVED": "PAYMENT_SETTLED"));
+        String prefStatusId;
+        if (captureSuccessful) {
+            prefStatusId = "EXT_BILLACT".equals(paymentMethodTypeId) ? "PAYMENT_RECEIVED": "PAYMENT_SETTLED";
+        } else {
+            prefStatusId = "PAYMENT_DECLINED";
+        }
+        paymentPreference.set("statusId", prefStatusId);
         paymentPreference.set("maxAmount", amount);
         try {
             paymentPreference.store();