Class BillingAccountWorker

java.lang.Object
org.apache.ofbiz.accounting.payment.BillingAccountWorker

public final class BillingAccountWorker extends Object
Worker methods for BillingAccounts
  • Constructor Details

    • BillingAccountWorker

      protected BillingAccountWorker()
  • Method Details

    • makePartyBillingAccountList

      public static List<Map<String,Object>> makePartyBillingAccountList(GenericValue userLogin, String currencyUomId, String partyId, Delegator delegator, LocalDispatcher dispatcher) throws GeneralException
      Throws:
      GeneralException
    • getBillingAccountOpenOrders

      public static List<GenericValue> getBillingAccountOpenOrders(Delegator delegator, String billingAccountId) throws GenericEntityException
      Returns list of orders which are currently open against a billing account
      Throws:
      GenericEntityException
    • getBillingAccountAvailableBalance

      public static 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
    • getBillingAccountAvailableBalance

      public static BigDecimal getBillingAccountAvailableBalance(Delegator delegator, String billingAccountId) throws GenericEntityException
      Throws:
      GenericEntityException
    • getBillingAccountNetBalance

      public static BigDecimal getBillingAccountNetBalance(Delegator delegator, 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 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 Map<String,Object> calcBillingAccountBalance(DispatchContext dctx, Map<String,? extends Object> context)