Author: jacopoc
Date: Thu May 17 06:16:19 2007 New Revision: 538904 URL: http://svn.apache.org/viewvc?view=rev&rev=538904 Log: Misc code cleanups, no functional changes. Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java?view=diff&rev=538904&r1=538903&r2=538904 ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Thu May 17 06:16:19 2007 @@ -896,8 +896,6 @@ } String customerPartyId = cart.getPartyId(); - List paymentMethodIds = cart.getPaymentMethodIds(); - List paymentMethodTypeIds = cart.getPaymentMethodTypeIds(); String[] processOrder = {"customer", "shipping", "shipGroups", "options", "term", "payment", "addparty", "paysplit"}; @@ -942,6 +940,8 @@ } } else if (currProcess.equals("payment")) { + List paymentMethodIds = cart.getPaymentMethodIds(); + List paymentMethodTypeIds = cart.getPaymentMethodTypeIds(); if (requirePayment && (paymentMethodIds == null || paymentMethodIds.size() == 0) && (paymentMethodTypeIds == null || paymentMethodTypeIds.size() == 0)) { return "payment"; } Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?view=diff&rev=538904&r1=538903&r2=538904 ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Thu May 17 06:16:19 2007 @@ -841,9 +841,6 @@ double orderTotal = this.cart.getGrandTotal(); String orderId = this.cart.getOrderId(); - // Get the paymentMethodTypeIds - this will need to change when ecom supports multiple payments - List paymentMethodTypeIds = this.cart.getPaymentMethodTypeIds(); - // Check the payment preferences; if we have ANY w/ status PAYMENT_NOT_AUTH invoke payment service. boolean requireAuth = false; List allPaymentPreferences = null; @@ -1014,43 +1011,47 @@ return ServiceUtil.returnError(ERROR_MESSAGE); } } - } else if (paymentMethodTypeIds.contains("CASH") || paymentMethodTypeIds.contains("EXT_COD") || paymentMethodTypeIds.contains("EXT_BILLACT")) { - boolean hasOther = false; - // TODO: this is set but not checked anywhere - boolean validAmount = false; - - Iterator pmti = paymentMethodTypeIds.iterator(); - while (pmti.hasNext()) { - String type = (String) pmti.next(); - if (!"CASH".equals(type) && !"EXT_COD".equals(type) && !"EXT_BILLACT".equals(type)) { - hasOther = true; - break; + } else { + // Get the paymentMethodTypeIds - this will need to change when ecom supports multiple payments + List paymentMethodTypeIds = this.cart.getPaymentMethodTypeIds(); + if (paymentMethodTypeIds.contains("CASH") || paymentMethodTypeIds.contains("EXT_COD") || paymentMethodTypeIds.contains("EXT_BILLACT")) { + boolean hasOther = false; + // TODO: this is set but not checked anywhere + boolean validAmount = false; + + Iterator pmti = paymentMethodTypeIds.iterator(); + while (pmti.hasNext()) { + String type = (String) pmti.next(); + if (!"CASH".equals(type) && !"EXT_COD".equals(type) && !"EXT_BILLACT".equals(type)) { + hasOther = true; + break; + } } - } - if (!hasOther) { - if (!paymentMethodTypeIds.contains("CASH") && !paymentMethodTypeIds.contains("EXT_COD")) { - // only billing account, make sure we have enough to cover - String billingAccountId = cart.getBillingAccountId(); - double billAcctCredit = this.availableAccountBalance(billingAccountId); - double billingAcctAmt = cart.getBillingAccountAmount(); - if (billAcctCredit >= billingAcctAmt) { - if (cart.getGrandTotal() > billAcctCredit) { - validAmount = false; - } else { - validAmount = true; + if (!hasOther) { + if (!paymentMethodTypeIds.contains("CASH") && !paymentMethodTypeIds.contains("EXT_COD")) { + // only billing account, make sure we have enough to cover + String billingAccountId = cart.getBillingAccountId(); + double billAcctCredit = this.availableAccountBalance(billingAccountId); + double billingAcctAmt = cart.getBillingAccountAmount(); + if (billAcctCredit >= billingAcctAmt) { + if (cart.getGrandTotal() > billAcctCredit) { + validAmount = false; + } else { + validAmount = true; + } } } - } - // approve this as long as there are only COD and Billing Account types - boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold); - if (!ok) { - throw new GeneralException("Problem with order change; see above error"); + // approve this as long as there are only COD and Billing Account types + boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold); + if (!ok) { + throw new GeneralException("Problem with order change; see above error"); + } } + } else { + // There is nothing to do, we just treat this as a success } - } else { - // There is nothing to do, we just treat this as a success } // check to see if we should auto-invoice/bill |
Free forum by Nabble | Edit this page |