atg.commerce.claimable
Class ClaimableManager

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.claimable.ClaimableManager
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class ClaimableManager
extends GenericService

This class is intended to encapsulate all of the business logic needed to interact with the claimable repository. For example, this knows how to create, initialize and delete items that exist in the repository. Right now, the two types of claimable items that it can deal with are:

This class uses the ClaimableTools package to interact with the claimable repository on a lower level.

See Also:
ClaimableTools

Field Summary
static java.lang.String CLASS_VERSION
           
protected static java.lang.String INVALID_GIFTCERT_ID_PARAMETER
           
protected static java.lang.String INVALID_INITIAL_GIFTCERTIFICATE_PARAMETER
           
protected static java.lang.String INVALID_INITIAL_PROMOTION_PARAMETER
           
protected static java.lang.String INVALID_STORECREDIT_ID_PARAMETER
           
protected static java.lang.String MSG_INSUFFICIENT_AUTH
           
protected static java.lang.String MSG_INSUFFICIENT_AUTH_FOR_DEBIT
           
protected static java.lang.String MSG_INSUFFICIENT_CRED
           
protected static java.lang.String MSG_INSUFFICIENT_EXP_AMT
           
protected static java.lang.String MSG_INSUFFICIENT_FUNDS
           
protected static java.lang.String MSG_INSUFFICIENT_SC_AUTH
           
protected static java.lang.String MSG_INSUFFICIENT_SC_AUTH_FOR_DEBIT
           
protected static java.lang.String MSG_INSUFFICIENT_SC_CRED
           
protected static java.lang.String MSG_INSUFFICIENT_SC_EXP_AMT
           
protected static java.lang.String MSG_INSUFFICIENT_SC_FUNDS
           
protected static java.lang.String MSG_UNABLE_TO_CLAIM
           
protected static java.util.ResourceBundle sPromotionResourceBundle
          Promotion Resource Bundle Used in claimCoupon for backwards compatibility
protected static java.util.ResourceBundle sResourceBundle
          Resource Bundle
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
ClaimableManager()
          Empty Constructor
 
Method Summary
 void authorizeClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId, double pAmount)
          This method will authorize a gift certificate for the amount identified by the parameter pAmount.
 void authorizeClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId, java.lang.Double pAmount)
          Deprecated. use authorizeClaimableGiftCertificate(String, double) instead
 void authorizeClaimableStoreCredit(java.lang.String pClaimableStoreCreditId, double pAmount)
          This method will authorize a store credit for the amount identified by the parameter pAmount.
 boolean checkExpireDate(RepositoryItem pClaimableItem)
          Check whether the ClaimableItem is expired or not
 boolean checkPromotionType(RepositoryItem pPromotion)
          Checks to see if the type of the promotion is valid.
 void claimCoupon(java.lang.String pProfileId, java.lang.String pCouponClaimCode)
          This method will attempt to claim the given coupon for the given user.
 RepositoryItem claimItem(java.lang.String pId)
          This method will claim an item from the repository.
 RepositoryItem[] claimItems(java.lang.String[] pIds)
          Same as the claimItem method except can take an array argument.
 RepositoryItem createClaimableGiftCertificate()
          Will create a gift certificate in the claimable repository.
 RepositoryItem createClaimablePromotion()
          Will create a coupon in the claimable repository.
 RepositoryItem createClaimableStoreCredit()
          Will create a store credit in the claimable repository.
 RepositoryItem createTransientClaimableStoreCredit()
          This method will create a transient store credit in the claimable repository.
 void creditClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId, double pAmount)
          This method will credit a gift certificate for the amount identified by the parameter pAmount.
 void creditClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId, java.lang.Double pAmount)
          Deprecated. use creditClaimableGiftCertificate(String, double) instead
 void creditClaimableStoreCredit(java.lang.String pClaimableStoreCreditId, double pAmount)
          This method will credit a store credit for the amount identified by the parameter pAmount.
 void debitClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId, double pAmount)
          This method will debit a gift certificate for the amount identified by the parameter pAmount.
 void debitClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId, java.lang.Double pAmount)
          Deprecated. use debitClaimableGiftCertificate(String, double) instead
 void debitClaimableStoreCredit(java.lang.String pClaimableStoreCreditId, double pAmount)
          This method will debit a store credit for the amount identified by the parameter pAmount.
 void decreaseAuthorizationForClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId, double pAmount)
          Decreases the authorized amount for the gift certificate by the given amount
 void decreaseAuthorizationForClaimableStoreCredit(java.lang.String pClaimableStoreCreditId, double pAmount)
          Decreases the authorized amount for the store credit by the given amount
 void expireGiftCertificateAuthorization(java.lang.String pClaimableGiftCertificateId, double pAmount)
          This method will expire a gift certificate authorization for the amount identified by the parameter pAmount.
 void expireStoreCreditAuthorization(java.lang.String pClaimableStoreCreditId, double pAmount)
          This method will expire a store credit authorization for the amount identified by the parameter pAmount.
 RepositoryItem findAndClaimCoupon(java.lang.String pCouponClaimCode)
          Claims a coupon and returns it.
 ClaimableTools getClaimableTools()
          Return the claimableTools property.
 java.util.List getGiftCertificatesForProfile(java.lang.String pProfileId)
          Returns a List of gift certificate repository items which belong to the user with the profile id in pProfileId.
 java.util.List getGiftCertificatesForProfile(java.lang.String pProfileId, boolean pReturnAll)
          Returns a List of gift certificate repository items which belong to the user with the profile id in pProfileId.
 PricingTools getPricingTools()
          The PricingTools class is used to round intermediate values
 PromotionTools getPromotionTools()
          Return the PromotionTools property.
 java.util.List getStoreCreditsForProfile(java.lang.String pProfileId)
          Returns a List of store credit repository items which belong to the user with the profile id in pProfileId.
 java.util.List getStoreCreditsForProfile(java.lang.String pProfileId, boolean pReturnAll)
          Returns a List of store credit repository items which belong to the user with the profile id in pProfileId.
 javax.transaction.TransactionManager getTransactionManager()
          The TransactionManager
 java.lang.String[] getValidCouponItemTypes()
          The list of acceptable item types for promotions when claiming a coupon.
 void initializeClaimableGiftCertificate(RepositoryItem pClaimableGiftCertificate, double pAmount, double pAmountRemaining, java.lang.String pPurchaserId, java.util.Date pPurchaseDate)
          This will initialize a gift certificates values to be the parameters passed in.
 void initializeClaimableGiftCertificate(RepositoryItem pClaimableGiftCertificate, java.lang.Double pAmount, java.lang.Double pAmountRemaining, java.lang.String pPurchaserId, java.util.Date pPurchaseDate)
          Deprecated. use initializeClaimableGiftCertificate(RepositoryItem, double, double, String, Date) instead
 void initializeClaimablePromotion(RepositoryItem pClaimablePromotion, RepositoryItem pPromotion)
          This will initialize a claimable promotion (coupon) by setting the promotion property of the coupon to be the parameter pPromotion.
 void initializeClaimableStoreCredit(RepositoryItem pClaimableStoreCredit, double pAmount, double pAmountRemaining, java.lang.String pOwnerId, java.util.Date pExpirationDate)
          This will initialize store credit values to be the parameters passed in.
 void persistTransientClaimableItem(RepositoryItem pClaimableItem)
          This method calls the claimable tools component to persist the claimable item into the repository.
 void setClaimableTools(ClaimableTools pClaimableTools)
          Set the claimableTools property.
 void setPricingTools(PricingTools pPricingTools)
           
 void setPromotionTools(PromotionTools pPromotionTools)
          Set the PromotionTools property.
 void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
          Set the TransactionManager property.
 void setValidCouponItemTypes(java.lang.String[] pValidCouponItemTypes)
           
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION

sResourceBundle

protected static java.util.ResourceBundle sResourceBundle
Resource Bundle


sPromotionResourceBundle

protected static java.util.ResourceBundle sPromotionResourceBundle
Promotion Resource Bundle Used in claimCoupon for backwards compatibility


INVALID_GIFTCERT_ID_PARAMETER

protected static final java.lang.String INVALID_GIFTCERT_ID_PARAMETER
See Also:
Constant Field Values

INVALID_STORECREDIT_ID_PARAMETER

protected static final java.lang.String INVALID_STORECREDIT_ID_PARAMETER
See Also:
Constant Field Values

INVALID_INITIAL_PROMOTION_PARAMETER

protected static final java.lang.String INVALID_INITIAL_PROMOTION_PARAMETER
See Also:
Constant Field Values

INVALID_INITIAL_GIFTCERTIFICATE_PARAMETER

protected static final java.lang.String INVALID_INITIAL_GIFTCERTIFICATE_PARAMETER
See Also:
Constant Field Values

MSG_UNABLE_TO_CLAIM

protected static final java.lang.String MSG_UNABLE_TO_CLAIM
See Also:
Constant Field Values

MSG_INSUFFICIENT_FUNDS

protected static final java.lang.String MSG_INSUFFICIENT_FUNDS
See Also:
Constant Field Values

MSG_INSUFFICIENT_AUTH

protected static final java.lang.String MSG_INSUFFICIENT_AUTH
See Also:
Constant Field Values

MSG_INSUFFICIENT_CRED

protected static final java.lang.String MSG_INSUFFICIENT_CRED
See Also:
Constant Field Values

MSG_INSUFFICIENT_EXP_AMT

protected static final java.lang.String MSG_INSUFFICIENT_EXP_AMT
See Also:
Constant Field Values

MSG_INSUFFICIENT_AUTH_FOR_DEBIT

protected static final java.lang.String MSG_INSUFFICIENT_AUTH_FOR_DEBIT
See Also:
Constant Field Values

MSG_INSUFFICIENT_SC_FUNDS

protected static final java.lang.String MSG_INSUFFICIENT_SC_FUNDS
See Also:
Constant Field Values

MSG_INSUFFICIENT_SC_AUTH

protected static final java.lang.String MSG_INSUFFICIENT_SC_AUTH
See Also:
Constant Field Values

MSG_INSUFFICIENT_SC_CRED

protected static final java.lang.String MSG_INSUFFICIENT_SC_CRED
See Also:
Constant Field Values

MSG_INSUFFICIENT_SC_EXP_AMT

protected static final java.lang.String MSG_INSUFFICIENT_SC_EXP_AMT
See Also:
Constant Field Values

MSG_INSUFFICIENT_SC_AUTH_FOR_DEBIT

protected static final java.lang.String MSG_INSUFFICIENT_SC_AUTH_FOR_DEBIT
See Also:
Constant Field Values
Constructor Detail

ClaimableManager

public ClaimableManager()
Empty Constructor

Method Detail

setClaimableTools

public void setClaimableTools(ClaimableTools pClaimableTools)
Set the claimableTools property.


getClaimableTools

public ClaimableTools getClaimableTools()
Return the claimableTools property.


setPricingTools

public void setPricingTools(PricingTools pPricingTools)

getPricingTools

public PricingTools getPricingTools()
The PricingTools class is used to round intermediate values


setPromotionTools

public void setPromotionTools(PromotionTools pPromotionTools)
Set the PromotionTools property.


getPromotionTools

public PromotionTools getPromotionTools()
Return the PromotionTools property.


setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Set the TransactionManager property.


getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
The TransactionManager


setValidCouponItemTypes

public void setValidCouponItemTypes(java.lang.String[] pValidCouponItemTypes)

getValidCouponItemTypes

public java.lang.String[] getValidCouponItemTypes()
The list of acceptable item types for promotions when claiming a coupon. Used in handleClaimCoupon


claimItem

public RepositoryItem claimItem(java.lang.String pId)
                         throws ClaimableException
This method will claim an item from the repository. It will first use ClaimableTools to attempt and claim an item from the repository. If it succesfully claims the item it will then adjust the status of the claimed item to be ClaimableTools.CLAIMED. If no item could be found in the repository for the pId, then null is returned.

To claim the item and adjust the status, the methods provided by the ClaimableTools package will be used.

Parameters:
pId - the repository id of the item to be claimed.
Returns:
the claimed repository item
Throws:
ClaimableException - if an error occurs

claimItems

public RepositoryItem[] claimItems(java.lang.String[] pIds)
                            throws ClaimableException
Same as the claimItem method except can take an array argument.

Parameters:
pIds - a value of type 'String[]'
Returns:
a value of type 'RepositoryItem[]'
Throws:
ClaimableException - if an error occurs

createClaimableGiftCertificate

public RepositoryItem createClaimableGiftCertificate()
                                              throws ClaimableException
Will create a gift certificate in the claimable repository. It uses the method createClaimableItem found in the ClaimableTools package to create the gift certificate. It obtains the item descriptor to use to by the property getGiftCertificateItemDescriptorName of ClaimableTools.

Returns:
the created GiftCertificate
Throws:
ClaimableException - if an error occurs

createClaimablePromotion

public RepositoryItem createClaimablePromotion()
                                        throws ClaimableException
Will create a coupon in the claimable repository. It uses the method createClaimableItem found in the ClaimableTools package to create the coupon. It obtains the item descriptor to use to by the property getCouponItemDescriptorName of ClaimableTools.

Returns:
the created Coupon
Throws:
ClaimableException - if an error occurs

createClaimableStoreCredit

public RepositoryItem createClaimableStoreCredit()
                                          throws ClaimableException
Will create a store credit in the claimable repository. It uses the method createClaimableItem found in the ClaimableTools package to create the store credit. It obtains the item descriptor to use by the property getStoreCreditItemDescriptorName of ClaimableTools.

Returns:
the created StoreCredit
Throws:
ClaimableException - if an error occurs

createTransientClaimableStoreCredit

public RepositoryItem createTransientClaimableStoreCredit()
                                                   throws ClaimableException
This method will create a transient store credit in the claimable repository. It uses the method createClaimableItem found in the ClaimableTools package to create the store credit. It obtains the item descriptor to use by the property getStoreCreditItemDescriptorName of ClaimableTools.

Returns:
the created StoreCredit
Throws:
ClaimableException - if an error occurs

initializeClaimablePromotion

public void initializeClaimablePromotion(RepositoryItem pClaimablePromotion,
                                         RepositoryItem pPromotion)
                                  throws CommerceException
This will initialize a claimable promotion (coupon) by setting the promotion property of the coupon to be the parameter pPromotion. The item will then be updated into the repository to persist the change.

The promotion property of the ClaimablePromotion is identified by by the getPromotionPropertyName method of ClaimableTools.

Parameters:
pClaimablePromotion - the coupon to be updated
pPromotion - the promotion that will be associated witht he coupon
Throws:
CommerceException - if an error occurs

initializeClaimableGiftCertificate

public void initializeClaimableGiftCertificate(RepositoryItem pClaimableGiftCertificate,
                                               java.lang.Double pAmount,
                                               java.lang.Double pAmountRemaining,
                                               java.lang.String pPurchaserId,
                                               java.util.Date pPurchaseDate)
                                        throws CommerceException
Deprecated. use initializeClaimableGiftCertificate(RepositoryItem, double, double, String, Date) instead

This will initialize a gift certificates values to be the parameters passed in. After all the parameters have been set, the gift certificate will be updated to the repository so that the changes are persisted. All properties being set in the giftCertificate are obtained from ClaimableTools. For example, ClaimableTools.getGiftCertificateAmountRemainingPropertyName() will obtain the property amountRemaining for a gift certificate.

Parameters:
pClaimableGiftCertificate - the giftCertificate whose properties will be updated
pAmount - the amount that the gift certificate will be set to
pAmountRemaining - the amount remaining on the gift certificate
pPurchaserId - id of the person purchasing the gift certificate
pPurchaseDate - the date that the gift certificate was purchased on
Throws:
CommerceException - if an error occurs

initializeClaimableGiftCertificate

public void initializeClaimableGiftCertificate(RepositoryItem pClaimableGiftCertificate,
                                               double pAmount,
                                               double pAmountRemaining,
                                               java.lang.String pPurchaserId,
                                               java.util.Date pPurchaseDate)
                                        throws CommerceException
This will initialize a gift certificates values to be the parameters passed in. After all the parameters have been set, the gift certificate will be updated to the repository so that the changes are persisted. All properties being set in the giftCertificate are obtained from ClaimableTools. For example, ClaimableTools.getGiftCertificateAmountRemainingPropertyName() will obtain the property amountRemaining for a gift certificate.

Parameters:
pClaimableGiftCertificate - the giftCertificate whose properties will be updated
pAmount - the amount that the gift certificate will be set to
pAmountRemaining - the amount remaining on the gift certificate
pPurchaserId - id of the person purchasing the gift certificate
pPurchaseDate - the date that the gift certificate was purchased on
Throws:
CommerceException - if an error occurs

initializeClaimableStoreCredit

public void initializeClaimableStoreCredit(RepositoryItem pClaimableStoreCredit,
                                           double pAmount,
                                           double pAmountRemaining,
                                           java.lang.String pOwnerId,
                                           java.util.Date pExpirationDate)
                                    throws CommerceException
This will initialize store credit values to be the parameters passed in. After all the parameters have been set, the store credit will be updated to the repository so that the changes are persisted. All properties being set in the storeCredit are obtained from ClaimableTools. For example, ClaimableTools.getStoreCreditAmountRemainingPropertyName() will obtain the property amountRemaining for a store credit.

Parameters:
pClaimableStoreCredit - the store credit whose properties will be updated
pAmount - the amount that the store credit will be set to
pAmountRemaining - the amount remaining on the store credit
pOwnerId - id of the person the store credit belongs to
pExpirationDate - the expiration date of the store credit, can be null which means the credit never expires
Throws:
CommerceException - if an error occurs

getStoreCreditsForProfile

public java.util.List getStoreCreditsForProfile(java.lang.String pProfileId)
                                         throws CommerceException
Returns a List of store credit repository items which belong to the user with the profile id in pProfileId.

Parameters:
pProfileId - the profile id of the user to retrieve the StoreCredits for
Returns:
a List of repository items which are the store credits for the user
Throws:
if - an exception occurs while executing the query
CommerceException

getStoreCreditsForProfile

public java.util.List getStoreCreditsForProfile(java.lang.String pProfileId,
                                                boolean pReturnAll)
                                         throws CommerceException
Returns a List of store credit repository items which belong to the user with the profile id in pProfileId.

Parameters:
pProfileId - the profile id of the user to retrieve the StoreCredits for
pReturnAll - return all store credits vs the store credits which still have money left on them
Returns:
a List of repository items which are the store credits for the user
Throws:
if - an exception occurs while executing the query
CommerceException

getGiftCertificatesForProfile

public java.util.List getGiftCertificatesForProfile(java.lang.String pProfileId)
                                             throws CommerceException
Returns a List of gift certificate repository items which belong to the user with the profile id in pProfileId.

Parameters:
pProfileId - the profile id of the user to retrieve the GiftCertificates for
Returns:
a List of repository items which are the gift certificates for the user
Throws:
if - an exception occurs while executing the query
CommerceException

getGiftCertificatesForProfile

public java.util.List getGiftCertificatesForProfile(java.lang.String pProfileId,
                                                    boolean pReturnAll)
                                             throws CommerceException
Returns a List of gift certificate repository items which belong to the user with the profile id in pProfileId.

Parameters:
pProfileId - the profile id of the user to retrieve the GiftCertificates for
pReturnAll - return all gift certificates vs the gift certificates which still have money left on them
Returns:
a List of repository items which are the gift certificates for the user
Throws:
if - an exception occurs while executing the query
CommerceException

authorizeClaimableGiftCertificate

public void authorizeClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId,
                                              java.lang.Double pAmount)
                                       throws InvalidParameterException,
                                              ClaimableException,
                                              RepositoryException
Deprecated. use authorizeClaimableGiftCertificate(String, double) instead

This method will authorize a gift certificate for the amount identified by the parameter pAmount. It will first try and claim the gift certificate item from the repository. Then it will check to see if the amountRemaining in the gift certificate is greater than or equal to the amount.

If the giftCertificate parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.

Parameters:
pClaimableGiftCertificateId - the id of the gift certificate to adjust
pAmount - the amount to credit to the gift certificate
Throws:
InvalidParameterException - if an error occurs
ClaimableException - if an error occurs
RepositoryException - if an error occurs

authorizeClaimableGiftCertificate

public void authorizeClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId,
                                              double pAmount)
                                       throws InvalidParameterException,
                                              ClaimableException,
                                              RepositoryException
This method will authorize a gift certificate for the amount identified by the parameter pAmount. It will first try and claim the gift certificate item from the repository. Then it will check to see if the amountRemaining in the gift certificate is greater than or equal to the amount.

If the giftCertificate parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.

Parameters:
pClaimableGiftCertificateId - the id of the gift certificate to adjust
pAmount - the amount to authorize to the gift certificate
Throws:
InvalidParameterException - if an error occurs
ClaimableException - if an error occurs
RepositoryException - if an error occurs

decreaseAuthorizationForClaimableGiftCertificate

public void decreaseAuthorizationForClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId,
                                                             double pAmount)
                                                      throws InvalidParameterException,
                                                             ClaimableException,
                                                             RepositoryException
Decreases the authorized amount for the gift certificate by the given amount

Parameters:
pClaimableGiftCertificateId -
pAmount -
Throws:
InvalidParameterException
ClaimableException
RepositoryException

decreaseAuthorizationForClaimableStoreCredit

public void decreaseAuthorizationForClaimableStoreCredit(java.lang.String pClaimableStoreCreditId,
                                                         double pAmount)
                                                  throws InvalidParameterException,
                                                         ClaimableException,
                                                         RepositoryException
Decreases the authorized amount for the store credit by the given amount

Parameters:
pClaimableGiftCertificateId -
pAmount -
Throws:
InvalidParameterException
ClaimableException
RepositoryException

authorizeClaimableStoreCredit

public void authorizeClaimableStoreCredit(java.lang.String pClaimableStoreCreditId,
                                          double pAmount)
                                   throws InvalidParameterException,
                                          ClaimableException,
                                          RepositoryException
This method will authorize a store credit for the amount identified by the parameter pAmount. It will first try and claim the store credit item from the repository. Then it will check to see if the amountRemaining in the store credit is greater than or equal to the amount.

If the store credit parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.

Parameters:
pClaimableStoreCreditId - the id of the store credit to adjust
pAmount - the amount to authorize to the store credit
Throws:
InvalidParameterException - if an error occurs
ClaimableException - if an error occurs
RepositoryException - if an error occurs

expireGiftCertificateAuthorization

public void expireGiftCertificateAuthorization(java.lang.String pClaimableGiftCertificateId,
                                               double pAmount)
                                        throws InvalidParameterException,
                                               ClaimableException,
                                               InsufficientFundsException,
                                               RepositoryException
This method will expire a gift certificate authorization for the amount identified by the parameter pAmount. It will first try and claim the gift certificate item from the repository. Then it will get the current amount authorized and subtract the parameter pAmount from it. Finally, it will update the lastUsed property to be the current date.

If the giftCertificate parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.

Parameters:
pClaimableGiftCertificateId - the id of the gift certificate to adjust
pAmount - the amount to debit to the gift certificate
Throws:
InvalidParameterException - if an error occurs
ClaimableException - if an error occurs
RepositoryException - if an error occurs
InsufficientFundsException - if the amount remaing is less then the pAmount.

expireStoreCreditAuthorization

public void expireStoreCreditAuthorization(java.lang.String pClaimableStoreCreditId,
                                           double pAmount)
                                    throws InvalidParameterException,
                                           ClaimableException,
                                           InsufficientFundsException,
                                           RepositoryException
This method will expire a store credit authorization for the amount identified by the parameter pAmount. It will first try and claim the store credit item from the repository. Then it will get the current amount authorized and subtract the parameter pAmount from it. Finally, it will update the lastUsed property to be the current date.

If the storeCredit parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.

Parameters:
pClaimableStoreCreditId - the id of the store credit to adjust
pAmount - the amount to expire from the store credit authorization
Throws:
InvalidParameterException - if an error occurs
ClaimableException - if an error occurs
RepositoryException - if an error occurs
InsufficientFundsException - if the amount remaining is less then the pAmount.

creditClaimableGiftCertificate

public void creditClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId,
                                           java.lang.Double pAmount)
                                    throws InvalidParameterException,
                                           ClaimableException,
                                           InsufficientFundsException,
                                           RepositoryException
Deprecated. use creditClaimableGiftCertificate(String, double) instead

This method will credit a gift certificate for the amount identified by the parameter pAmount. It will first try and claim the gift certificate item from the repository. Then it will get the current amount remaining and add the parameter pAmount to it. Finally, it will update the lastUsed property to be the current date.

If the giftCertificate parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.

Parameters:
pClaimableGiftCertificateId - the id of the gift certificate to adjust
pAmount - the amount to credit to the gift certificate
Throws:
InvalidParameterException - if an error occurs
ClaimableException - if an error occurs
RepositoryException - if an error occurs
InsufficientFundsException

creditClaimableGiftCertificate

public void creditClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId,
                                           double pAmount)
                                    throws InvalidParameterException,
                                           ClaimableException,
                                           InsufficientFundsException,
                                           RepositoryException
This method will credit a gift certificate for the amount identified by the parameter pAmount. It will first try and claim the gift certificate item from the repository. Then it will get the current amount remaining and add the parameter pAmount to it. Finally, it will update the lastUsed property to be the current date.

If the giftCertificate parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.

Parameters:
pClaimableGiftCertificateId - the id of the gift certificate to adjust
pAmount - the amount to credit to the gift certificate
Throws:
InvalidParameterException - if an error occurs
ClaimableException - if an error occurs
RepositoryException - if an error occurs
InsufficientFundsException

creditClaimableStoreCredit

public void creditClaimableStoreCredit(java.lang.String pClaimableStoreCreditId,
                                       double pAmount)
                                throws InvalidParameterException,
                                       ClaimableException,
                                       InsufficientFundsException,
                                       RepositoryException
This method will credit a store credit for the amount identified by the parameter pAmount. It will first try and claim the store credit item from the repository. Then it will get the current amount remaining and add the parameter pAmount to it. Finally, it will update the lastUsed property to be the current date.

If the storeCredit parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.

Parameters:
pClaimableStoreCreditId - the id of the store credit to adjust
pAmount - the amount to credit to the store credit
Throws:
InvalidParameterException - if an error occurs
ClaimableException - if an error occurs
RepositoryException - if an error occurs
InsufficientFundsException

debitClaimableGiftCertificate

public void debitClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId,
                                          java.lang.Double pAmount)
                                   throws InvalidParameterException,
                                          ClaimableException,
                                          InsufficientFundsException,
                                          RepositoryException
Deprecated. use debitClaimableGiftCertificate(String, double) instead

This method will debit a gift certificate for the amount identified by the parameter pAmount. It will first try and claim the gift certificate item from the repository. Then it will get the current amount remaining and subtract the parameter pAmount to it. Finally, it will update the lastUsed property to be the current date.

If the giftCertificate parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.

Parameters:
pClaimableGiftCertificateId - the id of the gift certificate to adjust
pAmount - the amount to debit to the gift certificate
Throws:
InvalidParameterException - if an error occurs
ClaimableException - if an error occurs
RepositoryException - if an error occurs
InsufficientFundsException - if the amount remaing is less then the pAmount.

debitClaimableGiftCertificate

public void debitClaimableGiftCertificate(java.lang.String pClaimableGiftCertificateId,
                                          double pAmount)
                                   throws InvalidParameterException,
                                          ClaimableException,
                                          InsufficientFundsException,
                                          RepositoryException
This method will debit a gift certificate for the amount identified by the parameter pAmount. It will first try and claim the gift certificate item from the repository. Then it will get the current amount remaining and subtract the parameter pAmount to it. Finally, it will update the lastUsed property to be the current date.

If the giftCertificate parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.

Parameters:
pClaimableGiftCertificateId - the id of the gift certificate to adjust
pAmount - the amount to debit to the gift certificate
Throws:
InvalidParameterException - if an error occurs
ClaimableException - if an error occurs
RepositoryException - if an error occurs
InsufficientFundsException - if the amount remaing is less then the pAmount.

debitClaimableStoreCredit

public void debitClaimableStoreCredit(java.lang.String pClaimableStoreCreditId,
                                      double pAmount)
                               throws InvalidParameterException,
                                      ClaimableException,
                                      InsufficientFundsException,
                                      RepositoryException
This method will debit a store credit for the amount identified by the parameter pAmount. It will first try and claim the store credit item from the repository. Then it will get the current amount remaining and subtract the parameter pAmount to it. Finally, it will update the lastUsed property to be the current date.

If the storeCredit parameter is either null, or can't be claimed then a InvalidParameterException will be thrown.

Parameters:
pClaimableStoreCreditId - the id of the store credit to adjust
pAmount - the amount to debit to the store credit
Throws:
InvalidParameterException - if an error occurs
ClaimableException - if an error occurs
RepositoryException - if an error occurs
InsufficientFundsException - if the amount remaing is less then the pAmount.

checkExpireDate

public boolean checkExpireDate(RepositoryItem pClaimableItem)
Check whether the ClaimableItem is expired or not

Parameters:
pClaimableItem -
Returns:
true if expired; false if not expired

checkPromotionType

public boolean checkPromotionType(RepositoryItem pPromotion)
Checks to see if the type of the promotion is valid. All valid types appear in the list validCouponItemTypes

Parameters:
pPromotion -
Returns:
true if the item type is in the validCouponItemTypes list.

claimCoupon

public void claimCoupon(java.lang.String pProfileId,
                        java.lang.String pCouponClaimCode)
                 throws ClaimableException
This method will attempt to claim the given coupon for the given user. It does this by calling findAndClaimCoupon, then, if necessary, updates the given profile's active promotions and initializes the pricing model holder.

Parameters:
pProfileId - The profile making the claim
pCouponClaimCode - The claim code of the coupon
Throws:
ClaimableException - Thrown on any problems
See Also:
findAndClaimCoupon(String), PromotionTools.addPromotion(MutableRepositoryItem, RepositoryItem, String), PromotionTools.initializePricingModels()

findAndClaimCoupon

public RepositoryItem findAndClaimCoupon(java.lang.String pCouponClaimCode)
                                  throws ClaimableException
Claims a coupon and returns it.

If the coupon has expired, an ClaimableException is thrown

Parameters:
pCouponClaimCode -
Returns:
the coupon item
Throws:
ClaimableException
See Also:
claimItem(String), checkExpireDate(RepositoryItem)

persistTransientClaimableItem

public void persistTransientClaimableItem(RepositoryItem pClaimableItem)
                                   throws ClaimableException
This method calls the claimable tools component to persist the claimable item into the repository.

Parameters:
pClaimableItem -
Throws:
ClaimableException