ibilling.client
Class Session

java.lang.Object
  extended by ibilling.client.Session

public class Session
extends java.lang.Object

Main entry point to the application. Serves as abstraction of the server. Provides methods to access server, query information and create CustomerAccount. For communication mechanism relies on SessionConnection interfaces.

Since:
1.1

Field Summary
private  SessionConnection sessionConnection
          Encapsulates communication logic (RMI vs XML)
private  SessionContext sessionContext
           
 
Constructor Summary
private Session(SessionConnection sessionConnection)
          Instantiates a new session.
 
Method Summary
 void clearSaved()
           
 CustomerAccount createCustomerAccount()
          Creates new active customer account
 CustomerAccount createCustomerAccountExtended(java.lang.String code, java.lang.Integer merchantAccountCode, java.lang.String firstName, java.lang.String lastName, java.lang.String middleName, java.lang.String title, java.lang.String suffix, java.lang.String customerAccountType, java.lang.String homePhone, java.lang.String workPhone, java.lang.String cellPhone, java.lang.String email, java.lang.String street1, java.lang.String street2, java.lang.String city, java.lang.String state, java.lang.String zipCode, java.lang.String beneficiaryInfo, java.lang.String customerAccountGroupCode, java.lang.String notes, java.util.Date birthDate)
          Creates new active customer account with the values specified
private  void createProxyCustomerAccount(ClientObject clientObject)
          Creates proxy ClientObject
 void detachSynchronized()
           
 java.util.List<AccountTransaction> findAccountTransaction(java.lang.Integer merchantAccountCode, java.lang.String code, java.lang.String accountActivityType, java.util.Date fromCreateDate, java.util.Date toCreateDate, java.lang.String customerAccountCode, java.lang.String customerAccountName, java.lang.Boolean isActiveCustomerAccount, java.lang.String itemCode, java.lang.String accountNumber, java.lang.Integer fromAmount, java.lang.Integer toAmount, java.lang.Integer fromBalance, java.lang.Integer toBalance)
          findAccountTransaction method.
 java.util.List<CustomerAccount> findCustomerAccount(java.lang.Integer merchantAccountCode, java.lang.String code, java.lang.String firstName, java.lang.String lastName, java.lang.String middleName, java.lang.String title, java.lang.String suffix, java.lang.Boolean isActive, java.util.Date fromCreateDate, java.util.Date toCreateDate, java.lang.String phone, java.lang.String email, java.lang.String zipCode, java.lang.String creditCardNumber, java.lang.String bankAccountNumber, java.lang.Integer fromBalance, java.lang.Integer toBalance, java.lang.String customerAccountGroupCode)
          Executes a search against CustomerAccount records using specified criteria.
 java.util.List<PaymentOption> findPaymentOption(java.lang.Integer merchantAccountCode, java.lang.String code, java.lang.Boolean isActive, java.util.Date fromCreateDate, java.util.Date toCreateDate, java.lang.String holderName, java.lang.String number, java.lang.String accessory, java.lang.String street1, java.lang.String street2, java.lang.String city, java.lang.String state, java.lang.String zipCode, java.lang.String paymentOptionType, java.lang.String customerAccountCode)
          Executes a search against PaymentOption records using specified criteria.
 java.util.List<PaymentPlan> findPaymentPlan(java.lang.Integer merchantAccountCode, java.lang.String code, java.util.Date fromCreateDate, java.util.Date toCreateDate, java.util.Date fromNextBillingDate, java.util.Date toNextBillingDate, java.util.Date fromFirstBillingDate, java.util.Date toFirstBillingDate, java.lang.String status, java.lang.Integer fromAmount, java.lang.Integer toAmount, java.lang.String itemCode, java.lang.String sellerCode, java.lang.String billingCycleCode, java.lang.String groupCode1, java.lang.String groupCode2, java.lang.String groupCode3, java.lang.String groupCode4, java.lang.String groupCode5, java.lang.String groupCode6, java.lang.String groupCode7, java.lang.String groupCode8, java.lang.String customerAccountCode, java.lang.String paymentOptionCode, java.lang.String paymentOptionNumber)
          findPaymentPlan method.
 AssetTransaction loadAssetTransaction(java.lang.String code)
           
 CustomerAccount loadCustomerAccount(java.lang.String code)
           
 void loadObject(ClientObject clientObject)
          Loads client object from server
 PaymentOption loadPaymentOption(java.lang.String code)
           
 PaymentPlan loadPaymentPlan(java.lang.String code)
           
 RevenueTransaction loadRevenueTransaction(java.lang.String code)
           
static Session login(java.lang.Integer merchantAccountCode, java.lang.String password)
          Performs authentication with the processing server.
static Session login(java.lang.Integer merchantAccountCode, java.lang.String password, java.util.Map<java.lang.String,java.lang.Object> config)
          Performs authentication with the processing server.
 void logout()
          Completes communication session with server by sending logout command.
 java.util.List<AccountTransaction> queryAccountTransaction(java.util.Map<java.lang.String,java.lang.Object> parameters)
          findAccountTransaction method.
 java.util.List<CustomerAccount> queryCustomerAccount(java.util.Map<java.lang.String,java.lang.Object> parameters)
          Executes a search against CustomerAccount records using specified criteria.
 java.util.List<PaymentOption> queryPaymentOption(java.util.Map<java.lang.String,java.lang.Object> parameters)
          Executes a search against PaymentOption records using specified criteria.
 java.util.List<PaymentPlan> queryPaymentPlan(java.util.Map<java.lang.String,java.lang.Object> parameters)
          findPaymentPlan method.
 void save(ClientObject clientObject)
           
 void synchronize()
           
private  CustomerAccount takeCustomerAccount(ClientObject clientObject)
          Gets the customer account.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sessionConnection

private SessionConnection sessionConnection
Encapsulates communication logic (RMI vs XML)


sessionContext

private SessionContext sessionContext
Constructor Detail

Session

private Session(SessionConnection sessionConnection)
Instantiates a new session.

Parameters:
sessionConnection - the session connection
Method Detail

login

public static Session login(java.lang.Integer merchantAccountCode,
                            java.lang.String password,
                            java.util.Map<java.lang.String,java.lang.Object> config)
Performs authentication with the processing server. Any interaction must begin with login.

Parameters:
merchantAccountCode - merchant account code
password - password
config - configuration map (see SessionConnection for key definitions)
Returns:
upon successful login return Session object, otherwise generates exception

login

public static Session login(java.lang.Integer merchantAccountCode,
                            java.lang.String password)
Performs authentication with the processing server. Any interaction must begin with login. Assumes that all configuration parameters are supplied via properties file.

Parameters:
merchantAccountCode - merchant account code
password - password
Returns:
upon successful login return Session object, otherwise generates exception

logout

public void logout()
Completes communication session with server by sending logout command. The session can no longer be used and should be discarded.


createCustomerAccount

public CustomerAccount createCustomerAccount()
Creates new active customer account

Returns:
new customer account

createCustomerAccountExtended

public CustomerAccount createCustomerAccountExtended(java.lang.String code,
                                                     java.lang.Integer merchantAccountCode,
                                                     java.lang.String firstName,
                                                     java.lang.String lastName,
                                                     java.lang.String middleName,
                                                     java.lang.String title,
                                                     java.lang.String suffix,
                                                     java.lang.String customerAccountType,
                                                     java.lang.String homePhone,
                                                     java.lang.String workPhone,
                                                     java.lang.String cellPhone,
                                                     java.lang.String email,
                                                     java.lang.String street1,
                                                     java.lang.String street2,
                                                     java.lang.String city,
                                                     java.lang.String state,
                                                     java.lang.String zipCode,
                                                     java.lang.String beneficiaryInfo,
                                                     java.lang.String customerAccountGroupCode,
                                                     java.lang.String notes,
                                                     java.util.Date birthDate)
Creates new active customer account with the values specified

Parameters:
code - the code
merchantAccountCode - the merchant account code
firstName - the first name
lastName - the last name
middleName - the middle name
title - the title
suffix - the suffix
customerAccountType - the customer account type
homePhone - the home phone
workPhone - the work phone
cellPhone - the cell phone
email - the email
street1 - the street1
street2 - the street2
city - the city
state - the state
zipCode - the zip code
beneficiaryInfo - the buyer information, if different from CustomerAccount holder
customerAccountGroupCode - the customer account group code
notes - the notes
birthDate - the birth date
Returns:
new customer account

save

public void save(ClientObject clientObject)

clearSaved

public void clearSaved()

synchronize

public void synchronize()
                 throws ClientException
Throws:
ClientException

detachSynchronized

public void detachSynchronized()

loadCustomerAccount

public CustomerAccount loadCustomerAccount(java.lang.String code)

loadPaymentOption

public PaymentOption loadPaymentOption(java.lang.String code)

loadPaymentPlan

public PaymentPlan loadPaymentPlan(java.lang.String code)

loadRevenueTransaction

public RevenueTransaction loadRevenueTransaction(java.lang.String code)

loadAssetTransaction

public AssetTransaction loadAssetTransaction(java.lang.String code)

queryCustomerAccount

public java.util.List<CustomerAccount> queryCustomerAccount(java.util.Map<java.lang.String,java.lang.Object> parameters)
                                                     throws ClientException
Executes a search against CustomerAccount records using specified criteria. See parameter names of findCustomerAccount for possible search criterias

Parameters:
parameters - parameters for search
Returns:
list of found CustomerAccounts
Throws:
ClientException - in case of communication or validation issues

findCustomerAccount

public java.util.List<CustomerAccount> findCustomerAccount(java.lang.Integer merchantAccountCode,
                                                           java.lang.String code,
                                                           java.lang.String firstName,
                                                           java.lang.String lastName,
                                                           java.lang.String middleName,
                                                           java.lang.String title,
                                                           java.lang.String suffix,
                                                           java.lang.Boolean isActive,
                                                           java.util.Date fromCreateDate,
                                                           java.util.Date toCreateDate,
                                                           java.lang.String phone,
                                                           java.lang.String email,
                                                           java.lang.String zipCode,
                                                           java.lang.String creditCardNumber,
                                                           java.lang.String bankAccountNumber,
                                                           java.lang.Integer fromBalance,
                                                           java.lang.Integer toBalance,
                                                           java.lang.String customerAccountGroupCode)
                                                    throws ClientException
Executes a search against CustomerAccount records using specified criteria.

Parameters:
merchantAccountCode - the merchant account code
code - the code - exact search
firstName - the first name - partial search is possible
lastName - the last name - partial search is possible
middleName - the middle name - exact search
title - the title - exact search
suffix - the suffix - exact search
isActive - the is active - exact search
fromCreateDate - the from create date - greater or equal
toCreateDate - the to create date - less
phone - the phone - partial search is possible
email - the email - partial search is possible
zipCode - the zip code - exact search
creditCardNumber - the credit card number - last 4 digits
bankAccountNumber - the bank account number - last 4 digits
fromBalance - the from balance - greater or equal
toBalance - the to balance - less than
customerAccountGroupCode - the customer account group code - exact search
Returns:
list of found CustomerAccounts
Throws:
ClientException - in case of communication or validation issues

findPaymentOption

public java.util.List<PaymentOption> findPaymentOption(java.lang.Integer merchantAccountCode,
                                                       java.lang.String code,
                                                       java.lang.Boolean isActive,
                                                       java.util.Date fromCreateDate,
                                                       java.util.Date toCreateDate,
                                                       java.lang.String holderName,
                                                       java.lang.String number,
                                                       java.lang.String accessory,
                                                       java.lang.String street1,
                                                       java.lang.String street2,
                                                       java.lang.String city,
                                                       java.lang.String state,
                                                       java.lang.String zipCode,
                                                       java.lang.String paymentOptionType,
                                                       java.lang.String customerAccountCode)
Executes a search against PaymentOption records using specified criteria.

Parameters:
merchantAccountCode - the merchant account code - exact search
code - the code - exact search
isActive - the is active - exact search
fromCreateDate - the from create date - greater or equal
toCreateDate - the to create date - less
holderName - the holder name - partial search is possible
number - the number - last 4 digits
accessory - the accessory - exact search
city - the city - exact search
state - the state - exact search
zipCode - the zip code - exact search
paymentOptionType - the payment option type - exact search
customerAccountCode - the customer account code - exact search
street1 - the street1 - exact search
street2 - the street2 - exact search
Returns:
list of found PaymentOptions
Throws:
ClientException - in case of communication or validation issues

queryPaymentOption

public java.util.List<PaymentOption> queryPaymentOption(java.util.Map<java.lang.String,java.lang.Object> parameters)
                                                 throws ClientException
Executes a search against PaymentOption records using specified criteria. See parameter names of findPaymentOption for possible search criterias

Parameters:
parameters - parameters for search
Returns:
list of found PaymentOptions
Throws:
ClientException - in case of communication or validation issues

findPaymentPlan

public java.util.List<PaymentPlan> findPaymentPlan(java.lang.Integer merchantAccountCode,
                                                   java.lang.String code,
                                                   java.util.Date fromCreateDate,
                                                   java.util.Date toCreateDate,
                                                   java.util.Date fromNextBillingDate,
                                                   java.util.Date toNextBillingDate,
                                                   java.util.Date fromFirstBillingDate,
                                                   java.util.Date toFirstBillingDate,
                                                   java.lang.String status,
                                                   java.lang.Integer fromAmount,
                                                   java.lang.Integer toAmount,
                                                   java.lang.String itemCode,
                                                   java.lang.String sellerCode,
                                                   java.lang.String billingCycleCode,
                                                   java.lang.String groupCode1,
                                                   java.lang.String groupCode2,
                                                   java.lang.String groupCode3,
                                                   java.lang.String groupCode4,
                                                   java.lang.String groupCode5,
                                                   java.lang.String groupCode6,
                                                   java.lang.String groupCode7,
                                                   java.lang.String groupCode8,
                                                   java.lang.String customerAccountCode,
                                                   java.lang.String paymentOptionCode,
                                                   java.lang.String paymentOptionNumber)
                                            throws ClientException
findPaymentPlan method.

Parameters:
merchantAccountCode - the merchant account code
code - the code
fromCreateDate - the from create date
toCreateDate - the to create date
fromNextBillingDate - the from next billing date
toNextBillingDate - the to next billing date
fromFirstBillingDate - the from first billing date
toFirstBillingDate - the to first billing date
status - the status
fromAmount - the from amount
toAmount - the to amount
itemCode - the item code
sellerCode - the seller code
billingCycleCode - the billing cycle code
groupCode1 - the group code1
groupCode2 - the group code2
groupCode3 - the group code3
groupCode4 - the group code4
groupCode5 - the group code5
groupCode6 - the group code6
groupCode7 - the group code7
groupCode8 - the group code8
customerAccountCode - the customer account code
Returns:
the list< client object>
Throws:
ClientException - the client exception

queryPaymentPlan

public java.util.List<PaymentPlan> queryPaymentPlan(java.util.Map<java.lang.String,java.lang.Object> parameters)
                                             throws ClientException
findPaymentPlan method.

Parameters:
parameters - the parameters
Returns:
the list< client object>
Throws:
ClientException - the client exception

findAccountTransaction

public java.util.List<AccountTransaction> findAccountTransaction(java.lang.Integer merchantAccountCode,
                                                                 java.lang.String code,
                                                                 java.lang.String accountActivityType,
                                                                 java.util.Date fromCreateDate,
                                                                 java.util.Date toCreateDate,
                                                                 java.lang.String customerAccountCode,
                                                                 java.lang.String customerAccountName,
                                                                 java.lang.Boolean isActiveCustomerAccount,
                                                                 java.lang.String itemCode,
                                                                 java.lang.String accountNumber,
                                                                 java.lang.Integer fromAmount,
                                                                 java.lang.Integer toAmount,
                                                                 java.lang.Integer fromBalance,
                                                                 java.lang.Integer toBalance)
                                                          throws ClientException
findAccountTransaction method.

Parameters:
merchantAccountCode - the merchant account code
code - the code
accountActivityType - the account activity type
fromCreateDate - the from create date
toCreateDate - the to create date
customerAccountCode - the customer account code
customerAccountName - the customer account name
isActiveCustomerAccount - the is active customer account
itemCode - the item code
accountNumber - the account number
fromAmount - the from amount
toAmount - the to amount
fromBalance - the from balance
toBalance - the to balance
Returns:
the list< client object>
Throws:
ClientException - the client exception

queryAccountTransaction

public java.util.List<AccountTransaction> queryAccountTransaction(java.util.Map<java.lang.String,java.lang.Object> parameters)
                                                           throws ClientException
findAccountTransaction method.

Parameters:
parameters - the parameters
Returns:
the list< client object>
Throws:
ClientException - the client exception

loadObject

public void loadObject(ClientObject clientObject)
                throws ClientException
Loads client object from server

Parameters:
clientObject - ClientObject
Throws:
ClientException

takeCustomerAccount

private CustomerAccount takeCustomerAccount(ClientObject clientObject)
Gets the customer account.

Parameters:
clientObject - the client object
Returns:
the customer account

createProxyCustomerAccount

private void createProxyCustomerAccount(ClientObject clientObject)
Creates proxy ClientObject

Parameters:
clientObject -