com.ibm.etill.framework.payapi
Class BatchTotalsItem

java.lang.Object
  |
  +--com.ibm.etill.framework.payapi.BatchTotalsItem
All Implemented Interfaces:
Serializable

public final class BatchTotalsItem
extends Object
implements Serializable

BatchTotals objects maintain a set of totals for a single currency and amountExp10 within a given batch. A single batch may therefore have a set of BatchTotalsItem objects.

Cassettes should never instantiate a BatchTotalsItem object directly. Rather, calls to the Batch object's addPayment and addCredit methods will create these objects as needed. The Batch class also provides methods to access a batch's totals items.

BatchTotalsItem implements the Serializable interface so that batch totals can be stored in the database along with the Batch object itself.

See Also:
Batch, Serialized Form

Constructor Summary
BatchTotalsItem(short currency, int amountExp10)
          Cassettes should not call this constructor.
 
Method Summary
 void addCredit(int amount)
          Cassettes should not call this method - they should call the Batch object's addCredit method.
 void addPayment(int amount)
          Cassettes should not call this method - they should call the Batch object's addPayment method.
 int getAmountExp10()
          Returns the base10 expornent associated with this object.
 int getCreditTotal()
          Returns the total amount of credits for this object's currency/amountExp10.
 short getCurrency()
          Returns the currency associated with this object.
 int getNumberOfCredits()
          Returns the number of credits associated with this object.
 int getNumberOfPayments()
          Returns the number of payments associated with this object.
 int getPaymentTotal()
          Returns the total amount of deposits for this object's currency/amountExp10.
 boolean removeCredit(int amount)
          Cassettes should not call this method - they should call the Batch object's removeCredit method.
 boolean removePayment(int amount)
          Cassettes should not call this method - they should call the Batch object's removePayment method.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BatchTotalsItem

public BatchTotalsItem(short currency,
                       int amountExp10)
Cassettes should not call this constructor. The Framework calls this constructor to build a BatchTotalsItem for the specified currency and amountExp10.
Parameters:
currency - a short containing the ISO 4217 currency code
amountExp10 - an int containing the base10 exponent
Method Detail

addPayment

public void addPayment(int amount)
Cassettes should not call this method - they should call the Batch object's addPayment method. The Batch object's method will locate the correct BatchTotalsItem and then then call this method on that object.

This method adds the input amount value to the current deposit total. The number of payments is also incremented by 1.

Parameters:
amount - an int containing the amount value to add to the deposit total.
See Also:
Batch.addPayment(com.ibm.etill.framework.payapi.Payment)

removePayment

public boolean removePayment(int amount)
Cassettes should not call this method - they should call the Batch object's removePayment method. The Batch object's method will locate the correct BatchTotalsItem and then then call this method on that object.

This method subtracts the input amount value from the current deposit total. The number of payments is also decremented by 1.

Parameters:
amount - an int containing the amount value to subtract from the deposit total.
Returns:
boolean - true if the Framework should delete this object, false if not.
See Also:
Batch.removePayment(com.ibm.etill.framework.payapi.Payment)

addCredit

public void addCredit(int amount)
Cassettes should not call this method - they should call the Batch object's addCredit method. The Batch object's method will locate the correct BatchTotalsItem and then then call this method on that object.

This method adds the input amount value to the current credit total. The number of credits is also incremented by 1.

Parameters:
amount - an int containing the amount value to add to the credit total.
See Also:
Batch.addCredit(com.ibm.etill.framework.payapi.Credit)

removeCredit

public boolean removeCredit(int amount)
Cassettes should not call this method - they should call the Batch object's removeCredit method. The Batch object's method will locate the correct BatchTotalsItem and then then call this method on that object.

This method subtracts the input amount value from the current credit total. The number of credits is also decremented by 1.

Parameters:
amount - an int containing the amount value to subtract from the credit total.
Returns:
boolean - true if the Framework should delete this object, false if not.
See Also:
Batch.removeCredit(com.ibm.etill.framework.payapi.Credit)

getCurrency

public short getCurrency()
Returns the currency associated with this object.
Returns:
short - the ISO 4217 currency code

getAmountExp10

public int getAmountExp10()
Returns the base10 expornent associated with this object.
Returns:
int - the base10 exponent

getNumberOfPayments

public int getNumberOfPayments()
Returns the number of payments associated with this object.
Returns:
int - the number of payments whose amount was added to the deposit total in this object.

getNumberOfCredits

public int getNumberOfCredits()
Returns the number of credits associated with this object.
Returns:
int - the number of credits whose amount was added to the credit total in this object.

getPaymentTotal

public int getPaymentTotal()
Returns the total amount of deposits for this object's currency/amountExp10.
Returns:
int - the deposit total

getCreditTotal

public int getCreditTotal()
Returns the total amount of credits for this object's currency/amountExp10.
Returns:
int - the credit total