com.ibm.etill.framework.payapi
Class Payment

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

public final class Payment
extends Transaction
implements PSServerPaymentConstants

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

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

Among the data maintained in each Payment object are:

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

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


Field Summary
 int depositAmount
          Deprecated. Use getDepositAmount() and setDepositAmount()
 
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.PSServerPaymentConstants
APPROXIMATE_XDM_KEY_SIZE, APPROXIMATE_XDM_OBJECT_SIZE, COL_ACCOUNTNUMBER, COL_ACQUIRERID, COL_AMOUNTEXP10, COL_AMOUNTVALUE, COL_APPROVALEXPIRY, COL_APPROVESALLOWED, COL_APPROVETIME, COL_BATCHNUMBER, COL_BRANDID, COL_CURRENCY, COL_CURRENTSTATE, COL_DEPOSITAMOUNT, COL_GROWTH3, COL_MERCHANTNAME, COL_ORDERAMOUNT, COL_ORDERNUMBER, COL_ORDERSTATE, COL_ORDERTIMECREATED, COL_ORDERTIMEMODIFIED, COL_PAYMENTNUMBER, COL_PAYMENTTYPE, COL_TIMESTAMPCREATED, COL_TIMESTAMPMODIFIED, COL_UNAPPROVEDAMOUNT, PAYMENT, PAYMENTVIEW, VIEW_ACCOUNTNUMBER, VIEW_ACQUIRERID, VIEW_AMOUNTEXP10, VIEW_APPROVALEXPIRY, VIEW_APPROVESALLOWED, VIEW_APPROVETIME, VIEW_BATCHNUMBER, VIEW_CARDHOLDERID, VIEW_CURRENCY, VIEW_DEPOSITAMOUNT, VIEW_GROWTH3, VIEW_MERCHANTNAME, VIEW_ORDERAMOUNT, VIEW_ORDERNUMBER, VIEW_ORDERSTATE, VIEW_ORDERTIMECREATED, VIEW_ORDERTIMEMODIFIED, VIEW_PAYMENTAMOUNT, VIEW_PAYMENTNUMBER, VIEW_PAYMENTSTATE, VIEW_PAYMENTTIMECREATED, VIEW_PAYMENTTIMEMODIFIED, VIEW_PAYMENTTYPE, VIEW_UNAPPROVEDAMOUNT
 
Constructor Summary
Payment(Order order, String paymentNumber)
          Cassettes should never call this constructor.
 
Method Summary
 void createCassettePayment(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.
 long getApproveTime()
          Accessor method for approveTime
 long getAuthorizationExpiry()
          Accessor method for approvalExpiry
 int getDepositAmount()
          Returns the deposit amount value, without decimal point, of this Payment object.
 void resetPayment()
          Reinitializes this payment object to the state it had when it was first instantiated.
 void restoreRecord()
          This method should never be called directly from cassettes.
 void resurrectCassettePayment()
          Cassettes should not call this method.
static void retrievePayments(Order currentOrder, Hashtable collection)
          Returns the set of Payment objects that belong to the specified order.
 void setApproveTime(long time)
          setter method for approveTime
 void setApproveTime(long time, boolean doNotSetExpiration)
          Sets the ApproveTime and optionally sets the Authorization Expiration time
 void setAuthorizationExpiry(long time)
          setter method for approvalExpiry
 void setDepositAmount(int depositAmount)
          Sets the deposit amount value of this Payment object.
 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
 

Field Detail

depositAmount

public int depositAmount
Deprecated. Use getDepositAmount() and setDepositAmount()

Constructor Detail

Payment

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

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

See Also:
Supervisor.createPayment(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

resetPayment

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

createCassettePayment

public void createCassettePayment(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 Payment. This method calls the Cassette object's newCassettePayment method which is responsible for building the cassette's payment 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.

resurrectCassettePayment

public void resurrectCassettePayment()
                              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 resurrectCassettePayment method which is responsible for recreating the cassette's payment 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 Payment object in the ETPAYMENT database table. This method is part of Payment's implementation of the Archivable interface. The CommitPoint object calls this method during commit processing when this Payment object is a member of the CommitPoint create list.

Also calls the cassette to create the CassettePayment 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 Payment object in the ETPAYMENT table. This method is part of Payment's implementation of the Archivable interface. The CommitPoint object calls this method during commit processing when this Payment object is a member of the CommitPoint update list.

Note: Also calls the cassette to update the CassettePayment 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 Payment object from the ETPAYMENT table. This method is part of Payment's implementation of the Archivable interface. The CommitPoint object calls this method during commit processing when this Payment object is a member of the CommitPoint delete list.

Also calls the cassette to delete the CassettePayment 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 payment from the database record in the ETPAYMENT Table. Also calls the cassette to resurrect the CassettePayment from the database. This method is the Payment's implementation of the Restorable interface. The CommitPoint object calls this method during noCommit processing. when this Payment object is a member of the CommitPoint restore list.

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

retrievePayments

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

getDepositAmount

public int getDepositAmount()
Returns the deposit amount value, without decimal point, of this Payment 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 depAmountValue = trx.getDepositAmount(); int amounttExp10Value = trx.getOrder().getAmount().getAmountExp10(); short currencyValue = trx.getOrder().getAmount().getCurrency(); ...
Returns:
int - the deposit amount value, without decimal point.

setDepositAmount

public void setDepositAmount(int depositAmount)
Sets the deposit amount value of this Payment object.
Parameters:
amount - an int containing the deposit amount value.

getApproveTime

public long getApproveTime()
Accessor method for approveTime

getAuthorizationExpiry

public long getAuthorizationExpiry()
Accessor method for approvalExpiry

setApproveTime

public void setApproveTime(long time)
setter method for approveTime
Parameters:
time - the payment approve time in milliseconds since Jan 1 1970 UTC format

setApproveTime

public void setApproveTime(long time,
                           boolean doNotSetExpiration)
Sets the ApproveTime and optionally sets the Authorization Expiration time
Parameters:
time - the time in milliseconds since 1/1/1970 in UTC format
setexpiration - true imples set expiration to default value as setup in the account. If the account is not enabled it will not be set

setAuthorizationExpiry

public void setAuthorizationExpiry(long time)
setter method for approvalExpiry
Parameters:
time - the payment approval expiry time in milliseconds since Jan 1 1970 UTC format