com.ibm.etill.framework.payapi
Class Credit

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

public final class Credit
extends Transaction
implements PSServerCreditConstants

Credit objects contain all of the generic information that the Framework needs to represent a credit created for a specific order. The combination of this object and the CassetteTransaction object for the same credit constitutes the complete representation of a given credit.

A Credit is uniquely identified by the combination of the merchant number, order number, and credit number. Therefore, all Credits for a given order must be unique.

Among the data maintained in each Credit object are:

Credit objects are created by calling the Supervisor.createCredit method. This happens in several different cases:

This class implements methods to log the generic information about a credit into the ETCREDIT database table and to retrieve that same information later on.


Fields inherited from class com.ibm.etill.framework.payapi.Transaction
amount, cassetteTransaction, currentState, newTransaction, order, timeStampCreated, timeStampModified, transactionNumber
 
Fields inherited from interface com.ibm.etill.framework.xdm.PSServerCreditConstants
APPROXIMATE_XDM_KEY_SIZE, APPROXIMATE_XDM_OBJECT_SIZE, COL_ACCOUNTNUMBER, COL_ACQUIRERID, COL_AMOUNTEXP10, COL_AMOUNTVALUE, COL_APPROVESALLOWED, COL_BATCHNUMBER, COL_BRANDID, COL_CREDITNUMBER, COL_CURRENCY, COL_CURRENTSTATE, COL_MERCHANTNAME, COL_ORDERAMOUNT, COL_ORDERNUMBER, COL_ORDERSTATE, COL_ORDERTIMECREATED, COL_ORDERTIMEMODIFIED, COL_PAYMENTTYPE, COL_TIMESTAMPCREATED, COL_TIMESTAMPMODIFIED, COL_UNAPPROVEDAMOUNT, CREDIT, CREDITVIEW, VIEW_ACCOUNTNUMBER, VIEW_ACQUIRERID, VIEW_AMOUNTEXP10, VIEW_APPROVESALLOWED, VIEW_BATCHNUMBER, VIEW_CARDHOLDERID, VIEW_CREDITAMOUNT, VIEW_CREDITNUMBER, VIEW_CREDITSTATE, VIEW_CREDITTIMECREATED, VIEW_CREDITTIMEMODIFIED, VIEW_CURRENCY, VIEW_MERCHANTNAME, VIEW_ORDERAMOUNT, VIEW_ORDERNUMBER, VIEW_ORDERSTATE, VIEW_ORDERTIMECREATED, VIEW_ORDERTIMEMODIFIED, VIEW_PAYMENTTYPE, VIEW_UNAPPROVEDAMOUNT
 
Constructor Summary
Credit(Order order, String creditNumber)
          Cassettes should never call this constructor.
 
Method Summary
 void createCassetteCredit(ParameterTable protocolData)
          Cassettes should not call this method.
 void createRecord(Connection conn)
          This method should never be called directly from cassettes.
 void deleteRecord(Connection conn)
          This method should never be called directly from cassettes.
 void resetCredit()
          Reinitializes this credit object to the state it had when it was first instantiated.
 void restoreRecord()
          This method should never be called directly from cassettes.
 void resurrectCassetteCredit()
          Cassettes should not call this method.
static void retrieveCredits(Order currentOrder, Hashtable collection)
          Returns the set of Credit objects that belong to the specified order.
 void updateRecord(Connection conn)
          This method should never be called directly from cassettes.
 
Methods inherited from class com.ibm.etill.framework.payapi.Transaction
getAcquirerID, getAmount, getBatchNumber, getCassetteTransaction, getCurrentState, getMerchantName, getMerchantNumber, getOrder, getOrderNumber, getReferenceNumber, getTimestampCreated, getTimestampModified, getTransactionNumber, isNewTransaction, setAcquirerID, setAmount, setAmount, setBatchNumber, setCassetteTransaction, setCurrentState, setNewTransaction, setReferenceNumber, setTimeStampCreated, setTimeStampModified, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Credit

public Credit(Order order,
              String creditNumber)
Cassettes should never call this constructor. To create a new Credit object, call the Supervisor.createCredit method. To resurrect an existing Order and all of its associated objects, including Credits, call the Supervisor.retrieveOrder method.

The Framework calls this constructor to create a new Credit having the specified credit number for the specified Order.

See Also:
Supervisor.createCredit(com.ibm.etill.framework.payapi.Order, java.lang.String, com.ibm.etill.framework.payapi.Amount, com.ibm.etill.framework.payapi.ParameterTable), Supervisor.retrieveOrder(java.lang.String, java.lang.String)
Method Detail

resetCredit

public void resetCredit()
Reinitializes this credit object to the state it had when it was first instantiated. This method ensures that:

createCassetteCredit

public void createCassetteCredit(ParameterTable protocolData)
                          throws ETillAbortOperation
Cassettes should not call this method. The Framework calls this method to create a CassetteTransaction object to associate with this generic Credit. This method calls the Cassette object's newCassetteCredit method which is responsible for building the cassette's credit object.
Parameters:
protocolData - a ParameterTable that contains the protocol data parameters which were specified on the API command that is currently being processed. If no protocol data parameters were specified, a null will be passed here.
Throws:
ETillAbortOperation - thrown by the cassette to report errors.

resurrectCassetteCredit

public void resurrectCassetteCredit()
                             throws ETillAbortOperation
Cassettes should not call this method. The Framework calls this method to retrieve and reinstantiate the associated CassetteTransaction object from the database. This method calls the Cassette object's resurrectCassetteCredit method which is responsible for recreating the cassette's credit object.
Throws:
ETillAbortOperation - thrown by the cassette to report errors.

createRecord

public void createRecord(Connection conn)
                  throws ETillAbortOperation
This method should never be called directly from cassettes.

Creates a new record representing this Credit object in the ETCREDIT database table. This method is part of Credit's implementation of the Archivable interface. The CommitPoint object calls this method during commit processing when this Credit object is a member of the CommitPoint create list.

Note: Also calls the cassette to create the CassetteCredit in the database.

Parameters:
Connection - The JDBC Connection object used to access the database.
Throws:
ETillAbortOperation - thrown if an SQLException is caught.
See Also:
CommitPoint

updateRecord

public void updateRecord(Connection conn)
                  throws ETillAbortOperation
This method should never be called directly from cassettes.

Udates the database record that represents this Credit object in the ETCREDIT table. This method is part of Credit's implementation of the Archivable interface. The CommitPoint object calls this method during commit processing when this Credit object is a member of the CommitPoint update list.

Note: Also calls the cassette to update the CassetteCredit in the database.

Parameters:
Connection - The JDBC Connection object used to access the database.
Throws:
ETillAbortOperation - thrown if an SQLException is caught.
See Also:
CommitPoint

deleteRecord

public void deleteRecord(Connection conn)
                  throws ETillAbortOperation
This method should never be called directly from cassettes.

Deletes the database record that represents this Credit object from the ETCREDIT table. This method is part of Credit's implementation of the Archivable interface. The CommitPoint object calls this method during commit processing when this Credit object is a member of the CommitPoint delete list.

Note: Also calls the cassette to delete the CassetteCredit from the database.

Parameters:
Connection - The JDBC Connection object used to access the database.
Throws:
ETillAbortOperation - thrown if an SQLException is caught.
See Also:
CommitPoint

restoreRecord

public void restoreRecord()
                   throws ETillAbortOperation
This method should never be called directly from cassettes.

Restores the credit from the database record in the ETCREDIT Table. Also calls the cassette to resurrect the CassetteCredit from the database. This method is the Credits's implementation of the Restorable interface. The CommitPoint object calls this method during noCommit processing. when this Credit object is a member of the CommitPoint restore list.

Throws:
ETillAbortOperation - thrown if an SQLException is caught.
See Also:
CommitPoint

retrieveCredits

public static void retrieveCredits(Order currentOrder,
                                   Hashtable collection)
                            throws ETillAbortOperation
Returns the set of Credit objects that belong to the specified order. The credit objects are retrieved from the database.
Parameters:
currentOrder - the Order object whose credit collection is being requested.
collection - a caller-supplied Hashtable which will be populated with the credit collection. The credit number will serve as the table keys and the associated table elements will be the Credit objects.
Throws:
ETillAbortOperation - thrown if an SQLException is caught.