|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.ibm.etill.ldbcardcassette.LdbCardBatch
The cassette batch object is responsible for performing all the cassette's batch requests (BatchOpen, BatchClose) and to manage the state of the framework batch object.
Inner Class Summary | |
class |
LdbCardBatch.AutoCloseWorkItem
The AutoCloseWorkItem object is used to automatically close an open batch as soon as possible. |
class |
LdbCardBatch.TimeOfDayWorkItem
The TimeOfDayWorkItem object is used to automatically close an open batch at a particular time of day (specified in minutes after midnight). |
Field Summary | |
private static java.lang.String |
COPYRIGHT
|
private java.lang.String |
objApprovalCode
This cassette batch attribute contains the approval code. |
private LdbCardBatch.AutoCloseWorkItem |
objAutoCloseWorkItem
This cassette batch attribute is contains a reference to a CassetteWorkItem that is used to schedule an automatic batch close. |
private LdbCardCassette |
objCassette
This cassette batch attribute contains the reference back to the cassette that owns the batch. |
private LdbCardAccount |
objCassetteAccount
This cassette batch attribute contains the reference to the cassette account object that will be used to perform transactions for this batch. |
private java.lang.Integer |
objClosedToTrans
This cassette batch attribute contains an indicator used to determine if the batch can be used for new transactions. |
private java.lang.String |
objDeclineReason
This cassette batch attribute contains the decline reason. |
private com.ibm.etill.framework.payapi.Batch |
objFrameworkBatch
This cassette batch attribute contains the reference back to the associated framework batch object. |
private LdbCardBatch.TimeOfDayWorkItem |
objTimerWorkItem
This cassette batch attribute is contains a reference to a CassetteWorkItem that is used to schedule an automatic batch close at a particular time of day. |
Constructor Summary | |
LdbCardBatch(LdbCardCassette argCassette,
com.ibm.etill.framework.payapi.Batch argFrameworkBatch)
This constructor initializes an existing cassette batch object. |
|
LdbCardBatch(LdbCardCassette argCassette,
com.ibm.etill.framework.payapi.Batch argFrameworkBatch,
com.ibm.etill.framework.payapi.ParameterTable argProtocolData)
This constructor initializes a new cassette batch object. |
Method Summary | |
void |
addCredit(com.ibm.etill.framework.payapi.Credit argFrameworkCredit)
This method is used to add a credit to a batch. |
void |
addPayment(com.ibm.etill.framework.payapi.Payment argFrameworkPayment)
This method is used to add a payment to a batch. |
void |
batchClose(com.ibm.etill.framework.cassette.BatchCloseRequest argRequest,
com.ibm.etill.framework.cassette.APIResponse argResponse)
This method is used by the cassette when it is asked to service an BatchClose request. |
void |
batchDelete(com.ibm.etill.framework.cassette.DeleteBatchRequest argRequest,
com.ibm.etill.framework.cassette.APIResponse argResponse)
This method is used by the cassette when it is asked to service an DeleteBatch request. |
void |
batchOpen(com.ibm.etill.framework.cassette.BatchOpenRequest argRequest,
com.ibm.etill.framework.cassette.APIResponse argResponse)
This method is used by the cassette when it is asked to service a BatchOpen request. |
void |
batchPurge(com.ibm.etill.framework.cassette.BatchPurgeRequest argRequest,
com.ibm.etill.framework.cassette.APIResponse argResponse)
This method is used by the cassette when it is asked to service a BatchPurge request. |
private com.ibm.etill.framework.cassette.BatchCloseRequest |
buildBatchCloseRequest()
This method is used to manufacture an internal batch close request. |
com.ibm.etill.framework.cassette.Cassette |
cassette()
This method is used by the framework to obtain the cassette object for the cassette that owns this batch. |
private void |
closeBatchForAutomaticClose()
This method is used to set the value that indicates whether or not this batch is closed due to a pending automatic batch close. |
private void |
closeBatchToNewTrans()
This method is used to set the value that indicates whether or not this batch is closed to new transactions. |
private void |
closeCredits()
This method is used to close all the credits in a closing batch. |
private void |
closePayments()
This method is used to close all the payments in a closing batch. |
void |
createRecord(java.sql.Connection argConnection)
This method is used by the framework order (a commitable object) when its commit() method discovers the cassette batch object on the framework order's create list. |
void |
deleteRecord(java.sql.Connection argConnection)
This method is used by the framework order (a commitable object) when its commit() method discovers the cassette batch object on the framework order's delete list. |
LdbCardAccount |
getAccount()
This method is used to obtain the cassette account object used to service this batch; |
java.lang.String |
getApproval()
This method is used to obtain the approval code returned by the payment engine. |
private java.lang.Integer |
getClosedToTrans()
This method is used to obtain an Integer object that indicates whether or not this batch is closed to new transactions. |
java.lang.String |
getReason()
This method is used to obtain the decline reason returned by the payment engine. |
void |
initializeServiceThreadsIfNecessary()
This method is used in two cases. |
boolean |
isBatchClosedForAutomaticClose()
This method is used to test whether or not this batch is closed to new transactions due to a pending automatic batch close. |
boolean |
isBatchClosedToNewTransactions()
This method is used to test whether or not this batch is closed to new transactions. |
private boolean |
isDeleteBatchAllowed()
This method is used to determine if it is safe to delete a batch. |
private boolean |
purgeCredits(com.ibm.etill.framework.cassette.BatchPurgeRequest argRequest,
com.ibm.etill.framework.cassette.APIResponse argResponse)
This method is used to purge all the credits in an open batch. |
private boolean |
purgePayments(com.ibm.etill.framework.cassette.BatchPurgeRequest argRequest,
com.ibm.etill.framework.cassette.APIResponse argResponse)
This method is used to purge all the payments in an open batch. |
void |
removeCredit(com.ibm.etill.framework.payapi.Credit argFrameworkCredit)
This method is used to remove a credit from a batch. |
void |
removePayment(com.ibm.etill.framework.payapi.Payment argFrameworkPayment)
This method is used to remove a payment from a batch. |
private void |
resurrectBatch()
This method is used by the cassette object to resurrect an existing cassette batch from the cassette batch database table. |
com.ibm.etill.framework.payapi.Credit |
retrieveBatchCredit(com.ibm.etill.framework.payapi.TransactionKey argKey)
This method is used by the batch object to retrieve a credit and its order into the cache. |
com.ibm.etill.framework.payapi.Payment |
retrieveBatchPayment(com.ibm.etill.framework.payapi.TransactionKey argKey)
This method is used by the batch object to retrieve a payment and its order into the cache. |
void |
scheduleAutoClose()
This method is used to automatically close this batch. |
private void |
scheduleAutoCloseIfRequired()
This method is used to determine if an automatic batch close should be scheduled and, if so, to schedule the automatic close. |
private void |
scheduleTimeOfDayCloseIfRequired()
This method is used to determine if an automatic time of day batch close should be scheduled and, if so, to schedule the automatic close. |
void |
setApproval(java.lang.String argApprovalCode)
This method is used to set the approval code. |
private void |
setClosedToTrans(java.lang.Integer argClosedToTrans)
This method is used to set the Integer object that indicates whether or not this batch is closed to new transactions. |
void |
setReason(java.lang.String argDeclineReason)
This method is used to set the decline reason. |
void |
updateRecord(java.sql.Connection argConnection)
This method is used by the framework order (a commitable object) when its commit() method discovers the cassette batch object on the framework order's update list. |
Field Detail |
private static final java.lang.String COPYRIGHT
private LdbCardCassette objCassette
private com.ibm.etill.framework.payapi.Batch objFrameworkBatch
private LdbCardAccount objCassetteAccount
private java.lang.String objApprovalCode
private java.lang.String objDeclineReason
private java.lang.Integer objClosedToTrans
private LdbCardBatch.AutoCloseWorkItem objAutoCloseWorkItem
private LdbCardBatch.TimeOfDayWorkItem objTimerWorkItem
Constructor Detail |
public LdbCardBatch(LdbCardCassette argCassette, com.ibm.etill.framework.payapi.Batch argFrameworkBatch, com.ibm.etill.framework.payapi.ParameterTable argProtocolData) throws com.ibm.etill.framework.payapi.ETillAbortOperation
argCassette
- - The cassette that owns this batch.argFrameworkBatch
- - The framework's batch object.argProtocolData
- - The protocol data parameter values
provided by the merchant system.public LdbCardBatch(LdbCardCassette argCassette, com.ibm.etill.framework.payapi.Batch argFrameworkBatch) throws com.ibm.etill.framework.payapi.ETillAbortOperation
argCassette
- - The cassette that owns this batch.argFrameworkBatch
- - The framework's batch object.Method Detail |
public void initializeServiceThreadsIfNecessary()
In either case, this method will start the cassette batch's service threads if necessary.
NOTE: This method must be called whenever a cassette batch object is constructed. Unfortunately, it cannot be called by the constructors. The cassette batch object is constructed before the framework batch object is completely initialized and the framework batch object must be completely initialized before this method is called. In order to start a service thread, a BatchCloseRequest must be constructed. This will fail if the read and write locks in the framework batch object have not been initialized.
public com.ibm.etill.framework.cassette.Cassette cassette()
private void resurrectBatch() throws com.ibm.etill.framework.payapi.ETillAbortOperation
This method is not part of the Archivable interface. The methods for the Archivable interface are passed a JDBC database connection for the operation. In this case, an ETillArchive object is constructed to provide a JDBC databaes connection.
public void createRecord(java.sql.Connection argConnection) throws com.ibm.etill.framework.payapi.ETillAbortOperation
argConnection
- - The JDBC database connection to be used
for this operation.public void updateRecord(java.sql.Connection argConnection) throws com.ibm.etill.framework.payapi.ETillAbortOperation
argConnection
- - The JDBC database connection to be used
for this operation.public void deleteRecord(java.sql.Connection argConnection) throws com.ibm.etill.framework.payapi.ETillAbortOperation
argConnection
- - The JDBC database connection to be used
for this operation.public void batchOpen(com.ibm.etill.framework.cassette.BatchOpenRequest argRequest, com.ibm.etill.framework.cassette.APIResponse argResponse) throws com.ibm.etill.framework.payapi.ETillAbortOperation
For this cassette, the payment engine does not allow a merchant to open a batch. Batches are always implictly opened as needed. The operation is always aborted.
argRequest
- - A BatchOpen batch request.argResponse
- - The response object to hold the result.public void batchClose(com.ibm.etill.framework.cassette.BatchCloseRequest argRequest, com.ibm.etill.framework.cassette.APIResponse argResponse) throws com.ibm.etill.framework.payapi.ETillAbortOperation
For this cassette, the account object is used to settle the batch. If successful, the batch will be closed with a status of balanced. Otherwise, the batch will remain open with a status of "out of balance".
argRequest
- - A BatchClose batch request.argResponse
- - The response object to hold the result.private void closePayments() throws com.ibm.etill.framework.payapi.ETillAbortOperation
private void closeCredits() throws com.ibm.etill.framework.payapi.ETillAbortOperation
public void batchPurge(com.ibm.etill.framework.cassette.BatchPurgeRequest argRequest, com.ibm.etill.framework.cassette.APIResponse argResponse) throws com.ibm.etill.framework.payapi.ETillAbortOperation
For this cassette, the method attempts to reverse every deposit and every refund in the open batch. Note that an exception thrown by either case is not considered fatal. A purge operation, by definition, does the best it can to empty the batch both locally and in the financial network. If any payment or credit cannot be removed, the purge operation continues. If this type of error occurs, human intervention may be required to synchronize the Payment Manager with the financial network.
argRequest
- - A BatchPurge batch request.argResponse
- - The response object to hold the result.private boolean purgePayments(com.ibm.etill.framework.cassette.BatchPurgeRequest argRequest, com.ibm.etill.framework.cassette.APIResponse argResponse)
argRequest
- - A BatchPurge batch request.argResponse
- - The response object to hold the result.private boolean purgeCredits(com.ibm.etill.framework.cassette.BatchPurgeRequest argRequest, com.ibm.etill.framework.cassette.APIResponse argResponse)
argRequest
- - A BatchPurge batch request.argResponse
- - The response object to hold the result.public com.ibm.etill.framework.payapi.Payment retrieveBatchPayment(com.ibm.etill.framework.payapi.TransactionKey argKey) throws com.ibm.etill.framework.payapi.ETillAbortOperation
argKey
- - The transaction key taken from the framework
batch payment list.public com.ibm.etill.framework.payapi.Credit retrieveBatchCredit(com.ibm.etill.framework.payapi.TransactionKey argKey) throws com.ibm.etill.framework.payapi.ETillAbortOperation
argKey
- - The transaction key taken from the framework
batch credit list.public void batchDelete(com.ibm.etill.framework.cassette.DeleteBatchRequest argRequest, com.ibm.etill.framework.cassette.APIResponse argResponse) throws com.ibm.etill.framework.payapi.ETillAbortOperation
argRequest
- - A DeleteBatch batch request.argResponse
- - The response object to hold the result.private boolean isDeleteBatchAllowed()
public void addPayment(com.ibm.etill.framework.payapi.Payment argFrameworkPayment)
The method must be synchronized because framework API locks do not prevent race conditions between automatic batch close requests and API requests that affect the contents of the batch (Deposit, DepositReversal, Refund and RefundReversal). Synchronizing on the cassette batch object prevents one thread from changing the contents of the batch a micro-moment after some other thread has triggered an automatic batch close.
argFrameworkPayment
- - the framework payment object to be
removed from the batch.public void removePayment(com.ibm.etill.framework.payapi.Payment argFrameworkPayment) throws com.ibm.etill.framework.payapi.ETillAbortOperation
The method must be synchronized because framework API locks do not prevent race conditions between automatic batch close requests and API requests that affect the contents of the batch (Deposit, DepositReversal, Refund and RefundReversal). Synchronizing on the cassette batch object prevents one thread from changing the contents of the batch a micro-moment after some other thread has triggered an automatic batch close.
argFrameworkPayment
- - the framework payment object to be
removed from the batch.public void addCredit(com.ibm.etill.framework.payapi.Credit argFrameworkCredit)
The method must be synchronized because framework API locks do not prevent race conditions between automatic batch close requests and API requests that affect the contents of the batch (Deposit, DepositReversal, Refund and RefundReversal). Synchronizing on the cassette batch object prevents one thread from changing the contents of the batch a micro-moment after some other thread has triggered an automatic batch close.
argFrameworkCredit
- - the framework payment credit to be
removed from the batch.public void removeCredit(com.ibm.etill.framework.payapi.Credit argFrameworkCredit) throws com.ibm.etill.framework.payapi.ETillAbortOperation
The method must be synchronized because framework API locks do not prevent race conditions between automatic batch close requests and API requests that affect the contents of the batch (Deposit, DepositReversal, Refund and RefundReversal). Synchronizing on the cassette batch object prevents one thread from changing the contents of the batch a micro-moment after some other thread has triggered an automatic batch close.
argFrameworkCredit
- - the framework credit object to be
removed from the batch.private void scheduleTimeOfDayCloseIfRequired()
private void scheduleAutoCloseIfRequired()
public void scheduleAutoClose()
This method may be used by methods in this object when they discover that the maximum batch size has been reached or by methods in a TimeOfDayWorkItem when an automatic time-of-day batch close is to be performed.
private com.ibm.etill.framework.cassette.BatchCloseRequest buildBatchCloseRequest() throws com.ibm.etill.framework.payapi.ETillAbortOperation
public LdbCardAccount getAccount()
public java.lang.String getApproval()
public java.lang.String getReason()
private java.lang.Integer getClosedToTrans()
public boolean isBatchClosedToNewTransactions()
public boolean isBatchClosedForAutomaticClose()
public void setApproval(java.lang.String argApprovalCode)
argApprovalCode
- - The new approval code returned by
the payment engine.public void setReason(java.lang.String argDeclineReason)
argDeclineReason
- - The new decline reason returned by
the payment engine.private void setClosedToTrans(java.lang.Integer argClosedToTrans)
argClosedToTrans
- - The Integer object that indicates
whether or not this batch is closed to new transactions.private void closeBatchToNewTrans()
private void closeBatchForAutomaticClose()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |