com.ibm.etill.kitcashcassette.test.card
Class KitCashTransaction

java.lang.Object
  |
  +--com.ibm.etill.kitcashcassette.test.card.KitCashTransaction

public class KitCashTransaction
extends java.lang.Object


Field Summary
static byte AWAITING_AMOUNT_REQ
           
static byte AWAITING_AMOUNT_RESP
           
static byte AWAITING_AUTH_REQ
           
static byte AWAITING_AUTH_RESP
           
static byte AWAITING_PAYMENT
           
static byte AWAITING_PAYMENT_RESP
           
static byte IDLE
           
 
Constructor Summary
KitCashTransaction(KitCashDriver driver)
          Constructs a new KitCashTransaction object to use for a KitCash payment transaction.
KitCashTransaction(KitCashDriver driver, byte state, int amount)
           
 
Method Summary
 byte getState()
          Returns the current state of the KitCash transaction
 KitCashMessage pay(int amount)
          Instructs the KitCash card to start a payment transaction flow and returns a message to be sent to the KitCash card of the receiver of the payment.
 KitCashMessage processMsg(KitCashMessage msg)
          Processes the given KitCash protocol message and returns a response message to be sent to the other KitCash card in the transaction.
 KitCashMessage receive(int amount)
          Instructs the KitCash card to get ready to receive a payment transaction flow.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IDLE

public static final byte IDLE

AWAITING_AUTH_REQ

public static final byte AWAITING_AUTH_REQ

AWAITING_AUTH_RESP

public static final byte AWAITING_AUTH_RESP

AWAITING_AMOUNT_REQ

public static final byte AWAITING_AMOUNT_REQ

AWAITING_AMOUNT_RESP

public static final byte AWAITING_AMOUNT_RESP

AWAITING_PAYMENT

public static final byte AWAITING_PAYMENT

AWAITING_PAYMENT_RESP

public static final byte AWAITING_PAYMENT_RESP
Constructor Detail

KitCashTransaction

public KitCashTransaction(KitCashDriver driver)
Constructs a new KitCashTransaction object to use for a KitCash payment transaction.
Parameters:
driver - the KitCash card driver

KitCashTransaction

public KitCashTransaction(KitCashDriver driver,
                          byte state,
                          int amount)
Method Detail

getState

public byte getState()
Returns the current state of the KitCash transaction
Returns:
the current state of the KitCash transaction

pay

public KitCashMessage pay(int amount)
                   throws KitCashException
Instructs the KitCash card to start a payment transaction flow and returns a message to be sent to the KitCash card of the receiver of the payment.
Parameters:
amount - the amount of the payment
Throws:
KitCashException - if the KitCash card cannot start the payment flow

processMsg

public KitCashMessage processMsg(KitCashMessage msg)
                          throws KitCashException
Processes the given KitCash protocol message and returns a response message to be sent to the other KitCash card in the transaction.
Parameters:
msg - the message to process
Returns:
the response message to be sent to the other KitCash card
Throws:
KitCashException - if the processing fails

receive

public KitCashMessage receive(int amount)
                       throws KitCashException
Instructs the KitCash card to get ready to receive a payment transaction flow.
Parameters:
amount - the amount of the payment
Throws:
KitCashException - if the KitCash card cannot accept the payment flow