Author: ashish
Date: Tue Jun 16 14:35:48 2009 New Revision: 785232 URL: http://svn.apache.org/viewvc?rev=785232&view=rev Log: Applied patch from jira issue OFBIZ-2503 (If order paid through Billing Account refund return response currently does nothing) Thanks Santosh for your initial work on this and Divesh for finalizing this work. Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=785232&r1=785231&r2=785232&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Tue Jun 16 14:35:48 2009 @@ -218,6 +218,12 @@ EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_CONFIRMED")); payments = paymentPref.getRelated("Payment"); payments = EntityUtil.filterByOr(payments, exprs); + List conds = UtilMisc.toList(EntityCondition.makeCondition("paymentTypeId", EntityOperator.EQUALS, "CUSTOMER_PAYMENT"), + EntityCondition.makeCondition("paymentTypeId", EntityOperator.EQUALS, "CUSTOMER_DEPOSIT"), + EntityCondition.makeCondition("paymentTypeId", EntityOperator.EQUALS, "INTEREST_RECEIPT"), + EntityCondition.makeCondition("paymentTypeId", EntityOperator.EQUALS, "GC_DEPOSIT"), + EntityCondition.makeCondition("paymentTypeId", EntityOperator.EQUALS, "POS_PAID_IN")); + payments = EntityUtil.filterByOr(payments, conds); } catch (GenericEntityException e) { Debug.logError(e, module); } Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?rev=785232&r1=785231&r2=785232&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Tue Jun 16 14:35:48 2009 @@ -1177,6 +1177,11 @@ // We break the OPPs down this way because we need to process the refunds to payment methods in a particular order Map receivedPaymentTotalsByPaymentMethod = orderReadHelper.getReceivedPaymentTotalsByPaymentMethod() ; Map refundedTotalsByPaymentMethod = orderReadHelper.getReturnedTotalsByPaymentMethod() ; + + // getOrderPaymentPreferenceTotalByType has been called because getReceivedPaymentTotalsByPaymentMethod does not + // return payments captured from Billing Account.This is because when payment is captured from Billing Account + // then no entry is maintained in Payment entity. + BigDecimal receivedPaymentTotalsByBillingAccount = orderReadHelper.getOrderPaymentPreferenceTotalByType("EXT_BILLACT"); /* * Go through the OrderPaymentPreferences and determine how much remains to be refunded for each. @@ -1195,6 +1200,10 @@ if (receivedPaymentTotalsByPaymentMethod.containsKey(orderPayPrefKey)) { orderPayPrefReceivedTotal = orderPayPrefReceivedTotal.add((BigDecimal)receivedPaymentTotalsByPaymentMethod.get(orderPayPrefKey)).setScale(decimals, rounding); } + + if (receivedPaymentTotalsByBillingAccount != null) { + orderPayPrefReceivedTotal = orderPayPrefReceivedTotal.add(receivedPaymentTotalsByBillingAccount); + } BigDecimal orderPayPrefRefundedTotal = ZERO; if (refundedTotalsByPaymentMethod.containsKey(orderPayPrefKey)) { orderPayPrefRefundedTotal = orderPayPrefRefundedTotal.add((BigDecimal)refundedTotalsByPaymentMethod.get(orderPayPrefKey)).setScale(decimals, rounding); |
Free forum by Nabble | Edit this page |