You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by si...@apache.org on 2006/08/24 00:38:34 UTC
svn commit: r434229 -
/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
Author: sichen
Date: Wed Aug 23 15:38:33 2006
New Revision: 434229
URL: http://svn.apache.org/viewvc?rev=434229&view=rev
Log:
Replaced a bunch of tabs with spaces for these new OrderReadHelper methods.
Modified:
incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=434229&r1=434228&r2=434229&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
+++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Wed Aug 23 15:38:33 2006
@@ -186,37 +186,37 @@
* Returns a Map of paymentMethodId -> amount charged (Double) based on PaymentGatewayResponse.
* @return
*/
- public Map getReceivedPaymentTotalsByPaymentMethod() {
- Map paymentMethodAmounts = new HashMap();
- List paymentPrefs = getPaymentPreferences();
- Iterator ppit = paymentPrefs.iterator();
- while (ppit.hasNext()) {
- GenericValue paymentPref = (GenericValue) ppit.next();
- List paymentGatewayResponses = new ArrayList();
- try {
- paymentGatewayResponses = paymentPref.getRelatedByAnd("PaymentGatewayResponse", UtilMisc.toMap("paymentServiceTypeEnumId","PRDS_PAY_CAPTURE"));
- } catch (GenericEntityException e) {
+ public Map getReceivedPaymentTotalsByPaymentMethod() {
+ Map paymentMethodAmounts = new HashMap();
+ List paymentPrefs = getPaymentPreferences();
+ Iterator ppit = paymentPrefs.iterator();
+ while (ppit.hasNext()) {
+ GenericValue paymentPref = (GenericValue) ppit.next();
+ List paymentGatewayResponses = new ArrayList();
+ try {
+ paymentGatewayResponses = paymentPref.getRelatedByAnd("PaymentGatewayResponse", UtilMisc.toMap("paymentServiceTypeEnumId","PRDS_PAY_CAPTURE"));
+ } catch (GenericEntityException e) {
Debug.logError(e, module);
- }
-
- BigDecimal chargedToPaymentPref = ZERO;
- Iterator pgrit = paymentGatewayResponses.iterator();
+ }
+
+ BigDecimal chargedToPaymentPref = ZERO;
+ Iterator pgrit = paymentGatewayResponses.iterator();
while(pgrit.hasNext()) {
- GenericValue paymentGatewayResponse = (GenericValue) pgrit.next();
- if (paymentGatewayResponse.get("amount") != null) {
- chargedToPaymentPref = chargedToPaymentPref.add(paymentGatewayResponse.getBigDecimal("amount")).setScale(scale+1, rounding);
- }
+ GenericValue paymentGatewayResponse = (GenericValue) pgrit.next();
+ if (paymentGatewayResponse.get("amount") != null) {
+ chargedToPaymentPref = chargedToPaymentPref.add(paymentGatewayResponse.getBigDecimal("amount")).setScale(scale+1, rounding);
+ }
}
-
+
// if chargedToPaymentPref > 0
if (chargedToPaymentPref.compareTo(ZERO) == 1) {
// key of the resulting map is paymentMethodId or paymentMethodTypeId if the paymentMethodId is not available
String paymentMethodKey = paymentPref.getString("paymentMethodId") != null ? paymentPref.getString("paymentMethodId") : paymentPref.getString("paymentMethodTypeId");
paymentMethodAmounts.put(paymentMethodKey, new Double(chargedToPaymentPref.setScale(scale, rounding).doubleValue()));
}
- }
+ }
return paymentMethodAmounts;
- }
+ }
/**
* Returns a Map of paymentMethodId -> amount refunded
@@ -224,10 +224,10 @@
*/
public Map getReturnedTotalsByPaymentMethod() {
Map paymentMethodAmounts = new HashMap();
- List paymentPrefs = getPaymentPreferences();
- Iterator ppit = paymentPrefs.iterator();
- while (ppit.hasNext()) {
- GenericValue paymentPref = (GenericValue) ppit.next();
+ List paymentPrefs = getPaymentPreferences();
+ Iterator ppit = paymentPrefs.iterator();
+ while (ppit.hasNext()) {
+ GenericValue paymentPref = (GenericValue) ppit.next();
List returnItemResponses = new ArrayList();
try {
returnItemResponses = orderHeader.getDelegator().findByAnd("ReturnItemResponse", UtilMisc.toMap("orderPaymentPreferenceId", paymentPref.getString("orderPaymentPreferenceId")));
@@ -240,7 +240,7 @@
GenericValue returnItemResponse = (GenericValue) ririt.next();
refundedToPaymentPref = refundedToPaymentPref.add(returnItemResponse.getBigDecimal("responseAmount")).setScale(scale+1, rounding);
}
-
+
// if refundedToPaymentPref > 0
if (refundedToPaymentPref.compareTo(ZERO) == 1) {
String paymentMethodId = paymentPref.getString("paymentMethodId") != null ? paymentPref.getString("paymentMethodId") : paymentPref.getString("paymentMethodTypeId");
@@ -249,7 +249,7 @@
}
return paymentMethodAmounts;
}
-
+
public List getOrderPayments() {
return getOrderPayments(null);
}