[OFBiz] SVN: r6622 - trunk/applications/order/src/org/ofbiz/order/order
jaz@svn.ofbiz.org
jaz at svn.ofbiz.org
Mon Jan 30 23:56:16 CST 2006
Author: jaz
Date: 2006-01-30 23:56:14 -0600 (Mon, 30 Jan 2006)
New Revision: 6622
Modified:
trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
Log:
fixed bug in getting valid payment preference to refund
Modified: trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
===================================================================
--- trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java 2006-01-31 05:23:55 UTC (rev 6621)
+++ trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java 2006-01-31 05:56:14 UTC (rev 6622)
@@ -701,22 +701,25 @@
do {
GenericValue pref = (GenericValue) payPrefIter.next();
Double maxAmount = pref.getDouble("maxAmount");
- if (maxAmount == null || maxAmount.doubleValue() == 0.00) {
- prefsToUse.add(pref);
- prefsAmount.put(pref, orderTotal);
- neededAmount = 0.00;
- } else if (maxAmount.doubleValue() > orderTotal.doubleValue()) {
- prefsToUse.add(pref);
- prefsAmount.put(pref, orderTotal);
- neededAmount = 0.00;
- } else {
- prefsToUse.add(pref);
- if (maxAmount.doubleValue() > neededAmount) {
- prefsAmount.put(pref, new Double(maxAmount.doubleValue() - neededAmount));
+ String statusId = pref.getString("statuId");
+ if ("PAYMENT_SETTLED".equals(statusId)) {
+ if (maxAmount == null || maxAmount.doubleValue() == 0.00) {
+ prefsToUse.add(pref);
+ prefsAmount.put(pref, orderTotal);
+ neededAmount = 0.00;
+ } else if (maxAmount.doubleValue() > orderTotal.doubleValue()) {
+ prefsToUse.add(pref);
+ prefsAmount.put(pref, orderTotal);
+ neededAmount = 0.00;
} else {
- prefsAmount.put(pref, maxAmount);
+ prefsToUse.add(pref);
+ if (maxAmount.doubleValue() > neededAmount) {
+ prefsAmount.put(pref, new Double(maxAmount.doubleValue() - neededAmount));
+ } else {
+ prefsAmount.put(pref, maxAmount);
+ }
+ neededAmount -= maxAmount.doubleValue();
}
- neededAmount -= maxAmount.doubleValue();
}
} while (neededAmount > 0 && payPrefIter.hasNext());
}
@@ -772,7 +775,7 @@
Timestamp now = UtilDateTime.nowTimestamp();
// create a new response entry
- String responseId = delegator.getNextSeqId("ReturnItemResponse").toString();
+ String responseId = delegator.getNextSeqId("ReturnItemResponse");
GenericValue response = delegator.makeValue("ReturnItemResponse", UtilMisc.toMap("returnItemResponseId", responseId));
response.set("orderPaymentPreferenceId", orderPayPref.getString("orderPaymentPreferenceId"));
response.set("responseAmount", thisRefundAmount);
More information about the Svn
mailing list