Class OrderReadHelper


  • public class OrderReadHelper
    extends java.lang.Object
    Utility class for easily extracting important information from orders

    NOTE: in the current scheme order adjustments are never included in tax or shipping, but order item adjustments ARE included in tax and shipping calcs unless they are tax or shipping adjustments or the includeInTax or includeInShipping are set to N.

    • Field Detail

      • module

        public static final java.lang.String module
      • scale

        public static final int scale
      • rounding

        public static final java.math.RoundingMode rounding
      • taxCalcScale

        public static final int taxCalcScale
      • taxFinalScale

        public static final int taxFinalScale
      • taxRounding

        public static final java.math.RoundingMode taxRounding
      • ZERO

        public static final java.math.BigDecimal ZERO
      • percentage

        public static final java.math.BigDecimal percentage
      • orderItemAndShipGrp

        protected java.util.List<GenericValue> orderItemAndShipGrp
      • orderItems

        protected java.util.List<GenericValue> orderItems
      • adjustments

        protected java.util.List<GenericValue> adjustments
      • paymentPrefs

        protected java.util.List<GenericValue> paymentPrefs
      • orderStatuses

        protected java.util.List<GenericValue> orderStatuses
      • orderItemPriceInfos

        protected java.util.List<GenericValue> orderItemPriceInfos
      • orderItemShipGrpInvResList

        protected java.util.List<GenericValue> orderItemShipGrpInvResList
      • orderItemIssuances

        protected java.util.List<GenericValue> orderItemIssuances
      • orderReturnItems

        protected java.util.List<GenericValue> orderReturnItems
      • totalPrice

        protected java.math.BigDecimal totalPrice
    • Constructor Detail

      • OrderReadHelper

        protected OrderReadHelper()
      • OrderReadHelper

        public OrderReadHelper​(GenericValue orderHeader)
      • OrderReadHelper

        public OrderReadHelper​(java.util.List<GenericValue> adjustments,
                               java.util.List<GenericValue> orderItems)
      • OrderReadHelper

        public OrderReadHelper​(Delegator delegator,
                               java.lang.String orderId)
    • Method Detail

      • getOrderId

        public java.lang.String getOrderId()
      • getWebSiteId

        public java.lang.String getWebSiteId()
      • getProductStoreId

        public java.lang.String getProductStoreId()
      • getProductStore

        public GenericValue getProductStore()
        Returns the ProductStore of this Order or null in case of Exception
      • getOrderTypeId

        public java.lang.String getOrderTypeId()
      • getCurrency

        public java.lang.String getCurrency()
      • getOrderName

        public java.lang.String getOrderName()
      • getAdjustments

        public java.util.List<GenericValue> getAdjustments()
      • getPaymentPreferences

        public java.util.List<GenericValue> getPaymentPreferences()
      • getReceivedPaymentTotalsByPaymentMethod

        public java.util.Map<java.lang.String,​java.math.BigDecimal> getReceivedPaymentTotalsByPaymentMethod()
        Returns a Map of paymentMethodId -> amount charged (BigDecimal) based on PaymentGatewayResponse.
        Returns:
        returns a Map of paymentMethodId -> amount charged (BigDecimal) based on PaymentGatewayResponse.
      • getReturnedTotalsByPaymentMethod

        public java.util.Map<java.lang.String,​java.math.BigDecimal> getReturnedTotalsByPaymentMethod()
        Returns a Map of paymentMethodId -> amount refunded
        Returns:
        returns a Map of paymentMethodId -> amount refunded
      • getOrderPayments

        public java.util.List<GenericValue> getOrderPayments()
      • getOrderStatuses

        public java.util.List<GenericValue> getOrderStatuses()
      • getOrderTerms

        public java.util.List<GenericValue> getOrderTerms()
      • getOrderTermNetDays

        public java.lang.Long getOrderTermNetDays()
        Return the number of days from termDays of first FIN_PAYMENT_TERM
        Returns:
        number of days from termDays of first FIN_PAYMENT_TERM
      • getShippingMethod

        public java.lang.String getShippingMethod​(java.lang.String shipGroupSeqId)
      • getShippingMethodCode

        public java.lang.String getShippingMethodCode​(java.lang.String shipGroupSeqId)
      • hasShippingAddress

        public boolean hasShippingAddress()
      • getOrderItemShipGroup

        public GenericValue getOrderItemShipGroup​(java.lang.String shipGroupSeqId)
      • getOrderItemShipGroups

        public java.util.List<GenericValue> getOrderItemShipGroups()
      • getShippingLocations

        public java.util.List<GenericValue> getShippingLocations()
      • getShippingAddress

        public GenericValue getShippingAddress​(java.lang.String shipGroupSeqId)
      • getShippingAddress

        @Deprecated
        public GenericValue getShippingAddress()
        Deprecated.
      • getBillingLocations

        public java.util.List<GenericValue> getBillingLocations()
      • getBillingAddress

        @Deprecated
        public GenericValue getBillingAddress()
        Deprecated.
      • getOrderContactMechs

        public java.util.List<GenericValue> getOrderContactMechs​(java.lang.String purposeTypeId)
      • getEarliestShipByDate

        public java.sql.Timestamp getEarliestShipByDate()
      • getLatestShipAfterDate

        public java.sql.Timestamp getLatestShipAfterDate()
      • getCurrentStatusString

        public java.lang.String getCurrentStatusString()
      • getStatusString

        public java.lang.String getStatusString​(java.util.Locale locale)
      • getBillingAccount

        public GenericValue getBillingAccount()
      • getBillingAccountMaxAmount

        public java.math.BigDecimal getBillingAccountMaxAmount()
        Returns the OrderPaymentPreference.maxAmount for the billing account associated with the order, or 0 if there is no billing account or no max amount set
      • getBillToParty

        public GenericValue getBillToParty()
        Returns party from OrderRole of BILL_TO_CUSTOMER
      • getBillFromParty

        public GenericValue getBillFromParty()
        Returns party from OrderRole of BILL_FROM_VENDOR
      • getShipToParty

        public GenericValue getShipToParty()
        Returns party from OrderRole of SHIP_TO_CUSTOMER
      • getPlacingParty

        public GenericValue getPlacingParty()
        Returns party from OrderRole of PLACING_CUSTOMER
      • getEndUserParty

        public GenericValue getEndUserParty()
        Returns party from OrderRole of END_USER_CUSTOMER
      • getSupplierAgent

        public GenericValue getSupplierAgent()
        Returns party from OrderRole of SUPPLIER_AGENT
      • getPartyFromRole

        public GenericValue getPartyFromRole​(java.lang.String roleTypeId)
      • getDistributorId

        public java.lang.String getDistributorId()
      • getAffiliateId

        public java.lang.String getAffiliateId()
      • getShippingTotal

        public java.math.BigDecimal getShippingTotal()
      • getHeaderTaxTotal

        public java.math.BigDecimal getHeaderTaxTotal()
      • getTaxTotal

        public java.math.BigDecimal getTaxTotal()
      • getItemFeatureSet

        public java.util.Set<java.lang.String> getItemFeatureSet​(GenericValue item)
      • getFeatureIdQtyMap

        public java.util.Map<java.lang.String,​java.math.BigDecimal> getFeatureIdQtyMap​(java.lang.String shipGroupSeqId)
      • shippingApplies

        public boolean shippingApplies()
      • taxApplies

        public boolean taxApplies()
      • getShippableTotal

        public java.math.BigDecimal getShippableTotal​(java.lang.String shipGroupSeqId)
      • getShippableQuantity

        public java.math.BigDecimal getShippableQuantity()
      • getShippableQuantity

        public java.math.BigDecimal getShippableQuantity​(java.lang.String shipGroupSeqId)
      • getShippableWeight

        public java.math.BigDecimal getShippableWeight​(java.lang.String shipGroupSeqId)
      • getItemWeight

        public java.math.BigDecimal getItemWeight​(GenericValue item)
      • getShippableSizes

        public java.util.List<java.math.BigDecimal> getShippableSizes()
      • getOrderPaymentPreferenceTotalByType

        public java.math.BigDecimal getOrderPaymentPreferenceTotalByType​(java.lang.String paymentMethodTypeId)
        Get the total payment preference amount by payment type. Specify null to get amount for all preference types. TODO: filter by status as well?
      • getCreditCardPaymentPreferenceTotal

        public java.math.BigDecimal getCreditCardPaymentPreferenceTotal()
      • getBillingAccountPaymentPreferenceTotal

        public java.math.BigDecimal getBillingAccountPaymentPreferenceTotal()
      • getGiftCardPaymentPreferenceTotal

        public java.math.BigDecimal getGiftCardPaymentPreferenceTotal()
      • getOrderPaymentReceivedTotalByType

        public java.math.BigDecimal getOrderPaymentReceivedTotalByType​(java.lang.String paymentMethodTypeId)
        Get the total payment received amount by payment type. Specify null to get amount over all types. This method works by going through all the PaymentAndApplications for all order Invoices that have status PMNT_RECEIVED.
      • getItemSize

        public java.math.BigDecimal getItemSize​(GenericValue item)
      • getItemPiecesIncluded

        public long getItemPiecesIncluded​(GenericValue item)
      • getShippableItemInfo

        public java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getShippableItemInfo​(java.lang.String shipGroupSeqId)
      • getItemInfoMap

        public java.util.Map<java.lang.String,​java.lang.Object> getItemInfoMap​(GenericValue item)
      • getOrderEmailString

        public java.lang.String getOrderEmailString()
      • getOrderGrandTotal

        public java.math.BigDecimal getOrderGrandTotal()
      • getOrderOpenAmount

        public java.math.BigDecimal getOrderOpenAmount()
                                                throws GenericEntityException
        Gets the amount open on the order that is not covered by the relevant OrderPaymentPreferences. This works by adding up the amount allocated to each unprocessed OrderPaymentPreference and the amounts received and refunded as payments for the settled ones.
        Throws:
        GenericEntityException
      • getOrderHeaderAdjustments

        public java.util.List<GenericValue> getOrderHeaderAdjustments()
      • getOrderHeaderAdjustments

        public java.util.List<GenericValue> getOrderHeaderAdjustments​(java.lang.String shipGroupSeqId)
      • getOrderHeaderAdjustmentsTax

        public java.util.List<GenericValue> getOrderHeaderAdjustmentsTax​(java.lang.String shipGroupSeqId)
      • getOrderHeaderAdjustmentsToShow

        public java.util.List<GenericValue> getOrderHeaderAdjustmentsToShow()
      • getOrderHeaderStatuses

        public java.util.List<GenericValue> getOrderHeaderStatuses()
      • getOrderAdjustmentsTotal

        public java.math.BigDecimal getOrderAdjustmentsTotal()
      • getOrderAdjustmentTotal

        public java.math.BigDecimal getOrderAdjustmentTotal​(GenericValue adjustment)
      • hasSurvey

        public int hasSurvey()
      • getOrderItems

        public java.util.List<GenericValue> getOrderItems()
      • getOrderItemAndShipGroupAssoc

        public java.util.List<GenericValue> getOrderItemAndShipGroupAssoc()
      • getOrderItemAndShipGroupAssoc

        public java.util.List<GenericValue> getOrderItemAndShipGroupAssoc​(java.lang.String shipGroupSeqId)
      • getValidOrderItems

        public java.util.List<GenericValue> getValidOrderItems()
      • getPastEtaOrderItems

        public boolean getPastEtaOrderItems​(java.lang.String orderId)
      • getRejectedOrderItems

        public boolean getRejectedOrderItems()
      • getPartiallyReceivedItems

        public boolean getPartiallyReceivedItems()
      • getValidOrderItems

        public java.util.List<GenericValue> getValidOrderItems​(java.lang.String shipGroupSeqId)
      • getOrderItem

        public GenericValue getOrderItem​(java.lang.String orderItemSeqId)
      • getValidDigitalItems

        public java.util.List<GenericValue> getValidDigitalItems()
      • getCurrentOrderItemWorkEffort

        public java.lang.String getCurrentOrderItemWorkEffort​(GenericValue orderItem)
      • getCurrentItemStatus

        public java.lang.String getCurrentItemStatus​(GenericValue orderItem)
      • getOrderItemShipGroupAssocs

        public java.util.List<GenericValue> getOrderItemShipGroupAssocs​(GenericValue orderItem)
      • getOrderItemShipGrpInvResList

        public java.util.List<GenericValue> getOrderItemShipGrpInvResList​(GenericValue orderItem)
      • getOrderItemIssuances

        public java.util.List<GenericValue> getOrderItemIssuances​(GenericValue orderItem,
                                                                  java.lang.String shipmentId)
      • getOrderProductIds

        public java.util.Collection<java.lang.String> getOrderProductIds()
        Get a set of productIds in the order.
      • getOrderReturnItems

        public java.util.List<GenericValue> getOrderReturnItems()
      • getOrderItemReturnedQuantities

        public java.util.Map<java.lang.String,​java.math.BigDecimal> getOrderItemReturnedQuantities()
        Get the quantity returned per order item. In other words, this method will count the ReturnItems related to each OrderItem.
        Returns:
        Map of returned quantities as BigDecimals keyed to the orderItemSeqId
      • getOrderReturnedQuantity

        public java.math.BigDecimal getOrderReturnedQuantity()
        Get the total quantity of returned items for an order. This will count only the ReturnItems that are directly correlated to an OrderItem.
      • getOrderReturnedTotalByTypeBd

        public java.math.BigDecimal getOrderReturnedTotalByTypeBd​(java.lang.String returnTypeId,
                                                                  boolean includeAll)
        Get the returned total by return type (credit, refund, etc.). Specify returnTypeId = null to get sum over all return types. Specify includeAll = true to sum up over all return statuses except cancelled. Specify includeAll = false to sum up over ACCEPTED,RECEIVED And COMPLETED returns.
      • getOrderReturnedCreditTotalBd

        public java.math.BigDecimal getOrderReturnedCreditTotalBd()
        Gets the total return credit for COMPLETED and RECEIVED returns.
      • getOrderReturnedRefundTotalBd

        public java.math.BigDecimal getOrderReturnedRefundTotalBd()
        Gets the total return refunded for COMPLETED and RECEIVED returns.
      • getOrderReturnedTotal

        public java.math.BigDecimal getOrderReturnedTotal()
        Gets the total return amount (all return types) for COMPLETED and RECEIVED returns.
      • getOrderReturnedTotal

        public java.math.BigDecimal getOrderReturnedTotal​(boolean includeAll)
        Gets the total returned over all return types. Specify true to include all return statuses except cancelled. Specify false to include only COMPLETED and RECEIVED returns.
      • getOrderNonReturnedTaxAndShipping

        public java.math.BigDecimal getOrderNonReturnedTaxAndShipping()
      • getBillingAccountReturnedTotalByTypeBd

        public java.math.BigDecimal getBillingAccountReturnedTotalByTypeBd​(java.lang.String returnTypeId)
        Gets the total refunded to the order billing account by type. Specify null to get total over all types.
      • getBillingAccountReturnedCreditTotalBd

        public java.math.BigDecimal getBillingAccountReturnedCreditTotalBd()
        Get the total return credited to the order billing accounts
      • getBillingAccountReturnedRefundTotalBd

        public java.math.BigDecimal getBillingAccountReturnedRefundTotalBd()
        Get the total return refunded to the order billing accounts
      • getReturnedCreditTotalWithBillingAccountBd

        public java.math.BigDecimal getReturnedCreditTotalWithBillingAccountBd()
        Gets the total return credited amount with refunds and credits to the billing account figured in
      • getReturnedRefundTotalWithBillingAccountBd

        public java.math.BigDecimal getReturnedRefundTotalWithBillingAccountBd()
        Gets the total return refund amount with refunds and credits to the billing account figured in
      • getOrderBackorderQuantity

        public java.math.BigDecimal getOrderBackorderQuantity()
      • getItemPickedQuantityBd

        public java.math.BigDecimal getItemPickedQuantityBd​(GenericValue orderItem)
      • getItemShippedQuantity

        public java.math.BigDecimal getItemShippedQuantity​(GenericValue orderItem)
      • getItemShipGroupAssocShippedQuantity

        public java.math.BigDecimal getItemShipGroupAssocShippedQuantity​(GenericValue orderItem,
                                                                         java.lang.String shipGroupSeqId)
      • getItemReservedQuantity

        public java.math.BigDecimal getItemReservedQuantity​(GenericValue orderItem)
      • getItemBackorderedQuantity

        public java.math.BigDecimal getItemBackorderedQuantity​(GenericValue orderItem)
      • getItemPendingShipmentQuantity

        public java.math.BigDecimal getItemPendingShipmentQuantity​(GenericValue orderItem)
      • getItemCanceledQuantity

        public java.math.BigDecimal getItemCanceledQuantity​(GenericValue orderItem)
      • getTotalOrderItemsQuantity

        public java.math.BigDecimal getTotalOrderItemsQuantity()
      • getTotalOrderItemsOrderedQuantity

        public java.math.BigDecimal getTotalOrderItemsOrderedQuantity()
      • getOrderItemsSubTotal

        public java.math.BigDecimal getOrderItemsSubTotal()
      • getOrderItemSubTotal

        public java.math.BigDecimal getOrderItemSubTotal​(GenericValue orderItem)
      • getOrderItemsTotal

        public java.math.BigDecimal getOrderItemsTotal()
      • getOrderItemTotal

        public java.math.BigDecimal getOrderItemTotal​(GenericValue orderItem)
      • getOrderItemTax

        public java.math.BigDecimal getOrderItemTax​(GenericValue orderItem)
      • getOrderItemShipping

        public java.math.BigDecimal getOrderItemShipping​(GenericValue orderItem)
      • getOrderItemAdjustmentsTotal

        public java.math.BigDecimal getOrderItemAdjustmentsTotal​(GenericValue orderItem,
                                                                 boolean includeOther,
                                                                 boolean includeTax,
                                                                 boolean includeShipping)
      • getOrderItemAdjustmentsTotal

        public java.math.BigDecimal getOrderItemAdjustmentsTotal​(GenericValue orderItem)
      • getOrderItemAdjustmentTotal

        public java.math.BigDecimal getOrderItemAdjustmentTotal​(GenericValue orderItem,
                                                                GenericValue adjustment)
      • getAdjustmentType

        public java.lang.String getAdjustmentType​(GenericValue adjustment)
      • getCurrentItemStatusString

        public java.lang.String getCurrentItemStatusString​(GenericValue orderItem)
      • getOrderItemsByCondition

        public java.util.List<GenericValue> getOrderItemsByCondition​(EntityCondition entityCondition)
        Fetches the set of order items with the given EntityCondition.
      • getProductPromoCodesEntered

        public java.util.Set<java.lang.String> getProductPromoCodesEntered()
      • getProductPromoUse

        public java.util.List<GenericValue> getProductPromoUse()
      • hasPermission

        public boolean hasPermission​(Security security,
                                     GenericValue userLogin)
        Checks to see if this user has read permission on this order
        Parameters:
        userLogin - The UserLogin value object to check
        Returns:
        boolean True if we have read permission
      • getOrderHeader

        public GenericValue getOrderHeader()
        Getter for property orderHeader.
        Returns:
        Value of property orderHeader.
      • getOrderHeader

        public static GenericValue getOrderHeader​(Delegator delegator,
                                                  java.lang.String orderId)
      • getOrderItemQuantity

        public static java.math.BigDecimal getOrderItemQuantity​(GenericValue orderItem)
      • getOrderItemShipGroupQuantity

        public static java.math.BigDecimal getOrderItemShipGroupQuantity​(GenericValue shipGroupAssoc)
      • getProductStoreFromOrder

        public static GenericValue getProductStoreFromOrder​(Delegator delegator,
                                                            java.lang.String orderId)
      • getOrderGrandTotal

        public static java.math.BigDecimal getOrderGrandTotal​(java.util.List<GenericValue> orderItems,
                                                              java.util.List<GenericValue> adjustments)
      • getOrderHeaderAdjustments

        public static java.util.List<GenericValue> getOrderHeaderAdjustments​(java.util.List<GenericValue> adjustments,
                                                                             java.lang.String shipGroupSeqId)
      • getOrderHeaderStatuses

        public static java.util.List<GenericValue> getOrderHeaderStatuses​(java.util.List<GenericValue> orderStatuses)
      • getOrderAdjustmentsTotal

        public static java.math.BigDecimal getOrderAdjustmentsTotal​(java.util.List<GenericValue> orderItems,
                                                                    java.util.List<GenericValue> adjustments)
      • getOrderSurveyResponses

        public static java.util.List<GenericValue> getOrderSurveyResponses​(GenericValue orderHeader)
      • getOrderItemSurveyResponse

        public static java.util.List<GenericValue> getOrderItemSurveyResponse​(GenericValue orderItem)
      • calcOrderAdjustments

        public static java.math.BigDecimal calcOrderAdjustments​(java.util.List<GenericValue> orderHeaderAdjustments,
                                                                java.math.BigDecimal subTotal,
                                                                boolean includeOther,
                                                                boolean includeTax,
                                                                boolean includeShipping)
      • calcOrderAdjustment

        public static java.math.BigDecimal calcOrderAdjustment​(GenericValue orderAdjustment,
                                                               java.math.BigDecimal orderSubTotal)
      • getOrderItemsSubTotal

        public static java.math.BigDecimal getOrderItemsSubTotal​(java.util.List<GenericValue> orderItems,
                                                                 java.util.List<GenericValue> adjustments)
      • getOrderItemsSubTotal

        public static java.math.BigDecimal getOrderItemsSubTotal​(java.util.List<GenericValue> orderItems,
                                                                 java.util.List<GenericValue> adjustments,
                                                                 java.util.List<GenericValue> workEfforts)
      • getOrderItemSubTotal

        public static java.math.BigDecimal getOrderItemSubTotal​(GenericValue orderItem,
                                                                java.util.List<GenericValue> adjustments)
        The passed adjustments can be all adjustments for the order, ie for all line items
      • getOrderItemSubTotal

        public static java.math.BigDecimal getOrderItemSubTotal​(GenericValue orderItem,
                                                                java.util.List<GenericValue> adjustments,
                                                                boolean forTax,
                                                                boolean forShipping)
        The passed adjustments can be all adjustments for the order, ie for all line items
      • getOrderItemsTotal

        public static java.math.BigDecimal getOrderItemsTotal​(java.util.List<GenericValue> orderItems,
                                                              java.util.List<GenericValue> adjustments)
      • getOrderItemTotal

        public static java.math.BigDecimal getOrderItemTotal​(GenericValue orderItem,
                                                             java.util.List<GenericValue> adjustments)
      • calcOrderPromoAdjustmentsBd

        public static java.math.BigDecimal calcOrderPromoAdjustmentsBd​(java.util.List<GenericValue> allOrderAdjustments)
      • getWorkEffortRentalLength

        public static java.math.BigDecimal getWorkEffortRentalLength​(GenericValue workEffort)
      • getWorkEffortRentalQuantity

        public static java.math.BigDecimal getWorkEffortRentalQuantity​(GenericValue workEffort)
      • getAllOrderItemsAdjustmentsTotal

        public static java.math.BigDecimal getAllOrderItemsAdjustmentsTotal​(java.util.List<GenericValue> orderItems,
                                                                            java.util.List<GenericValue> adjustments,
                                                                            boolean includeOther,
                                                                            boolean includeTax,
                                                                            boolean includeShipping)
      • getOrderItemAdjustmentsTotal

        public static java.math.BigDecimal getOrderItemAdjustmentsTotal​(GenericValue orderItem,
                                                                        java.util.List<GenericValue> adjustments,
                                                                        boolean includeOther,
                                                                        boolean includeTax,
                                                                        boolean includeShipping)
        The passed adjustments can be all adjustments for the order, ie for all line items
      • getOrderItemAdjustmentsTotal

        public static java.math.BigDecimal getOrderItemAdjustmentsTotal​(GenericValue orderItem,
                                                                        java.util.List<GenericValue> adjustments,
                                                                        boolean includeOther,
                                                                        boolean includeTax,
                                                                        boolean includeShipping,
                                                                        boolean forTax,
                                                                        boolean forShipping)
        The passed adjustments can be all adjustments for the order, ie for all line items
      • calcItemAdjustments

        public static java.math.BigDecimal calcItemAdjustments​(java.math.BigDecimal quantity,
                                                               java.math.BigDecimal unitPrice,
                                                               java.util.List<GenericValue> adjustments,
                                                               boolean includeOther,
                                                               boolean includeTax,
                                                               boolean includeShipping,
                                                               boolean forTax,
                                                               boolean forShipping)
      • calcItemAdjustmentsRecurringBd

        public static java.math.BigDecimal calcItemAdjustmentsRecurringBd​(java.math.BigDecimal quantity,
                                                                          java.math.BigDecimal unitPrice,
                                                                          java.util.List<GenericValue> adjustments,
                                                                          boolean includeOther,
                                                                          boolean includeTax,
                                                                          boolean includeShipping,
                                                                          boolean forTax,
                                                                          boolean forShipping)
      • calcItemAdjustment

        public static java.math.BigDecimal calcItemAdjustment​(GenericValue itemAdjustment,
                                                              GenericValue item)
      • calcItemAdjustment

        public static java.math.BigDecimal calcItemAdjustment​(GenericValue itemAdjustment,
                                                              java.math.BigDecimal quantity,
                                                              java.math.BigDecimal unitPrice)
      • calcItemAdjustmentRecurringBd

        public static java.math.BigDecimal calcItemAdjustmentRecurringBd​(GenericValue itemAdjustment,
                                                                         java.math.BigDecimal quantity,
                                                                         java.math.BigDecimal unitPrice)
      • filterOrderAdjustments

        public static java.util.List<GenericValue> filterOrderAdjustments​(java.util.List<GenericValue> adjustments,
                                                                          boolean includeOther,
                                                                          boolean includeTax,
                                                                          boolean includeShipping,
                                                                          boolean forTax,
                                                                          boolean forShipping)
      • getQuantityOnOrder

        public static java.math.BigDecimal getQuantityOnOrder​(Delegator delegator,
                                                              java.lang.String productId)
      • hasPermission

        public static boolean hasPermission​(Security security,
                                            GenericValue userLogin,
                                            GenericValue orderHeader)
        Checks to see if this user has read permission on the specified order
        Parameters:
        userLogin - The UserLogin value object to check
        orderHeader - The OrderHeader for the specified order
        Returns:
        boolean True if we have read permission
      • getAvailableOrderHeaderAdjustments

        public java.util.List<GenericValue> getAvailableOrderHeaderAdjustments()
        Get orderAdjustments that have no corresponding returnAdjustment
        Returns:
        return the order adjustments that have no corresponding with return adjustment
      • getReturnAdjustmentTotal

        public static java.math.BigDecimal getReturnAdjustmentTotal​(Delegator delegator,
                                                                    java.util.Map<java.lang.String,​java.lang.Object> condition)
        Get the total return adjustments for a set of key -> value condition pairs. Done for code efficiency.
        Parameters:
        delegator - the delegator
        condition - a map of the conditions to use
        Returns:
        Get the total return adjustments
      • setScaleByType

        public static java.math.BigDecimal setScaleByType​(boolean isTax,
                                                          java.math.BigDecimal value)
      • getOrderItemInvoicedQuantity

        public static java.math.BigDecimal getOrderItemInvoicedQuantity​(GenericValue orderItem)
        Get the quantity of order items that have been invoiced
      • getOrderPaymentStatuses

        public java.util.List<GenericValue> getOrderPaymentStatuses()
      • getOrderPaymentStatuses

        public static java.util.List<GenericValue> getOrderPaymentStatuses​(java.util.List<GenericValue> orderStatuses)
      • getOrderItemAttribute

        public static java.lang.String getOrderItemAttribute​(GenericValue orderItem,
                                                             java.lang.String attributeName)
      • getOrderAttribute

        public java.lang.String getOrderAttribute​(java.lang.String attributeName)
      • getOrderTaxByTaxAuthGeoAndParty

        public static java.util.Map<java.lang.String,​java.lang.Object> getOrderTaxByTaxAuthGeoAndParty​(java.util.List<GenericValue> orderAdjustments)
      • getOrderItemTaxByTaxAuthGeoAndPartyForDisplay

        public static java.util.Map<java.lang.String,​java.lang.Object> getOrderItemTaxByTaxAuthGeoAndPartyForDisplay​(GenericValue orderItem,
                                                                                                                           java.util.List<GenericValue> orderAdjustmentsOriginal)
      • getOrderTaxByTaxAuthGeoAndPartyForDisplay

        public static java.util.Map<java.lang.String,​java.lang.Object> getOrderTaxByTaxAuthGeoAndPartyForDisplay​(java.util.List<GenericValue> orderAdjustmentsOriginal)
      • getBillingAccountBalance

        public static java.math.BigDecimal getBillingAccountBalance​(GenericValue billingAccount)
                                                             throws GenericEntityException
        Calculates the "available" balance of a billing account, which is the net balance minus amount of pending (not cancelled, rejected, or received) order payments. When looking at using a billing account for a new order, you should use this method.
        Parameters:
        billingAccount - the billing account record
        Returns:
        return the "available" balance of a billing account
        Throws:
        GenericEntityException
      • getShippableSizes

        public java.util.List<java.math.BigDecimal> getShippableSizes​(java.lang.String shipGrouSeqId)
      • getItemReceivedQuantity

        public java.math.BigDecimal getItemReceivedQuantity​(GenericValue orderItem)