|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.etill.kitcashcassette.test.card.KitCashDriver
KitCash is a cash based internet payment protocol. Cash is stored on a 'KitCash card' and can be transferred from one KitCash card to another. All parties (consumers, merchants and banks) will have at least one KitCash card of their own.
A KitCashDriver
object allows Java code to access an imitation KitCash card. No special hardware
is required in order to run this sample cassette and test harness. Instead, the balance and card number of the
KitCash card are stored as instance variables of KitCashDriver
objects.
To start or receive a payment, you must use a KitCashTransaction
object which is returned as a
result of initializing the driver. Each payment consists of a number of message flows going between the payer and
the receiver.
To make a payment with a KitCashDriver
, you should write code as follows:
KitCashDriver driver = new KitCashDriver(1000); // construct a new driver with $10.00 on it KitCashTransaction trans = driver.init(); // initialize the driver and retrieve a transaction object KitCashMessage msg = trans.pay(20); // tell the card to start a payment for $0.20 // keep going until the KitCash card says no more messages need be sent to the receiver while ((msg != null) && msg.toBeForwarded()) { // wrap the message in a MIME message and send it to another KitCash card KitCashMessageWrapper request = new KitCashMessageWrapper("Merchant xxx", "Order no yyy", msg); KitCashMessageWrapper response = wrapper.getResponse(merchantHostName, merchantPortNumber); msg = response.getContents(); // retrieve the KitCash message from the MIME wrapper msg = trans.processMsg(msg); // get the next request message from the KitCash card }
KitCashTransaction
,
KitCashMessage
,
KitCashMessageWrapper
Constructor Summary | |
---|---|
KitCashDriver()
Constructs a new KitCash driver for a KitCash card with no money in it |
|
KitCashDriver(int b)
Constructs a new KitCash driver for a KitCash card with the given amount in it |
Method Summary | |
---|---|
int |
getBalance()
Read balance information from the KitCash CardWallet applet |
byte |
getCardNumber(int i)
Returns the ID of the KitCash card |
KitCashTransaction |
init()
Initializes the KitCash card driver |
static java.lang.String |
text(java.lang.String textID)
Returns the internationalized text for the given ID from the KitCashWallet.properties file. |
static java.lang.String |
text(java.lang.String textID,
java.lang.String[] parms)
Returns the internationalized text for the given ID from the KitCashWallet.properties file and
inserts the given parameters into the result. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public KitCashDriver()
public KitCashDriver(int b)
b
- the new balance (in cents) of the KitCash cardMethod Detail |
public int getBalance()
public byte getCardNumber(int i)
public KitCashTransaction init()
KitCashTransaction
public static java.lang.String text(java.lang.String textID)
KitCashWallet.properties
file.textID
- the code to lookup up the in the properties filetextID
public static java.lang.String text(java.lang.String textID, java.lang.String[] parms)
KitCashWallet.properties
file and
inserts the given parameters into the result.textID
- the code to lookup up the in the properties fileparms
- the parameters strings to insert into the internationalized messagetextID
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |