svn commit: r602998 - in /ofbiz/trunk/applications: accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java order/data/OrderTypeData.xml

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

svn commit: r602998 - in /ofbiz/trunk/applications: accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java order/data/OrderTypeData.xml

sichen
Author: sichen
Date: Mon Dec 10 11:12:16 2007
New Revision: 602998

URL: http://svn.apache.org/viewvc?rev=602998&view=rev
Log:
Add payment refunded status for order payment prefs.  Mark refunded prefs with this status, which fixes a bug where system would attempt to release them if the order was cancelled.  This also displays that the pref is a Refund on orderview, which is more sensible than displaying 'Settled'.

Modified:
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
    ofbiz/trunk/applications/order/data/OrderTypeData.xml

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=602998&r1=602997&r2=602998&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 Mon Dec 10 11:12:16 2007
@@ -2309,10 +2309,18 @@
             }
         }
 
-        // handle the (reverse) payment
         Boolean refundResult = (Boolean) context.get("refundResult");
         if (refundResult != null && refundResult.booleanValue()) {
-            // create a payment record
+
+            // mark the preference as refunded
+            paymentPref.set("statusId", "PAYMENT_REFUNDED");
+            try {
+                paymentPref.store();
+            } catch (GenericEntityException e) {
+                Debug.logError(e, module);
+            }
+
+            // handle the (reverse) payment
             Map paymentCtx = UtilMisc.toMap("paymentTypeId", "CUSTOMER_REFUND");
             paymentCtx.put("paymentMethodTypeId", paymentPref.get("paymentMethodTypeId"));
             paymentCtx.put("paymentMethodId", paymentPref.get("paymentMethodId"));

Modified: ofbiz/trunk/applications/order/data/OrderTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/data/OrderTypeData.xml?rev=602998&r1=602997&r2=602998&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/data/OrderTypeData.xml (original)
+++ ofbiz/trunk/applications/order/data/OrderTypeData.xml Mon Dec 10 11:12:16 2007
@@ -147,6 +147,7 @@
     <StatusItem description="Authorized" sequenceId="02" statusCode="AUTHORIZED" statusId="PAYMENT_AUTHORIZED" statusTypeId="PAYMENT_PREF_STATUS"/>
     <StatusItem description="Settled" sequenceId="03" statusCode="SETTLED" statusId="PAYMENT_SETTLED" statusTypeId="PAYMENT_PREF_STATUS"/>
     <StatusItem description="Declined" sequenceId="04" statusCode="DECLINED" statusId="PAYMENT_DECLINED" statusTypeId="PAYMENT_PREF_STATUS"/>
+    <StatusItem description="Refunded" sequenceId="05" statusCode="REFUNDED" statusId="PAYMENT_REFUNDED" statusTypeId="PAYMENT_PREF_STATUS"/>
     <StatusItem description="Cancelled" sequenceId="99" statusCode="CANCELLED" statusId="PAYMENT_CANCELLED" statusTypeId="PAYMENT_PREF_STATUS"/>
     <StatusValidChange condition="" statusId="PAYMENT_NOT_RECEIVED" statusIdTo="PAYMENT_RECEIVED" transitionName="Payment Received"/>
     <StatusValidChange condition="" statusId="PAYMENT_NOT_RECEIVED" statusIdTo="PAYMENT_CANCELLED" transitionName="Payment Cancelled"/>
@@ -154,6 +155,7 @@
     <StatusValidChange condition="" statusId="PAYMENT_NOT_AUTH" statusIdTo="PAYMENT_CANCELLED" transitionName="Payment Cancelled"/>
     <StatusValidChange condition="" statusId="PAYMENT_AUTHORIZED" statusIdTo="PAYMENT_SETTLED" transitionName="Payment Settled"/>
     <StatusValidChange condition="" statusId="PAYMENT_AUTHORIZED" statusIdTo="PAYMENT_CANCELLED" transitionName="Payment Cancelled"/>
+    <StatusValidChange condition="" statusId="PAYMENT_SETTLED" statusIdTo="PAYMENT_REFUNDED" transitionName="Payment Refunded"/>
 
     <!-- order delivery schedule status -->
     <StatusType description="Order Delivery Schedule" hasTable="N" parentTypeId="" statusTypeId="ORDER_DEL_SCH"/>