com.ibm.etill.framework.payapi
Class Transaction

java.lang.Object
  |
  +--com.ibm.etill.framework.payapi.Transaction
All Implemented Interfaces:
Archivable, FrameworkReturnCodes, PaymentAPIConstants, Restorable
Direct Known Subclasses:
Credit, Payment

public abstract class Transaction
extends Object
implements PaymentAPIConstants, Archivable, Restorable

Transaction is the base class for the generic Payment and Credit classes. This class contains the instance variables and methods that are common across the two subclasses.

Cassettes should not extend this class.

Refer to the Javadoc for the Payment and Credit classes for a complete description of Transaction objects.


Field Summary
 int amount
          Deprecated. Use getAmount() and setAmount()
 CassetteTransaction cassetteTransaction
          Deprecated. Use getCassetteTransaction()
 int currentState
          Deprecated. Use getCurrentState() and setCurrentState()
 boolean newTransaction
          Deprecated. Use isNewTransaction() and setNewTransaction()
 Order order
          Deprecated. Use getOrder()
 long timeStampCreated
          Deprecated. Use getTimestampCreated() and setTimestampCreated()
 long timeStampModified
          Deprecated. Use getTimestampModified() and setTimestampModified()
 String transactionNumber
          Deprecated. Use getTransactionNumber()
 
Method Summary
 String getAcquirerID()
          Deprecated. Use getReferenceNumber()
 int getAmount()
          Returns the amount value, without decimal point, of this Transaction object.
 String getBatchNumber()
          Returns the batch number with which this Transaction is associated.
 CassetteTransaction getCassetteTransaction()
          Returns the CassetteTransaction object associated with this generic Transaction object.
 int getCurrentState()
          Returns the current state of this Transaction object.
 String getMerchantName()
          Returns the merchant number of the merchant to which this Transaction belongs.
 String getMerchantNumber()
          Returns the merchant number of the merchant to which this Transaction belongs.
 Order getOrder()
          Returns the Order object to which this Transaction belongs.
 String getOrderNumber()
          Returns the order number of the Order object to which this Transaction belongs.
 String getReferenceNumber()
          Returns the protocol-specific reference number from this Transaction object.
 long getTimestampCreated()
          Returns the time and date when this Transaction object was created.
 long getTimestampModified()
          Returns the time and date when this Transaction object was last modified.
 String getTransactionNumber()
          Returns the transaction number of this Transaction object.
 boolean isNewTransaction()
          Indicates whether or not this is a new transaction object.
 void setAcquirerID(String newID)
          Deprecated. Use setReferenceNumber()
 void setAmount(Amount amount)
          Sets the transaction amount to the amount value in the input Amount object.
 void setAmount(int amount)
          Sets the transaction amount to the input amount value.
 void setBatchNumber(String batchNumber)
          Sets the batch number of this transaction.
 void setCassetteTransaction(CassetteTransaction aTransaction)
          Sets the cassettetransaction.
 void setCurrentState(int state)
          Updates the current state of this Transaction object and generates a StateEvent.
 void setNewTransaction(boolean aFlag)
          Sets the internal newTransaction flag to indicate whether or not this is a new transaction.
 void setReferenceNumber(String aRef)
          Assigns a protocol-specific reference number to this Transaction object.
 void setTimeStampCreated(long timeCreated)
          Cassettes should not call this method.
 void setTimeStampModified(long timeModified)
          Cassettes should not call this method.
 String toString()
          Returns a string representation of this object for tracing purposes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ibm.etill.framework.archive.Archivable
createRecord, deleteRecord, updateRecord
 
Methods inherited from interface com.ibm.etill.framework.archive.Restorable
restoreRecord
 

Field Detail

cassetteTransaction

public CassetteTransaction cassetteTransaction
Deprecated. Use getCassetteTransaction()


order

public Order order
Deprecated. Use getOrder()


transactionNumber

public String transactionNumber
Deprecated. Use getTransactionNumber()


amount

public int amount
Deprecated. Use getAmount() and setAmount()


timeStampCreated

public long timeStampCreated
Deprecated. Use getTimestampCreated() and setTimestampCreated()


timeStampModified

public long timeStampModified
Deprecated. Use getTimestampModified() and setTimestampModified()


currentState

public int currentState
Deprecated. Use getCurrentState() and setCurrentState()


newTransaction

public boolean newTransaction
Deprecated. Use isNewTransaction() and setNewTransaction()

Method Detail

getMerchantNumber

public String getMerchantNumber()
Returns the merchant number of the merchant to which this Transaction belongs.
Returns:
String - the merchant number

getMerchantName

public String getMerchantName()
Returns the merchant number of the merchant to which this Transaction belongs.
Returns:
String - the merchant number

getOrderNumber

public String getOrderNumber()
Returns the order number of the Order object to which this Transaction belongs.
Returns:
String - the order number

getOrder

public Order getOrder()
Returns the Order object to which this Transaction belongs.
Returns:
Order - object to which this Transactoin belongs.

getTransactionNumber

public String getTransactionNumber()
Returns the transaction number of this Transaction object. When subclassed by Payment, this returns the payment number. When subclassed by Credit, it returns the credit number.
Returns:
String - the transaction number.

getAmount

public int getAmount()
Returns the amount value, without decimal point, of this Transaction object. The associated amountExp10 and currency values must be obtained associated Order object. For example, assuming that trx is a reference to your Transaction object: ... int amountValue = trx.getAmount(); int amounttExp10Value = trx.getOrder().getAmount().getAmountExp10(); short currencyValue = trx.getOrder().getAmount().getCurrency(); ...
Returns:
int - the amount value, without decimal point.

getCurrentState

public int getCurrentState()
Returns the current state of this Transaction object. The valid state values are defined by the subclass.
Returns:
int - the current state value of this Transaction

getBatchNumber

public String getBatchNumber()
Returns the batch number with which this Transaction is associated.
Returns:
String - the batch number

getCassetteTransaction

public CassetteTransaction getCassetteTransaction()
Returns the CassetteTransaction object associated with this generic Transaction object.
Returns:
CassetteTransaction - the corresponding CassetteTransaction

isNewTransaction

public boolean isNewTransaction()
Indicates whether or not this is a new transaction object. The Framework calls this method in error cases to determine whether or not the object should be destroyed.
Returns:
boolean - true means that the Framework just created this object and no corresponding CassetteTransaction exists yet; false means that both the generic and cassette objects representing this Transaction are complete and have been or should be committed to the database.
See Also:
setNewTransaction(boolean)

setNewTransaction

public void setNewTransaction(boolean aFlag)
Sets the internal newTransaction flag to indicate whether or not this is a new transaction.

When the Framework first instantiates this Transaction object, the newTransaction flag is set to true. If an ETillAbortOperation exception is thrown while the newTransaction is still true, then the Framework will delete the in-memory Transaction object without ever writing it to the database.

Cassettes must call this method with a false value once they have successfully completed initializing the associated CassetteTransaction object. By setting this indicator to false, the cassette ensures that the generic Transaction object will remain in existence even if an error occurs henceforth.


setCassetteTransaction

public void setCassetteTransaction(CassetteTransaction aTransaction)
Sets the cassettetransaction.
Parameters:
aTransaction. -  

getTimestampCreated

public long getTimestampCreated()
Returns the time and date when this Transaction object was created.
Returns:
long - the creation time of this object, expressed as the number of milliseconds since January 1, 1970, 00:00:00 UTC.

getTimestampModified

public long getTimestampModified()
Returns the time and date when this Transaction object was last modified.
Returns:
long - the most recent modification time of this object, expressed as the number of milliseconds since January 1, 1970, 00:00:00 UTC.

setTimeStampCreated

public void setTimeStampCreated(long timeCreated)
Cassettes should not call this method. Marks the time and date when this object was created. The framework calls this method when it instantiates a new object.
Parameters:
timeCreated - a long containing a timestamp, expressed as the number of milliseconds since January 1, 1970, 00:00:00 UTC.

setTimeStampModified

public void setTimeStampModified(long timeModified)
Cassettes should not call this method. Updates the time and date when this object was last modified. The framework calls this method before committing the object to the database.
Parameters:
timeModified - a long containing a timestamp, expressed as the number of milliseconds since January 1, 1970, 00:00:00 UTC.

setCurrentState

public void setCurrentState(int state)
Updates the current state of this Transaction object and generates a StateEvent.

Cassettes should call this method as necessary to keep this object's state synchronized with the cassette's corresponding CassetteTransaction object. The cassette writer is responsible for defining how the CassetteTransaction's states map to those of the generic Transaction objects.

The Framework generates a StateEvent if the input state value is different from the current state value. This event will be sent out to registered event listeners the next time the commit method of this thread's CommitPoint is called.

Parameters:
state - an int containing the new state value. Valid state values are defined by the subclass.
See Also:
CommitPoint.addToEventList(com.ibm.etill.framework.eventmgr.PSEvent)

setBatchNumber

public void setBatchNumber(String batchNumber)
Sets the batch number of this transaction.
Parameters:
batchNumber - String describing the batch number of this transaction

setAmount

public void setAmount(Amount amount)
Sets the transaction amount to the amount value in the input Amount object.
Parameters:
amount - an Amount object whose getAmount method will provide the transaction amount value.

setAmount

public void setAmount(int amount)
Sets the transaction amount to the input amount value.
Parameters:
amount - an int containing the transaction amount value.

setReferenceNumber

public void setReferenceNumber(String aRef)
Assigns a protocol-specific reference number to this Transaction object. Since this is protocol-specific data, each cassette must decide what information, if any, to store here.

Reference number is typically a value returned from a financial institution that represents the successful completion of a financial transaction. For example, a credit card-based cassette might store the approval code from an authorization request in this field.

Parameters:
aRef - a String containing a protocol-specific reference number.
See Also:
getReferenceNumber()

getReferenceNumber

public String getReferenceNumber()
Returns the protocol-specific reference number from this Transaction object. Since this is protocol-specific data, the actual contents varies across cassettes.

Reference number is typically a value returned from a financial institution that represents the successful completion of a financial transaction. For example, a credit card-based cassette might store the approval code from an authorization request in this field.

Returns:
String - the protocol-specific reference number.
See Also:
setReferenceNumber(java.lang.String)

setAcquirerID

public void setAcquirerID(String newID)
Deprecated. Use setReferenceNumber()


getAcquirerID

public String getAcquirerID()
Deprecated. Use getReferenceNumber()


toString

public String toString()
Returns a string representation of this object for tracing purposes.
Overrides:
toString in class Object
Returns:
String - a string representation of the key elements of this object.