Class EPPBalance

java.lang.Object
com.verisign.epp.codec.balance.v04.EPPBalance
All Implemented Interfaces:
EPPCodecComponent, Serializable, Cloneable

public class EPPBalance extends Object implements EPPCodecComponent
A concrete EPPResponse that knows how to encode/decode Balance Info response from/to XML and object instance.
See Also:
  • Field Details

    • ELM_LOCALNAME

      public static final String ELM_LOCALNAME
      XML local name for EPPBalance.
      See Also:
    • ELM_NAME

      public static final String ELM_NAME
      The poll data XML tag name
      See Also:
    • CURRENCY_DEFAULT

      public static final String CURRENCY_DEFAULT
      Default currency is "USD". The specification doesn't include a default, but adding it to make it easier to transition from the proprietary Balance Mapping.
      See Also:
    • DEFAULT_BASED_ON

      public static final EPPBalance.LimitBasedOn DEFAULT_BASED_ON
      Default value for the "baseOn" attribute.
    • EXECUTION_LIMIT_DEFAULT

      public static final BigDecimal EXECUTION_LIMIT_DEFAULT
      Default execution limit is 0.0.
    • ELM_BALANCE_AVAILABLE

      public static final String ELM_BALANCE_AVAILABLE
      The balance XML tag name
      See Also:
    • ELM_CREDIT_LINE

      public static final String ELM_CREDIT_LINE
      The creditLimit XML tag name
      See Also:
    • ELM_CASH_BALANCE

      public static final String ELM_CASH_BALANCE
      The cashBalance XML tag name
      See Also:
    • ELM_EXECUTION_LIMIT

      public static final String ELM_EXECUTION_LIMIT
      The executionLimit XML tag name
      See Also:
    • ELM_NOTIFICATION_THRESHOLD

      public static final String ELM_NOTIFICATION_THRESHOLD
      The notificationThreshold XML tag name
      See Also:
    • ATTR_NAME

      public static final String ATTR_NAME
      Attribute used for the name of the balance, which is optional and is based on server policy.
      See Also:
    • ATTR_BASED_ON

      public static final String ATTR_BASED_ON
      Attribute used for the limit attributes of executionLimit and notificationThreshold.
      See Also:
  • Constructor Details

    • EPPBalance

      public EPPBalance()
      Default constructor
    • EPPBalance

      public EPPBalance(String aCurrency, BigDecimal aBalanceAvailable, BigDecimal aCreditLine, BigDecimal aCashBalance)
      EPPBalance that takes all of the required attributes.
      Parameters:
      aBalanceAvailable - Balance available to set
      aCreditLine - Credit line to set
      aCashBalance - Cash balance to set
    • EPPBalance

      public EPPBalance(String aName, String aCurrency, List<EPPBalanceByCurrency> aCashBalanceByCurrencies, BigDecimal aBalanceAvailable, BigDecimal aCreditLine, BigDecimal aCashBalance, BigDecimal aExecutionLimit, BigDecimal aNotificationThreshold, EPPBalance.LimitBasedOn aLimitBasedOn)
      EPPBalance that takes all of the attributes.
      Parameters:
      aName - Optional name of the balance
      aBalanceAvailable - Balance available to set
      aCreditLine - Credit line to set
      aCashBalance - Cash balance to set
      aExecutionLimit - Execution limit to set
      aNotificationThreshold - Notification limit to set
      aLimitBasedOn - What the limit parameters of aExecutionLimit and aNotificationThreshold are based on.
  • Method Details

    • getNamespace

      public String getNamespace()
      Returns the XML namespace associated with the EPPResponse.
      Specified by:
      getNamespace in interface EPPCodecComponent
      Returns:
      XML namespace for the EPPResponse.
    • encode

      public Element encode(Document aDocument) throws EPPEncodeException
      Encode the Balance attributes to DOM.
      Specified by:
      encode in interface EPPCodecComponent
      Parameters:
      aDocument - the DOM Document to attach data to.
      Returns:
      the element that is a parent of the poll data
      Throws:
      EPPEncodeException - Thrown if any errors occur during the encode process
    • decode

      public void decode(Element aElement) throws EPPDecodeException
      Populates the data of this instance from the given XML Element which is part of a DOM Document
      Specified by:
      decode in interface EPPCodecComponent
      Parameters:
      aElement - the element that is a parent of the poll data
      Throws:
      EPPDecodeException - thrown if any errors occur during the decode operation
    • equals

      public boolean equals(Object aObject)
      implements a deep EPPBalance compare.
      Overrides:
      equals in class Object
      Parameters:
      aObject - EPPBalance instance to compare with
      Returns:
      true if equal false otherwise
    • clone

      public Object clone() throws CloneNotSupportedException
      Clone EPPLowBalancePollResponse.
      Specified by:
      clone in interface EPPCodecComponent
      Overrides:
      clone in class Object
      Returns:
      clone of EPPLowBalancePollResponse
      Throws:
      CloneNotSupportedException - standard Object.clone exception
    • hasName

      public boolean hasName()
      Is the balance name defined?
      Returns:
      true if the balance name is defined; false otherwise.
    • getName

      public String getName()
      Gets the optional balance name value.
      Returns:
      Balance name if defined; null otherwise.
    • setName

      public void setName(String aName)
      Sets the balance name value.
      Parameters:
      aName - Balance name. Set null to unset the attribute.
    • hasCurrency

      public boolean hasCurrency()
      Is the currency defined?
      Returns:
      true if the currency is defined; false otherwise.
    • getCurrency

      public String getCurrency()
      Gets the currency value.
      Returns:
      Currency if defined; null otherwise.
    • setCurrency

      public void setCurrency(String aCurrency)
      Sets the currency value.
      Parameters:
      aCurrency - Currency value
    • hasCashBalanceByCurrencies

      public boolean hasCashBalanceByCurrencies()
      Are the cash balance by currencies defined?
      Returns:
      true if the cash balance by currencies are defined; false otherwise.
    • getCashBalanceByCurrencies

      public List<EPPBalanceByCurrency> getCashBalanceByCurrencies()
      Gets the list of cash balance by currency objects that breakdown the cash balance by currency for multi-currency accounts.
      Returns:
      The list of EPPBalanceByCurrency objects
    • addCashBalanceByCurrency

      public void addCashBalanceByCurrency(EPPBalanceByCurrency aCashBalanceByCurrency)
      Adds a cash balance by currency to the list of cash balance by currencies.
      Parameters:
      aCashBalanceByCurrency - The cash balance by currency to add.
    • setCashBalanceByCurrencies

      public void setCashBalanceByCurrencies(List<EPPBalanceByCurrency> aCashBalanceByCurrencies)
      Sets the list of cash balance by currency objects that breakdown the cash balance by currency for multi-currency accounts.
      Parameters:
      aCashBalanceByCurrencies - The list of cash balance by currency objects that breakdown the cash balance by currency for multi-currency accounts.
    • getBalanceAvailable

      public BigDecimal getBalanceAvailable()
      Gets the balance that represents the calculated Balance Available using the equation Balance Available (B) = Credit Limit (CL) + Cash Balance (CB).
      Returns:
      balance if set; null otherwise.
    • setBalanceAvailable

      public void setBalanceAvailable(BigDecimal aBalanceAvailable)
      Sets the balance that represents the calculated Balance Available using the equation Balance Available (BA) = Credit Limit (CL) + Cash Balance (CB).
      Parameters:
      aBalanceAvailable - Balance to set
    • getCreditLine

      public BigDecimal getCreditLine()
      Gets the credit line that represents the calculated level of credit based on the set of active credit instruments.
      Returns:
      credit limit if set; null otherwise.
    • setCreditLine

      public void setCreditLine(BigDecimal aCreditLine)
      Sets the credit Limit that represents the calculated level of credit based on the set of active credit instruments.
      Parameters:
      aCreditLine - Credit line to set
    • getCashBalance

      public BigDecimal getCashBalance()
      Gets the cash balance that represents the cash on hand that is impacted by client payments and billable transaction debits and credits, inclusive of the fees and taxes.
      Returns:
      cash balance if set; null otherwise.
    • setCashBalance

      public void setCashBalance(BigDecimal aCashBalance)
      Sets the cash balance that represents the cash on hand that is impacted by client payments and billable transaction debits and credits, inclusive of the fees and taxes.
      Parameters:
      aCashBalance - Cash balance to set
    • hasExecutionLimit

      public boolean hasExecutionLimit()
      Is the execution limit defined?
      Returns:
      true if the execution limit is defined; false otherwise.
    • getExecutionLimit

      public BigDecimal getExecutionLimit()
      Gets the execution limit
      Returns:
      Execution limit if set; null otherwise.
    • setExecutionLimit

      public void setExecutionLimit(BigDecimal aExecutionLimit)
      Sets the execution limit
      Parameters:
      aExecutionLimit - Credit threshold to set
    • hasNotificationThreshold

      public boolean hasNotificationThreshold()
      Is the notification threshold defined?
      Returns:
      true if the notification threshold is defined; false otherwise.
    • getNotificationThreshold

      public BigDecimal getNotificationThreshold()
      Gets the notification threshold
      Returns:
      Notification threshold if set; null otherwise.
    • setNotificationThreshold

      public void setNotificationThreshold(BigDecimal aNotificationThreshold)
      Sets the notification threshold
      Parameters:
      aNotificationThreshold - Credit threshold to set
    • getLimitBasedOn

      public EPPBalance.LimitBasedOn getLimitBasedOn()
      Returns:
      What the limit attributes are based on
    • setLimitBasedOn

      public void setLimitBasedOn(EPPBalance.LimitBasedOn aLimitBasedOn)
      Parameters:
      aLimitBasedOn - What the limit attributes are based on