Class BillingAccountWorker
- java.lang.Object
-
- org.apache.ofbiz.accounting.payment.BillingAccountWorker
-
public class BillingAccountWorker extends java.lang.Object
Worker methods for BillingAccounts
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
BillingAccountWorker.BillingAccountComparator
-
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
-
Constructor Summary
Constructors Constructor Description BillingAccountWorker()
-
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 balancestatic 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 methodstatic 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 accountstatic 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)
-
-
-
Field Detail
-
module
public static final java.lang.String module
-
resourceError
public static final java.lang.String resourceError
- See Also:
- Constant Field Values
-
decimals
public static final int decimals
-
rounding
public static final java.math.RoundingMode rounding
-
ZERO
public static final java.math.BigDecimal ZERO
-
-
Method Detail
-
makePartyBillingAccountList
public 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) throws GeneralException
- Throws:
GeneralException
-
getBillingAccountOpenOrders
public static java.util.List<GenericValue> getBillingAccountOpenOrders(Delegator delegator, java.lang.String billingAccountId) throws GenericEntityException
Returns list of orders which are currently open against a billing account- Throws:
GenericEntityException
-
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
-
getBillingAccountAvailableBalance
public static java.math.BigDecimal getBillingAccountAvailableBalance(Delegator delegator, java.lang.String billingAccountId) throws GenericEntityException
- 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 delegatorbillingAccountId
- 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)
-
-