Each service described in the PurseServices interface has a
corresponding 'start' method in this interface
(e.g. "startPay()). Each such start method should:
include the token in the TokenCapsule object returned to
the caller.
Subsequent steps in the protocol are carried out by calling the
"processToken" method.
Example Usage:
Assuming that a purse "p" has been chosen and a ComPoint "c" has
been opened for communication with the peer, a payment proceeds as
follows:
TokenCapsule mesg=null;
TokenCapsule reply=null;
tr = p.startTransaction();
mesg = tr.startPay(<other params>,R_ANY,<other params>);
for (;;) {
Object token = mesg.getToken();
if (token != null) {
// We have an output token; so send it to peer.
c.write(token);
}
// Check if we should wait for a token from the peer
if (mesg.getTokenStatus() == TokenCapsule.S_COMPLETED) break;
// put code here to deal with other status values
Object r_token = c.read();
reply = new TokenCapsule (r_token, .....);
mesg = tr.processToken(reply);
}
- Version:
- $Revision: 1.3 $ $Date: 1997/03/14 09:38:05 $
- Author:
- N. Asokan ([email protected])
- See Also:
- PurseServices, ComPoint
-
R_ANY
- Role: any (in this case, the adapter will assign a default role -- if
the default assigned role is "responder", the TokenCapsule object
returned should contain a null token indicating that the application has
nothing to send in the current protocol step.
-
R_INITIATOR
- Role: initiator
-
R_RESPONDER
- Role: responder; the TokenCapsule object returned should contain a
null token.
-
processToken(TokenCapsule)
- Process an intermediate token in a protocol.
-
startPay(PaymentEntity, Amount, Vector, int, String)
- Start the protocol for moving a specified amount from payer to payee.
-
startReceivePayment(PaymentEntity, Amount, Vector, int, String)
- Start the protocol for accepting an incoming payment from a payer.
-
startReversePayment(int, PaymentTransactionRecord)
- Start the protocol for reversal of a previously made payment.
-
startReverseReceivedPayment(int, PaymentTransactionRecord)
- Process request for reversing a previously received payment.
R_ANY
public final static int R_ANY
- Role: any (in this case, the adapter will assign a default role -- if
the default assigned role is "responder", the TokenCapsule object
returned should contain a null token indicating that the application has
nothing to send in the current protocol step.
R_INITIATOR
public final static int R_INITIATOR
- Role: initiator
R_RESPONDER
public final static int R_RESPONDER
- Role: responder; the TokenCapsule object returned should contain a
null token.
startPay
public abstract TokenCapsule startPay(PaymentEntity payee,
Amount amount,
Vector options,
int role,
String ext_ref) throws PaymentServiceException
- Start the protocol for moving a specified amount from payer to payee.
- Parameters:
- payee - Object containing necessary information to
identify the recipient
- amount - Amount to be moved
- options - List of options for the transaction (Vector of
SecurityOption objects)
- role - integer flag indicating the role of this player
- ext_ref - External reference string
- Returns:
- TokenCapsule object containing the first token to
be sent to peer.
- Throws: PaymentServiceException
- for misc errors
- See Also:
- receivePayment, startReceivePayment, SecurityOption
startReceivePayment
public abstract TokenCapsule startReceivePayment(PaymentEntity payer,
Amount amount,
Vector options,
int role,
String ext_ref) throws PaymentServiceException
- Start the protocol for accepting an incoming payment from a payer.
- Parameters:
- payer - Object containing necessary information to
identify the payer
- options - List of options for the transaction (Vector of
SecurityOption objects)
- amount - Amount to be moved
- role - integer flag indicating the role of this player
- ext_ref - External reference string
- Returns:
- TokenCapsule object containing the first token to
be sent to peer.
- Throws: PaymentServiceException
- for misc errors
- See Also:
- pay, startPay, SecurityOption
startReversePayment
public abstract TokenCapsule startReversePayment(int role,
PaymentTransactionRecord ref) throws PaymentServiceException
- Start the protocol for reversal of a previously made payment.
- Parameters:
- ref - PaymentTransaction object corresponding to
the payment to be reversed.
- role - integer flag indicating the role of this player
- Returns:
- TokenCapsule object containing the first token to
be sent to peer.
- Throws: PaymentServiceException
- for misc errors
- See Also:
- pay
startReverseReceivedPayment
public abstract TokenCapsule startReverseReceivedPayment(int role,
PaymentTransactionRecord ref) throws PaymentServiceException
- Process request for reversing a previously received payment.
- Parameters:
- ref - PaymentTransaction object corresponding to
the payment to be reversed.
- role - integer flag indicating the role of this player
- Returns:
- TokenCapsule object containing the first token to
be sent to peer.
- Throws: PaymentServiceException
- for misc errors
- See Also:
- receivePayment
processToken
public abstract TokenCapsule processToken(TokenCapsule mesg) throws PaymentServiceException
- Process an intermediate token in a protocol.
TODO: More explanation.
- Parameters:
- mesg - TokenCapsule containing the token sent by the peer
- Returns:
- TokenCapsule object containing the next token to be sent
to the peer.
- Throws: PaymentServiceException
- on misc. errors
All Packages Class Hierarchy This Package Previous Next Index