Class semper.payment.PaymentManager
All Packages Class Hierarchy This Package Previous Next Index
Class semper.payment.PaymentManager
java.lang.Object
|
+----semper.payment.PaymentManager
- public class PaymentManager
- extends Object
Payment manager. This class implements the functionality of the
main controller of the payment block. It cannot be instantiated; it
contains entirely of static methods and attributes. The init()
method of this class must be invoked before the payment block can
be used. The init() method is typically invoked during the
bootstrapping process of SEMPER.
- Version:
- $Revision: 1.49 $ $Date: 1997/04/04 13:27:57 $
- Author:
- N. Asokan ([email protected])
- See Also:
- Library
-
FREE_CHOICE
- Choice type flag to use during payment system selection negotiation:
this value makes no restrictions on what the peer can choose.
-
PURSE_LIST_AS_PAYMENT_SYSTEM_NAMES
- Return type indicator constant used in
getListOfPurses(return_type_indicator) to indicate that
a list of payment system names (String) must be returned.
-
PURSE_LIST_AS_PURSE_NAMES
- Return type indicator constant used in
getListOfPurses(return_type_indicator) to indicate that
a list of purse names (String) must be returned.
-
PURSE_LIST_AS_PURSE_REFS
- Return type indicator constant used in
getListOfPurses(return_type_indicator) to indicate
that a list of PurseReference objects must be returned.
-
SELECT_BY_PAYMENT_SYSTEM_NAME
- Selector constant used in getListOfPurses(selector, name) to indicate
that the second argument indicates a payment system name.
-
SELECT_BY_USER_NAME
- Selector constant used in getListOfPurses(selector, name) to indicate
that the second argument indicates a user name.
-
SELECT_PS_AND_SET_AMOUNT
- Choice type flag to use during payment system selection negotiation: this
value makes no restrictions on what the peer can do: he can select a
subset of the proposed list of payment systems and reset the amount
associated with each selected payment system.
-
SELECT_PS_ONLY
- Choice type flag to use during payment system selection negotiation:
this value allows the peer to select only the payment system name.
-
choosePS(ComPoint, int, Vector)
- Receive a proposed list of payment systems and corresponding amounts
from the peer along with a choice_type flag.
-
choosePS(ComPoint, int, Vector, Amount)
- Receive a proposed list of payment systems and corresponding amounts
from the peer along with a choice_type flag.
-
confirmPurse(ComPoint, ServiceType, Amount, Vector, PaymentEntity)
- Receive a confirmation request from the peer containing a single payment
system and a corresponding amount.
-
confirmPurse(ComPoint, ServiceType, Amount, Vector, Vector, PaymentEntity)
- Receive a confirmation request from the peer containing a single payment
system and a corresponding amount.
-
createPurse(String, String)
- Create a new purse and register with the payment manager.
-
deletePurse(String)
- The reverse of createPurse: remove it from the payment manager's list
as well as from the archive.
-
exchangeCurrency(Amount, Amount, boolean)
- Exchange currency.
-
getListOfAllPurses(int)
- Return the list (in the form specified by the input parameter) of
all purses registered with the manager.
-
getListOfAllPurses(int, String)
- Get the list of all purses registered with the manager which match
the specified criteria.
-
getListOfEnabledPurseClasses()
- Extract the names of purse classes that are available for use.
-
getListOfKnownPurseClasses()
- Extract the names of purse classes that the payment manager
knows about.
-
getListOfPurses(int)
- Return the list of all active purses registered with the manager.
-
getListOfPurses(int, String)
- Get the list of all active purses registered with the manager which
match the specified criteria.
-
getListOfPurses(int, String, Vector)
- Get the list of purses (from the input list) matching the specified
criteria.
-
getListOfPurses(int, Vector)
- This method takes a Vector of PurseReference objects as input along
a return type indicator.
-
getPR()
- Get a handle to the payment resources object
-
getPurseReference(String)
- Get the reference to the named purse.
-
getPurseReference(String, Vector)
- Get the reference to the named purse from the specified list of purses.
-
init()
- Initialise the static payment manager.
-
isInitialised()
- Check the initialisation status
-
registerPurseClassName(String, String)
- Tell the payment manager about a new payment module.
-
registerTransaction(PaymentTransaction, String)
- Depracated (will be removed shortly)
-
requestChoiceOfPS(ComPoint, int, Vector)
- Propose a list of payment systems and corresponding amounts to the peer
and request them to choose a subset of the payment systems.
-
requestChoiceOfPS(ComPoint, int, Vector, Amount)
- Propose a list of payment systems and an amount to the peer and request
them to choose a subset of the payment systems.
-
requestPurseConfirmation(ComPoint, PurseReference, Amount, PaymentEntity)
- Having selected a purse, request confirmation from the peer.
-
requestPurseConfirmation(ComPoint, PurseReference, Vector, PaymentEntity)
- Having selected a purse, request confirmation from the peer.
-
selectCandidatePurses(PaymentEntity, String, Amount, ServiceType, Vector, Vector, Vector)
- Select a purse locally given certain conditions.
-
selectPayingPurse(PaymentEntity, String, Amount, Vector, Vector, Vector, String)
- A specific way of selecting a purse for payment.
-
selectPurse(PaymentEntity, ServiceType, Amount, Vector, Vector)
- Select a single from the input list restricted by the results of
negotiations which is also given as input.
-
selectPurse(PaymentEntity, ServiceType, Vector)
- Select a single purse from the input list.
-
selectReceivingPurse(PaymentEntity, PaymentEntity, Amount, Vector, Vector, Vector, String)
- A specific way of selecting a purse for receiving payment.
PURSE_LIST_AS_PURSE_REFS
public final static int PURSE_LIST_AS_PURSE_REFS
- Return type indicator constant used in
getListOfPurses(return_type_indicator) to indicate
that a list of PurseReference objects must be returned.
- See Also:
- getListOfPurses
PURSE_LIST_AS_PURSE_NAMES
public final static int PURSE_LIST_AS_PURSE_NAMES
- Return type indicator constant used in
getListOfPurses(return_type_indicator) to indicate that
a list of purse names (String) must be returned.
- See Also:
- getListOfPurses
PURSE_LIST_AS_PAYMENT_SYSTEM_NAMES
public final static int PURSE_LIST_AS_PAYMENT_SYSTEM_NAMES
- Return type indicator constant used in
getListOfPurses(return_type_indicator) to indicate that
a list of payment system names (String) must be returned.
- See Also:
- getListOfPurses
SELECT_BY_USER_NAME
public final static int SELECT_BY_USER_NAME
- Selector constant used in getListOfPurses(selector, name) to indicate
that the second argument indicates a user name.
- See Also:
- getListOfPurses
SELECT_BY_PAYMENT_SYSTEM_NAME
public final static int SELECT_BY_PAYMENT_SYSTEM_NAME
- Selector constant used in getListOfPurses(selector, name) to indicate
that the second argument indicates a payment system name.
- See Also:
- getListOfPurses
FREE_CHOICE
public final static int FREE_CHOICE
- Choice type flag to use during payment system selection negotiation:
this value makes no restrictions on what the peer can choose.
- See Also:
- requestChoiceOfPS, choosePS
SELECT_PS_AND_SET_AMOUNT
public final static int SELECT_PS_AND_SET_AMOUNT
- Choice type flag to use during payment system selection negotiation: this
value makes no restrictions on what the peer can do: he can select a
subset of the proposed list of payment systems and reset the amount
associated with each selected payment system. Note that resetting of
amount is useful in situations where the amount is dependent on the
payment system used for the value transfer.
- See Also:
- requestChoiceOfPS, choosePS
SELECT_PS_ONLY
public final static int SELECT_PS_ONLY
- Choice type flag to use during payment system selection negotiation:
this value allows the peer to select only the payment system name.
- See Also:
- requestChoiceOfPS, choosePS
init
public static void init() throws PaymentServiceException
- Initialise the static payment manager.
The payment manager is a static entity -- i.e. it is never
instantiated. The initialise() method is invoked during startup.
Currently, the following actions are taken:
- If the configuration parameter
semper.payment.noListeners
is not set, then
- register an address with the comm. manager to listen for
incoming negotiation requests
- Create a PaymentResources object depending on the value of
the configuration parameter
semper.configuration.language
and include it in
the payment manager state (this is used for local language support -
currently in testing phase)
- Initialise user preferences
- Register launchabel applications with ApplicationsMenu
- Read in status from the archive
- Initialise all purses
- Pre-conditions:
- SEMPER blocks log, configuration, archive, preferences, and
tinguin must be already initialised
- Post-conditions:
- Payment block is ready for use
- Used-by: typically only the SEMPER bootstrap process needs to
use this.
- Returns:
- nothing
- Throws: PaymentServiceException
- if initialisation failed
isInitialised
public boolean isInitialised()
- Check the initialisation status
- Returns:
- false if completely uninitialised; true otherwise
getPR
public static PaymentResources getPR()
- Get a handle to the payment resources object
- Returns:
- a PayementResources object
exchangeCurrency
public static void exchangeCurrency(Amount from,
Amount to,
boolean change_from)
- Exchange currency.
The source and destination currencies are specified as part of the
the respective amount objects. One of the amount fields should be
Not Implemented Yet.
- Parameters:
- from - source amount
- from - destination amount
- change_from - flag if true, the amount specified in source
should be converted; otherwise, amount specified in
destination should be converted.
- Returns:
- nothing
getListOfAllPurses
public static Vector getListOfAllPurses(int return_type_indicator) throws PaymentServiceException
- Return the list (in the form specified by the input parameter) of
all purses registered with the manager.
- Parameters:
- return_type_indicator - flag indicating the type of items to be
returned can be one of:
- PurseReference (
PURSE_LIST_AS_PURSE_REFS)
),
- purse name, (
PURSE_LIST_AS_PURSE_NAMES
), or
- payment system
name
(PURSE_LIST_AS_PAYMENT_SYSTEM_NAME
)
- Returns:
- Vector representing list of purses (type of elements in
the vector depends on the return_type_indicator)
- Throws: PaymentServiceException
- for misc. errors
- See Also:
- PurseReference, Purse, getListOfAllPurses, getListOfPurses
getListOfPurses
public static Vector getListOfPurses(int return_type_indicator) throws PaymentServiceException
- Return the list of all active purses registered with the manager.
Active purses are those that have been successfully initialised already.
- Pre-conditions: Payment manager should be initialised
- Parameters:
- return_type_indicator - flag indicating the type of items to be
returned can be one of:
- PurseReference (
PURSE_LIST_AS_PURSE_REFS)
),
- purse name, (
PURSE_LIST_AS_PURSE_NAMES
), or
- payment system
name
(PURSE_LIST_AS_PAYMENT_SYSTEM_NAME
)
- Returns:
- Vector representing list of purses (type of elements in
the vector depends on the return_type_indicator)
- Throws: PaymentServiceException
- for misc. errors
- See Also:
- PurseReference, Purse, getListOfPurses, getListOfAllPurses
getListOfPurses
public static Vector getListOfPurses(int return_type_indicator,
Vector purserefs) throws PaymentServiceException
- This method takes a Vector of PurseReference objects as input along
a return type indicator. Depending on the latter, it returns a Vector
of objects that describe the original list in different ways. The
returned Vector is derived from a copy of the input Vector
(i.e. changes to the returned Vector will have no effect on the original
Vector)
- Parameters:
- return_type_indicator - flag indicating the type of items to be
returned (can be one of: PurseReference, purse name,
or payment system name.)
- Returns:
- Vector representing list of purses (type of elements in
the vector depends on the return_type_indicator)
- Throws: PaymentServiceException
- for misc. errors
- See Also:
- PurseReference, Purse
getListOfPurses
public static Vector getListOfPurses(int selector,
String name) throws PaymentServiceException
- Get the list of all active purses registered with the manager which
match the specified criteria.
The criteria can be one of:
- Payment System name (SELECT_BY_PAYMENT_SYSTEM_NAME)
- User name (not supported yet) (SELECT_BY_USER_NAME)
Active purses are those that have been successfully initialised already.
- Parameters:
- selector - flag describing the selector
- name - value of the selector parameter
- Returns:
- a list of PurseReference objects
- Throws: PaymentServiceException
- on misc errors
- See Also:
- getListOfAllPurses, getListOfPurses
getListOfAllPurses
public static Vector getListOfAllPurses(int selector,
String name) throws PaymentServiceException
- Get the list of all purses registered with the manager which match
the specified criteria.
The criteria can be one of:
- Payment System name (SELECT_BY_PAYMENT_SYSTEM_NAME)
- User name (not supported yet) (SELECT_BY_USER_NAME)
- Parameters:
- selector - flag describing the selector
- name - value of the selector parameter
- Returns:
- a list of PurseReference objects
- Throws: PaymentServiceException
- on misc errors
- See Also:
- getListOfPurses, getListOfAllPurses
getListOfPurses
public static Vector getListOfPurses(int selector,
String name,
Vector purse_refs) throws PaymentServiceException
- Get the list of purses (from the input list) matching the specified
criteria.
The criteria can be one of:
- Payment System name (SELECT_BY_PAYMENT_SYSTEM_NAME)
- User name (not supported yet) (SELECT_BY_USER_NAME)
- Parameters:
- selector - flag describing the selector
- name - value of the selector parameter
- purse_refs - Vector of PurseReference objects
- Returns:
- a list of PurseReference objects
- Throws: PaymentServiceException
- on misc errors
- See Also:
- PurseReference, getListOfPurses
getPurseReference
public static PurseReference getPurseReference(String purse_name)
- Get the reference to the named purse.
- Parameters:
- purse_name - distinguished name of purse.
- Returns:
- a purse reference object pointing to the specified purse
- See Also:
- getPurseReference
getPurseReference
public static PurseReference getPurseReference(String purse_name,
Vector purse_refs)
- Get the reference to the named purse from the specified list of purses.
- Parameters:
- purse_name - distinguished name of purse.
- purse_refs - Vector containing PurseReference objects.
- Returns:
- a purse reference object pointing to the specified purse
- See Also:
- getPurseReference
registerPurseClassName
public static synchronized void registerPurseClassName(String key,
String purse_class)
- Tell the payment manager about a new payment module. Installation
scripts of payment modules should use this method to register their
name with the payment manager. The registered names will be used by the
PurseManagement class to provide a user interface to create
new purses. If the "isEnabled()" method of the indicated class
returns "true", then the class is marked as available for
creating purses.
- Used-by: Payment module/adapter installation program(s)
- Parameters:
- key - short form string tag for the payment system (e.g. "generic");
- purse_class - describing the purse class name
(e.g. "semper.payment.generic.genericPurse")
- Returns:
- nothing
- See Also:
- isEnabled
getListOfKnownPurseClasses
public static Hashtable getListOfKnownPurseClasses()
- Extract the names of purse classes that the payment manager
knows about.
- Returns:
- Hashtable containing a list of string pairs
getListOfEnabledPurseClasses
public static Hashtable getListOfEnabledPurseClasses()
- Extract the names of purse classes that are available for use. Enabled
purse classes are those for which the
isEnabled
method has
returned true.
- Returns:
- Hashtable containing a list of string pairs
- See Also:
- isEnabled
createPurse
public static Purse createPurse(String purse_class_name,
String purse_name) throws AdapterNotFound, PaymentServiceException
- Create a new purse and register with the payment manager.
This is the "official" was to create a new purse. The following
actions are taken during the execution of this method:
- Create a new Purse object of the specified Purse subclass (the
Purse subclass should provide a constructor with no arguments
for this purpose)
- Generate an archive handle with a standard structure and store
the purse in the archive with that handle
- Add the purse to the payment manager's list of purses
It is also ensure that the purse name is unique.
- Parameters:
- purse_class_name - name of the purse class (e.g. ikpPurse)
- purse_name - name of the new purse
- Returns:
- reference to the created purse
- Throws: PaymentServiceException
- for misc errors
- Throws: AdapterNotFound
- if one attempts to
create a purse from a non-existent payment module
- Throws: IllegalArgumentException
- when a purse by the
specified name already exists.
- See Also:
- deletePurse
deletePurse
public static void deletePurse(String purse_name) throws PaymentServiceException
- The reverse of createPurse: remove it from the payment manager's list
as well as from the archive.
- Parameters:
- purse_name - distinguished name of purse to remove
- Throws: PaymentServiceException
- on failure
- See Also:
- createPurse
registerTransaction
public static long registerTransaction(PaymentTransaction tr,
String ext_ref) throws PaymentServiceException
- Depracated (will be removed shortly)
- Parameters:
- tr - reference to the PaymentTransaction object
- ext_ref - external reference string corresponding to the object
- Returns:
- assigned transaction ID
- Throws: PaymentServiceException
- on misc. errors
selectCandidatePurses
public static Vector selectCandidatePurses(PaymentEntity peer,
String my_alias,
Amount amount,
ServiceType service_type,
Vector PS_list,
Vector purse_name_list,
Vector options) throws PaymentServiceException
- Select a purse locally given certain conditions. There is no
negotiation with peer or user involved in this method. User interaction
_may_ be involved. For now, all parameters except PS_list are ignored and
the list of all available purses is returned always. But this will
change!
- Parameters:
- peer - the entity with whom we plan to engage in a transaction
using one of the selected purses
- my_alias - the name by which I am known to the peer;
only those purses that have this string as the "username"
will be chosen (some purses can have wildcard usernames?)
- amount - the amount we tentatively plan to transfer
- service_type - flag indicating the type of service for
which the purse is being selected. Use the
enumerations defined in the ServiceType class hierarchy.
- PS_list - list of acceptable payment systems (Vector of Strings)
- purse_name_list - list of names of acceptable purses (Vector of
Strings); if this is null, all available purses are
treated as candidates.
- options - list of security attributes required for the proposed
transaction (Vector of SecurityOption objects)
- Returns:
- the list of selected purses (Vector of PurseReference objects)
- Throws: PaymentServiceException
- for miscellaneous errors
- See Also:
- PurseReference, SecurityOption, PaymentEntity
selectPurse
public static PurseReference selectPurse(PaymentEntity peer,
ServiceType service_type,
Vector candidate_purserefs)
- Select a single purse from the input list.
This selection will be eventually based on:
- preferences,
- interaction with the user,
- etc.
There is no negotiation with the peer involved in this method.
For now, it is simple and stupid: select the first element of the list.
- Parameters:
- peer - the entity with whom we plan to engage in a transaction
using one of the selected purses
- service_type - flag indicating the type of service for
which the purse is being selected. Use the
enumerations defined in the ServiceType class
hierarchy.
- candidate_purserefs - list of candidate purses (Vector of
PurseReference objects)
- Returns:
- the PurseReference object corresponding to the selected purse.
selectPurse
public static PurseReference selectPurse(PaymentEntity peer,
ServiceType service_type,
Amount amount,
Vector candidate_purses,
Vector PIM_shortlist) throws PaymentServiceException
- Select a single from the input list restricted by the results of
negotiations which is also given as input. There is no direct negotiation
with the peer involved in this method.
This selection will be eventually based on:
- preferences,
- interaction with the user,
- etc.
For now, it is simple and stupid: depending on how the user has set
her preferences, either it asks the user or it makes an arbitrary choice.
- Parameters:
- peer - the entity with whom we plan to engage in a transaction
using one of the selected purses
- service_type - flag indicating the type of service for
which the purse is being selected. Use the
enumerations defined in the ServiceType class hierarchy.
- amount - the amount to be transferred in the proposed
transaction. If the selected item from the PIM_shortlist
has an different amount, then the value of this parameter
will be reset accordingly. The caller should therefore
examine the value of this parameter on return.
- PIM_shortlist - Vector of PaymentInformationMessage representing
the negotiated shortlist
- candidate_purses - a Vector of PurseReference objects
representing the candidate purses
- Returns:
- the PurseReference object corresponding to the selected
purse.
- Throws: PaymentServiceException
- for misc. errors
- See Also:
- PaymentInformationMessage
requestChoiceOfPS
public static Vector requestChoiceOfPS(ComPoint c,
int choice_type,
Vector PS_list,
Amount amount) throws ComPointException, PaymentServiceException
- Propose a list of payment systems and an amount to the peer and request
them to choose a subset of the payment systems. The choice_type flag
indicates how the peer should carry out his choice. In particular, if
the peer is also allowed to set a different amount than the one
proposed, the value of the amount parameter will be updated on return.
- Parameters:
- c - an already open communication channel
- choice_type - flag indicating restrictions on how the peer can
choose. This flag can take one of the following values:
- FREE_CHOICE
- SELECT_PS_AND_SET_AMOUNT
- SELECT_PS_ONLY
- PS_list - list of proposed payment systems
- amount - proposed amount
- Returns:
- a Vector of PaymentInformationMessage objects representing the
payment systems and corresponding amounts chosen by the peer
- Throws: ComPointException
- on communication errors
- Throws: PaymentServiceException
- on miscellaneous errors
- See Also:
- requestChoiceOfPS, PaymentInformationMessage
requestChoiceOfPS
public static Vector requestChoiceOfPS(ComPoint c,
int choice_type,
Vector PIM_list) throws ComPointException, PaymentServiceException
- Propose a list of payment systems and corresponding amounts to the peer
and request them to choose a subset of the payment systems. The
choice_type flag indicates how the peer should carry out his choice.
In particular, if the peer is also allowed to set a different amount than
the one proposed, the value of the amount parameter will be updated on
return.
- Parameters:
- c - an already open communication channel
- choice_type - flag indicating restrictions on how the peer can
choose. This flag can take one of the following values:
- FREE_CHOICE
- SELECT_PS_AND_SET_AMOUNT
- SELECT_PS_ONLY
- PIM_list - proposal list in the form of a Vector of
PaymentInformationMessage objects
- Returns:
- a Vector of PaymentInformationMessage objects representing the
payment systems and corresponding amounts chosen by the peer
- Throws: ComPointException
- on communication errors
- Throws: PaymentServiceException
- on miscellaneous errors
- See Also:
- choosePS, MessageListHead, PaymentInformationMessage
choosePS
public static Vector choosePS(ComPoint c,
int choice_type,
Vector PS_list,
Amount amount) throws PaymentServiceException, ComPointException
- Receive a proposed list of payment systems and corresponding amounts
from the peer along with a choice_type flag. Choose a subset of the
payment systems based on the input list of payment systems and the peer's
proposals.
- Parameters:
- c - an already open communication channel
- choice_type - flag indicating restrictions that the peer can
impose on us for the choice. It can be one of:
- FREE_CHOICE
- SELECT_PS_AND_SET_AMOUNT
- SELECT_PS_ONLY
if it is anything other than FREE_CHOICE, the peer's
choice_type should agree with our choice_type
- PS_list - list of payment systems we are willing to use in the
proposed transaction.
- amount - proposed amount
- Returns:
- a Vector of PaymentInformationMessage objects representing the
payment systems and corresponding amounts chosen by the peer
- Throws: ComPointException
- on communication errors
- Throws: PaymentServiceException
- on miscellaneous errors
- See Also:
- choosePS, MessageListHead, PaymentInformationMessage
choosePS
public static Vector choosePS(ComPoint c,
int choice_type,
Vector PIM_list) throws PaymentServiceException, ComPointException
- Receive a proposed list of payment systems and corresponding amounts
from the peer along with a choice_type flag. Choose a subset of the
payment systems based on the input list of payment systems and the peer's
proposals.
- Parameters:
- c - an already open communication channel
- choice_type - flag indicating restrictions that the peer can
impose on us for the choice. It can be one of:
- FREE_CHOICE
- SELECT_PS_AND_SET_AMOUNT
- SELECT_PS_ONLY
if it is anything other than FREE_CHOICE, the peer's
choice_type should agree with our choice_type
- PIM_list - our proposals list in the form of a Vector of
PaymentInformationMessage objects
- Returns:
- a Vector of PaymentInformationMessage objects representing the
payment systems and corresponding amounts chosen by the peer
- Throws: ComPointException
- on communication errors
- Throws: PaymentServiceException
- on miscellaneous errors
- See Also:
- requestChoiceOfPS, PaymentInformationMessage
requestPurseConfirmation
public static boolean requestPurseConfirmation(ComPoint c,
PurseReference my_purse,
Amount amount,
PaymentEntity peer) throws ComPointException, PaymentServiceException
- Having selected a purse, request confirmation from the peer.
Exchange all parameters required for subsequent payment: e.g. the address
to which payment protocol messages should be sent. This is a cover
method that builds a Vector containing a single
PaymentInformationMessage object and passes it to the second type
of requestPurseConfirmation() method.
- Parameters:
- c - an already open channel
- my_purse - reference to the selected purse
- amount - proposed amount of the transaction
- peer - address of the peer entity to which subsequent payment
system protocol messages should be sent. This negotiation
is currently not supported.
- Returns:
- true/false indicating whether the confirmation succeeded
- Throws: ComPointException
- for communication errors
- Throws: PaymentServiceException
- if purse cannotbe retrieved
- See Also:
- PurseReference, PaymentInformationMessage, requestPurseConfirmation, confirmPurse
requestPurseConfirmation
public static boolean requestPurseConfirmation(ComPoint c,
PurseReference my_purseref,
Vector short_list,
PaymentEntity peer) throws ComPointException, PaymentServiceException
- Having selected a purse, request confirmation from the peer.
Exchange all parameters required for subsequent payment: e.g. the address
to which payment protocol messages should be sent.
- Parameters:
- c - an already open channel
- my_purse - reference to the selected purse
- short_list - the short list (a Vector of
PaymentInformationMessage objects) used earlier during the
purse selection process. The amount will be taken from the
first element in this short_list that corresponds to the
chosen purse
- peer - address of the peer entity to which subsequent payment
system protocol messages should be sent. This negotiation
is currently not supported.
- Returns:
- true/false indicating whether the confirmation succeeded
- Throws: ComPointException
- for communication errors
- Throws: PaymentServiceException
- for misc errors
- See Also:
- PaymentInformationMessage, confirmPurse
confirmPurse
public static PurseReference confirmPurse(ComPoint c,
ServiceType service_type,
Amount amount,
Vector candidate_purses,
PaymentEntity peer) throws ComPointException, PaymentServiceException
- Receive a confirmation request from the peer containing a single payment
system and a corresponding amount. Decide if it is an acceptable choice
based on our own input parameters. Choose a single purse from the list
available to us. Set any other parameters necessary
for subsequent protocol flows inside the chosen payment system.
This is just a cover method that builds a Vector containing
PaymentInformationMessage objects (one per available purse),
invokes the second confirmPurse() method passing this Vector as a
parameter, checks to make sure that the amount proposed by the peer
agrees with our amount and returns the selected purse.
TODO: This is ugly. Come back and check this later. Should we need
switches to decide whether the responder is allowed to change the
amount or not?
- Parameters:
- c - an already open channel
- service_type - flag indicating the type of service for
which the purse is being selected. Use the
enumerations defined in the ServiceType class hierarchy.
- amount - proposed amount for the transaction (must match
what the peer proposes)
- candidate_purses - list of candidate purses
- peer - location to return the address to which subsequent
payment system protocol messages should be sent.
- Throws: ComPointException
- for communication errors
- Throws: PaymentServiceException
- for misc errors
- See Also:
- requestPurseConfirmation, confirmPurse, PaymentInformationMessage
confirmPurse
public static PurseReference confirmPurse(ComPoint c,
ServiceType service_type,
Amount amount,
Vector PIM_list,
Vector candidate_purses,
PaymentEntity peer) throws ComPointException, PaymentServiceException
- Receive a confirmation request from the peer containing a single payment
system and a corresponding amount. Decide if it is an acceptable choice
based on our own input parameters. Choose a single purse from the list
available to us. Set any other parameters necessary
for subsequent protocol flows inside the chosen payment system.
- Parameters:
- c - an already open channel
- service_type - flag indicating the type of service for
which the purse is being selected. Use the
enumerations defined in the ServiceType class
hierarchy.
- amount - location to return the value of the agreed upon amount
- PIM_list - list of acceptable combinations in the form of a
Vector of PaymentInformationMessage objects.
- candidate_purses - list of candidate purses
- peer - location to return the address to which subsequent
payment system protocol messages should be sent.
- Throws: ComPointException
- for communication errors
- Throws: PaymentServiceException
- for misc errors
- See Also:
- requestPurseConfirmation, PaymentInformationMessage
selectPayingPurse
public static PurseReference selectPayingPurse(PaymentEntity peer,
String my_alias,
Amount amount,
Vector PS_list,
Vector purse_name_list,
Vector options,
String ext_ref) throws PaymentServiceException, ComPointException
- A specific way of selecting a purse for payment.
There are many ways in which the various purse selection methods
(both local and negotiated) can be combined. This method
implements one such combination with certain policy assumptions
for selecting a purse for payment. These assumptions are:
- the payee is allowed to choose a subset of the payment
systems that we propose _and_ to reset the amount we propose
to pay.
- Parameters:
- peer - entity to which we propose to make a payment
- my_alias - the alias by which I am known to the peer
- amount - the amount we propose to pay
- PS_list - the payment systems we are prepared to use.
This parameter is a Vector of Strings. If it is null, all
payment systems are considered to be candidates.
- purse_name_list - the list of purses that we are
prepared to use (this parameter is not used yet).
This parameter os a Vector of Strings. If it is
null, all purses are considered to be candidates.
- options - list of security options required. This
parameter is a Vector SecurityOption objects.
- ext_ref - external reference string
- Returns:
- reference to the selected purse.
- Throws: ComPointException
- on communication errors.
- Throws: PaymentServiceException
- on misc. errors.
- See Also:
- selectReceivingPurse, SecurityOption
selectReceivingPurse
public static PurseReference selectReceivingPurse(PaymentEntity peer,
PaymentEntity me,
Amount amount,
Vector PS_list,
Vector purse_name_list,
Vector options,
String ext_ref) throws PaymentServiceException, ComPointException
- A specific way of selecting a purse for receiving payment.
There are many ways in which the various purse selection methods
(both local and negotiated) can be combined. This method
implments one such combination with certain policy assumptions
for selecting a purse for receiving payment. These assumptions are:
- the payee is allowed to choose a subset of the payment
systems that we propose _and_ to reset the amount we propose
to pay.
- Parameters:
- peer - entity from whom we propose to receive a payment
- me - PaymentEntity object indicating where we should
listen to in order to open a negotiation channel
- amount - the amount we propose to receive
- PS_list - the payment systems we are prepared to use. This
parameter is a Vector of Strings. If it is null, all payment
systems are considered to be candidates.
- purse_name_list - the list of purses that we are
prepared to use (this parameter is not used yet).
This parameter os a Vector of Strings. If it is null
all purses are considered to be candidates.
- options - list of security options required. This
parameter is a Vector SecurityOption objects.
- ext_ref - external reference string sent by the peer
- Returns:
- reference to the selected purse.
- Throws: ComPointException
- on communication errors.
- Throws: PaymentServiceException
- on misc. errors.
- See Also:
- selectPayingPurse, SecurityOption
All Packages Class Hierarchy This Package Previous Next Index