Class BillingAccountWorker


  • public class BillingAccountWorker
    extends java.lang.Object
    Worker methods for BillingAccounts
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int decimals  
      static java.lang.String module  
      static java.lang.String resourceError  
      static java.math.RoundingMode rounding  
      static java.math.BigDecimal ZERO  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.math.BigDecimal availableToCapture​(GenericValue billingAccount)
      Returns the amount of the billing account which could be captured, which is BillingAccount.accountLimit - net balance
      static java.util.Map<java.lang.String,​java.lang.Object> calcBillingAccountBalance​(DispatchContext dctx, java.util.Map<java.lang.String,​? extends java.lang.Object> context)  
      static java.math.BigDecimal getBillingAccountAvailableBalance​(Delegator delegator, java.lang.String billingAccountId)  
      static java.math.BigDecimal getBillingAccountAvailableBalance​(GenericValue billingAccount)
      Returns the amount which could be charged to a billing account, which is defined as the accountLimit minus account balance and minus the balance of outstanding orders When trying to figure out how much of a billing account can be used to pay for an outstanding order, use this method
      static java.math.BigDecimal getBillingAccountNetBalance​(Delegator delegator, java.lang.String billingAccountId)
      Calculates the net balance of a billing account, which is sum of all amounts applied to invoices minus sum of all amounts applied from payments.
      static java.util.List<GenericValue> getBillingAccountOpenOrders​(Delegator delegator, java.lang.String billingAccountId)
      Returns list of orders which are currently open against a billing account
      static java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> makePartyBillingAccountList​(GenericValue userLogin, java.lang.String currencyUomId, java.lang.String partyId, Delegator delegator, LocalDispatcher dispatcher)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • module

        public static final java.lang.String module
      • decimals

        public static final int decimals
      • rounding

        public static final java.math.RoundingMode rounding
      • ZERO

        public static final java.math.BigDecimal ZERO
    • Constructor Detail

      • BillingAccountWorker

        public BillingAccountWorker()
    • Method Detail

      • getBillingAccountAvailableBalance

        public static java.math.BigDecimal getBillingAccountAvailableBalance​(GenericValue billingAccount)
                                                                      throws GenericEntityException
        Returns the amount which could be charged to a billing account, which is defined as the accountLimit minus account balance and minus the balance of outstanding orders When trying to figure out how much of a billing account can be used to pay for an outstanding order, use this method
        Parameters:
        billingAccount - GenericValue object of the billing account
        Returns:
        returns the amount which could be charged to a billing account
        Throws:
        GenericEntityException
      • getBillingAccountNetBalance

        public static java.math.BigDecimal getBillingAccountNetBalance​(Delegator delegator,
                                                                       java.lang.String billingAccountId)
                                                                throws GenericEntityException
        Calculates the net balance of a billing account, which is sum of all amounts applied to invoices minus sum of all amounts applied from payments. When charging or capturing an invoice to a billing account, use this method
        Parameters:
        delegator - the delegator
        billingAccountId - the billing account id
        Returns:
        the amount of the billing account which could be captured
        Throws:
        GenericEntityException
      • availableToCapture

        public static java.math.BigDecimal availableToCapture​(GenericValue billingAccount)
                                                       throws GenericEntityException
        Returns the amount of the billing account which could be captured, which is BillingAccount.accountLimit - net balance
        Parameters:
        billingAccount - GenericValue object of the billing account
        Returns:
        the amount of the billing account which could be captured
        Throws:
        GenericEntityException
      • calcBillingAccountBalance

        public static java.util.Map<java.lang.String,​java.lang.Object> calcBillingAccountBalance​(DispatchContext dctx,
                                                                                                       java.util.Map<java.lang.String,​? extends java.lang.Object> context)