it.dtt.ca.request
Class RcRechargeRequest

java.lang.Object
  extended by it.dtt.ca.request.CARequest
      extended by it.dtt.ca.request.RcRechargeRequest

public class RcRechargeRequest
extends CARequest

This class is used to manage a recharge via return channel; the user (application) will enter the scratch card number or the credit card data and wait till connection and recharge process to be fulfilled. The connection parameters could be set by application or also set by defaults (or set top box menu).


Field Summary
static int CREDIT_CARD_MODE
          Using a credit card for the transaction In this case the transaction data array contains these fields:
- String : surname of user
- String : name of user
- String : credit card number
- GregorianCalendar : start date of credit card
- GregorianCalendar : expiry date of credit card
- double : recharge value requested
static int IP_ADDRESS
          IP address for TCP/UDP connection.
static int PASSWORD
          User password for login if needed.
static int PHONE_NUMBER
          Phone number of the server to call.
static int PORT_NUMBER
          Port number for TCP/IP connection.
static int SCRATCH_CARD_MODE
          Using a scratch card for the transaction.
static int USER
          User name for login if needed.
 
Constructor Summary
RcRechargeRequest()
          Basic constructor with no parameters definition.
RcRechargeRequest(java.lang.String phone, java.lang.String user, java.lang.String password, java.lang.String ip_address, java.lang.String port)
          Constructor with parameters' setting capabilities
 
Method Summary
 java.lang.String getRcParameter(int what)
          Used to retrieve a parameter of the connection.
 int getRechargeMode()
          Returns the mode to be used for transaction.
 java.lang.String[] getTransactionData()
          Retrieves data set to be used for the transaction
 void setRechargeMode(int mode)
          This sets method to be used to recharge the card (scratch card, credit card, ...)
 
Methods inherited from class it.dtt.ca.request.CARequest
cancel, getPrivateData, isCancelled, setPrivateData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IP_ADDRESS

public static final int IP_ADDRESS
IP address for TCP/UDP connection.

See Also:
getRcParameter(int), Constant Field Values

PASSWORD

public static final int PASSWORD
User password for login if needed.

See Also:
getRcParameter(int), Constant Field Values

PHONE_NUMBER

public static final int PHONE_NUMBER
Phone number of the server to call.

See Also:
getRcParameter(int), Constant Field Values

PORT_NUMBER

public static final int PORT_NUMBER
Port number for TCP/IP connection.

See Also:
getRcParameter(int), Constant Field Values

USER

public static final int USER
User name for login if needed.

See Also:
getRcParameter(int), Constant Field Values

SCRATCH_CARD_MODE

public static final int SCRATCH_CARD_MODE
Using a scratch card for the transaction. In this case the transaction data array contains only one field with a String representing the scratch card number to be used.

See Also:
setRechargeMode(int), Constant Field Values

CREDIT_CARD_MODE

public static final int CREDIT_CARD_MODE
Using a credit card for the transaction In this case the transaction data array contains these fields:
- String : surname of user
- String : name of user
- String : credit card number
- GregorianCalendar : start date of credit card
- GregorianCalendar : expiry date of credit card
- double : recharge value requested

See Also:
setRechargeMode(int), Constant Field Values
Constructor Detail

RcRechargeRequest

public RcRechargeRequest()
Basic constructor with no parameters definition. In this case they should be set with setter methods or taking the default ones.

See Also:
getRcParameter(int)

RcRechargeRequest

public RcRechargeRequest(java.lang.String phone,
                         java.lang.String user,
                         java.lang.String password,
                         java.lang.String ip_address,
                         java.lang.String port)
                  throws InvalidRcParametersException
Constructor with parameters' setting capabilities

Parameters:
phone - phone number to be called
user - name of the user for login
password - password used by given user for login
ip_address - address of the server
port - port number of the server
Throws:
InvalidRcParametersException
Method Detail

getRcParameter

public java.lang.String getRcParameter(int what)
                                throws InvalidRcParametersException
Used to retrieve a parameter of the connection.

Parameters:
what - the parameter that should be retrieved
Returns:
parameter value
Throws:
InvalidRcParametersException - it.dtt.ca.exception.InvalidRcParametersException if there are errors in parameters definition or if the types are not required ones

getTransactionData

public java.lang.String[] getTransactionData()
Retrieves data set to be used for the transaction

Returns:
String array with all data

setRechargeMode

public void setRechargeMode(int mode)
This sets method to be used to recharge the card (scratch card, credit card, ...)

Parameters:
mode - the mode to use for this transaction
Throws:
java.lang.IllegalArgumentException - if the recharge mode is not a supported mode
See Also:
and #CREDIT_CARD_MODE

getRechargeMode

public int getRechargeMode()
Returns the mode to be used for transaction.

Returns:
the mode used for this transaction