com.konakart.bl
Class RewardPointCore

java.lang.Object
  extended by com.konakart.bl.RewardPointCore

public class RewardPointCore
extends java.lang.Object

Reward point core which is used by both the RewardPointMgr and the AdminRewardPointMgr


Field Summary
protected static org.apache.commons.logging.Log log
           
static int TX_TYPE_ADD_POINTS
          Transaction type
static int TX_TYPE_REMOVE_POINTS
          Transaction type
 
Constructor Summary
RewardPointCore()
          Constructor
 
Method Summary
 int addPoints(int customerId, int points, java.lang.String code, java.lang.String description, KKCriteria crit)
          Adds a number of reward points to the total for customer identified by the sessionId parameter.
protected  void checkRequired(java.lang.Object param, java.lang.String paramType, java.lang.String paramName)
          Throws an exception with a proper message if the required parameter is null or null or empty for the case of a string.
 int deletePoints(int customerId, int points, java.lang.String code, java.lang.String description, KKCriteria crit1, KKCriteria crit2)
          Deletes a number of reward points from the total for the customer identified by the sessionId parameter.
 void deleteReservedPoints(int customerId, int reservationId, java.lang.String code, java.lang.String description, KKCriteria crit)
          Verifies that the reservationId parameter exists and that it belongs to the customer identified by the sessionId parameter.
 int freeReservedPoints(int customerId, int reservationId, KKCriteria crit1, KKCriteria crit2)
          Verifies that the reservationId parameter exists and that it belongs to the customer identified by the sessionId parameter.
 int getReservationId(KKCriteria insertC)
          Get a unique reservation id from the counter table
 int pointsAvailable(int customerId, KKCriteria crit)
          Calculates the number of reward points available for the customer identified by the sessionId parameter.
 int reservePoints(int customerId, int points, KKCriteria crit1, KKCriteria crit2)
          Removes a number of reward points from the total for the customer identified by the sessionId parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log

TX_TYPE_ADD_POINTS

public static final int TX_TYPE_ADD_POINTS
Transaction type

See Also:
Constant Field Values

TX_TYPE_REMOVE_POINTS

public static final int TX_TYPE_REMOVE_POINTS
Transaction type

See Also:
Constant Field Values
Constructor Detail

RewardPointCore

public RewardPointCore()
                throws java.lang.Exception
Constructor

Throws:
java.lang.Exception
Method Detail

pointsAvailable

public int pointsAvailable(int customerId,
                           KKCriteria crit)
                    throws java.lang.Exception
Calculates the number of reward points available for the customer identified by the sessionId parameter.

Parameters:
customerId -
crit -
Returns:
Returns the number of points available for spending
Throws:
java.lang.Exception

addPoints

public int addPoints(int customerId,
                     int points,
                     java.lang.String code,
                     java.lang.String description,
                     KKCriteria crit)
              throws java.lang.Exception
Adds a number of reward points to the total for customer identified by the sessionId parameter.

Parameters:
customerId -
points -
code - An optional code to categorize the reason for awarding the points
description - An optional description describing why the points were awarded
crit -
Returns:
Returns the new number of points available for spending
Throws:
java.lang.Exception

deletePoints

public int deletePoints(int customerId,
                        int points,
                        java.lang.String code,
                        java.lang.String description,
                        KKCriteria crit1,
                        KKCriteria crit2)
                 throws java.lang.Exception
Deletes a number of reward points from the total for the customer identified by the sessionId parameter.

Parameters:
customerId -
points -
code -
description -
crit1 -
crit2 -
Returns:
Returns the new number of points available for spending
Throws:
java.lang.Exception

reservePoints

public int reservePoints(int customerId,
                         int points,
                         KKCriteria crit1,
                         KKCriteria crit2)
                  throws java.lang.Exception
Removes a number of reward points from the total for the customer identified by the sessionId parameter. The removed points are not deleted but reserved, so that they are no longer available for spending but may be deleted once the order has been paid for or shipped. If the order is never fulfilled, then the reserved points may be freed and returned to the available total.

Parameters:
customerId -
points -
crit1 -
crit2 -
Returns:
Returns the reservation id of the reserved points
Throws:
java.lang.Exception

deleteReservedPoints

public void deleteReservedPoints(int customerId,
                                 int reservationId,
                                 java.lang.String code,
                                 java.lang.String description,
                                 KKCriteria crit)
                          throws java.lang.Exception
Verifies that the reservationId parameter exists and that it belongs to the customer identified by the sessionId parameter. The reserved points are normally deleted once the order has been paid for or shipped. If the order is never fulfilled, then the reserved points may be freed and returned to the available total. Once deleted. the points can no longer be returned to the total.

Parameters:
customerId -
reservationId -
code -
description -
crit -
Throws:
java.lang.Exception

freeReservedPoints

public int freeReservedPoints(int customerId,
                              int reservationId,
                              KKCriteria crit1,
                              KKCriteria crit2)
                       throws java.lang.Exception
Verifies that the reservationId parameter exists and that it belongs to the customer identified by the sessionId parameter. The reserved points may be freed and returned to the available total using this API call. The method checks to see whether some or all of the points have expired while they were in the reserved state.

Parameters:
customerId -
reservationId -
crit1 -
crit2 -
Returns:
Returns the number of points available for spending
Throws:
java.lang.Exception

getReservationId

public int getReservationId(KKCriteria insertC)
                     throws org.apache.torque.TorqueException,
                            KKException
Get a unique reservation id from the counter table

Parameters:
insertC -
Returns:
Returns a unique reservation id
Throws:
org.apache.torque.TorqueException
KKException

checkRequired

protected void checkRequired(java.lang.Object param,
                             java.lang.String paramType,
                             java.lang.String paramName)
                      throws KKException
Throws an exception with a proper message if the required parameter is null or null or empty for the case of a string.

Parameters:
param -
paramType -
paramName -
Throws:
KKException


Copyright © 2011 DS Data Systems UK Ltd.